Mercurial > hg > xemacs-beta
diff lib-src/cvtmail.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 74fd4e045ea6 |
children | 11054d720c21 |
line wrap: on
line diff
--- a/lib-src/cvtmail.c Mon Aug 13 11:19:22 2007 +0200 +++ b/lib-src/cvtmail.c Mon Aug 13 11:20:41 2007 +0200 @@ -35,20 +35,27 @@ */ -#include <config.h> +#include <../src/config.h> #include <stdio.h> #include <string.h> -#include <stdlib.h> -static void *xmalloc (size_t); -static void *xrealloc (void *, size_t); +#if __STDC__ || defined(STDC_HEADERS) +# include <stdlib.h> +#else +char *malloc (); +char *getenv (); +#endif +static void *xmalloc (unsigned int); +static void *xrealloc (char *ptr, unsigned int); static void skip_to_lf (FILE *stream); -static void fatal (const char *s1, const char *s2); -static void error (const char *s1, const char *s2); +static void fatal (CONST char *s1, CONST char *s2); +static void error (CONST char *s1, CONST char *s2); int -main (int argc, char *argv[]) +main (argc, argv) + int argc; + char *argv[]; { char *hd; char *md; @@ -63,7 +70,7 @@ char name[14]; int c; - hd = getenv ("HOME"); + hd = (char *) getenv ("HOME"); md = (char *) xmalloc (strlen (hd) + 10); strcpy (md, hd); @@ -111,7 +118,8 @@ } static void -skip_to_lf (FILE *stream) +skip_to_lf (stream) + FILE *stream; { register int c; while ((c = getc(stream)) != '\n') @@ -119,18 +127,21 @@ } static void * -xmalloc (size_t size) +xmalloc (size) + unsigned size; { - void *result = malloc (size); + char *result = (char *) malloc (size); if (!result) fatal ("virtual memory exhausted", 0); return result; } static void * -xrealloc (void *ptr, size_t size) +xrealloc (ptr, size) + char *ptr; + unsigned size; { - void *result = realloc (ptr, size); + char *result = (char *) realloc (ptr, size); if (!result) fatal ("virtual memory exhausted", 0); return result; @@ -139,14 +150,14 @@ /* Print error message and exit. */ static void -fatal (const char *s1, const char *s2) +fatal (CONST char *s1, CONST char *s2) { error (s1, s2); exit (1); } static void -error (const char *s1, const char *s2) +error (CONST char *s1, CONST char *s2) { fprintf (stderr, "cvtmail: "); fprintf (stderr, s1, s2);