Mercurial > hg > xemacs-beta
comparison lib-src/sorted-doc.c @ 169:15872534500d r20-3b11
Import from CVS: tag r20-3b11
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:46:53 +0200 |
parents | 376386a54a3c |
children | 336b97f03633 |
comparison
equal
deleted
inserted
replaced
168:9851d5c6556e | 169:15872534500d |
---|---|
51 | 51 |
52 | 52 |
53 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 53 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
54 | 54 |
55 static void | 55 static void |
56 error (s1, s2) | 56 error (char *s1, char *s2) |
57 char *s1, *s2; | |
58 { | 57 { |
59 fprintf (stderr, "sorted-doc: "); | 58 fprintf (stderr, "sorted-doc: "); |
60 fprintf (stderr, s1, s2); | 59 fprintf (stderr, s1, s2); |
61 fprintf (stderr, "\n"); | 60 fprintf (stderr, "\n"); |
62 } | 61 } |
63 | 62 |
64 /* Print error message and exit. */ | 63 /* Print error message and exit. */ |
65 | 64 |
66 static void | 65 static void |
67 fatal (s1, s2) | 66 fatal (char *s1, char *s2) |
68 char *s1, *s2; | |
69 { | 67 { |
70 error (s1, s2); | 68 error (s1, s2); |
71 exit (1); | 69 exit (1); |
72 } | 70 } |
73 | 71 |
74 /* Like malloc but get fatal error if memory is exhausted. */ | 72 /* Like malloc but get fatal error if memory is exhausted. */ |
75 | 73 |
76 static void * | 74 static void * |
77 xmalloc (size) | 75 xmalloc (int size) |
78 int size; | |
79 { | 76 { |
80 char *result = malloc ((unsigned)size); | 77 char *result = malloc ((unsigned)size); |
81 if (result == NULL) | 78 if (result == NULL) |
82 fatal ("%s", "virtual memory exhausted"); | 79 fatal ("%s", "virtual memory exhausted"); |
83 return result; | 80 return result; |
111 { | 108 { |
112 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" | 109 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" |
113 }; | 110 }; |
114 | 111 |
115 int | 112 int |
116 main () | 113 main (int argc, char *argv[]) |
117 { | 114 { |
118 register DOCSTR *dp = NULL; /* allocated DOCSTR */ | 115 register DOCSTR *dp = NULL; /* allocated DOCSTR */ |
119 register LINE *lp = NULL; /* allocated line */ | 116 register LINE *lp = NULL; /* allocated line */ |
120 register char *bp = 0; /* ptr inside line buffer */ | 117 register char *bp = 0; /* ptr inside line buffer */ |
121 /* int notfirst = 0; / * set after read something */ | 118 /* int notfirst = 0; / * set after read something */ |