-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes since 1.0.17: * Many portability fixes. Tarsnap should now build and run on FreeBSD, Linux (success has been reported on Debian, Ubuntu, CentOS, Slackware, Gentoo, and RedHat), OS X, NetBSD, OpenBSD, and OpenSolaris. Thanks to "Triskelios" (IRC nick), "WEiRDJE" (IRC nick), Thomas Hurst, and Justin Haynes for their help with testing and fixing portability issues. * Minor bugfixes (mostly harmless).
- Loading branch information
Showing
18 changed files
with
144 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "bsdtar_platform.h" | ||
|
||
#include <stdarg.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#ifndef HAVE_ASPRINTF | ||
|
||
/** | ||
* asprintf(ret, format, ...): | ||
* Do asprintf(3) like GNU and BSD do. | ||
*/ | ||
int | ||
asprintf(char **ret, const char *format, ...) | ||
{ | ||
va_list ap; | ||
int len; | ||
size_t buflen; | ||
|
||
/* Figure out how long the string needs to be. */ | ||
va_start(ap, format); | ||
len = vsnprintf(NULL, 0, format, ap); | ||
va_end(ap); | ||
|
||
/* Did we fail? */ | ||
if (len < 0) | ||
goto err0; | ||
buflen = (size_t)(len) + 1; | ||
|
||
/* Allocate memory. */ | ||
if ((*ret = malloc(buflen)) == NULL) | ||
goto err0; | ||
|
||
/* Actually generate the string. */ | ||
va_start(ap, format); | ||
len = vsnprintf(*ret, buflen, format, ap); | ||
va_end(ap); | ||
|
||
/* Did we fail? */ | ||
if (len < 0) | ||
goto err1; | ||
|
||
/* Success! */ | ||
return (len); | ||
|
||
err1: | ||
free(*ret); | ||
err0: | ||
/* Failure! */ | ||
return (-1); | ||
} | ||
|
||
#endif /* !HAVE_ASPRINTF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef _ASPRINTF_H_ | ||
#define _ASPRINTF_H_ | ||
|
||
int asprintf(char **, const char *, ...); | ||
|
||
#endif /* !_ASPRINTF_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.