version 1.1, 1999/11/18 16:29:01 |
version 1.2, 2000/06/05 14:01:15 |
|
|
* easprintf() calls vasprintf() and exits with an error if vasprintf() |
* easprintf() calls vasprintf() and exits with an error if vasprintf() |
* returns -1 (out of memory). |
* returns -1 (out of memory). |
*/ |
*/ |
void |
int |
#ifdef __STDC__ |
#ifdef __STDC__ |
easprintf(char **ret, const char *fmt, ...) |
easprintf(char **ret, const char *fmt, ...) |
#else |
#else |
|
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); |
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); |
exit(1); |
exit(1); |
} |
} |
|
return(len); |
} |
} |
|
|
/* |
/* |
* evasprintf() calls vasprintf() and exits with an error if vasprintf() |
* evasprintf() calls vasprintf() and exits with an error if vasprintf() |
* returns -1 (out of memory). |
* returns -1 (out of memory). |
*/ |
*/ |
void |
int |
evasprintf(ret, format, args) |
evasprintf(ret, format, args) |
char **ret; |
char **ret; |
const char *format; |
const char *format; |
va_list args; |
va_list args; |
{ |
{ |
|
int len; |
|
|
if (vasprintf(ret, format, args) == -1) { |
if ((len = vasprintf(ret, format, args)) == -1) { |
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); |
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); |
exit(1); |
exit(1); |
} |
} |
|
return(len); |
} |
} |