1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
/*
* Source file:
* utils.c
*/
#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "trueprint.h"
#include "utils.h"
void
skipspaces(char **ptr)
{
while (**ptr && isspace(**ptr)) (*ptr)++;
}
void *
xmalloc(size_t s)
{
void *r;
if ((r = malloc(s)) == NULL)
{
fprintf(stderr, gettext(CMD_NAME ": cannot allocate memory\n"));
exit(2);
}
return r;
}
void *
xrealloc(void *v, size_t s)
{
void *r;
if ((r = realloc(v,s)) == NULL)
{
fprintf(stderr, gettext(CMD_NAME ": cannot reallocate memory\n"));
exit(2);
}
return r;
}
#if ! HAVE_GETTEXT
#endif
|