diff options
Diffstat (limited to 'lib-src/sorted-doc.c')
| -rw-r--r-- | lib-src/sorted-doc.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index ce58529193a..595633b76d8 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c | |||
| @@ -65,8 +65,7 @@ struct docstr /* Allocated thing for an entry. */ | |||
| 65 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 65 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
| 66 | 66 | ||
| 67 | void | 67 | void |
| 68 | error (s1, s2) | 68 | error (char *s1, char *s2) |
| 69 | char *s1, *s2; | ||
| 70 | { | 69 | { |
| 71 | fprintf (stderr, "sorted-doc: "); | 70 | fprintf (stderr, "sorted-doc: "); |
| 72 | fprintf (stderr, s1, s2); | 71 | fprintf (stderr, s1, s2); |
| @@ -76,8 +75,7 @@ error (s1, s2) | |||
| 76 | /* Print error message and exit. */ | 75 | /* Print error message and exit. */ |
| 77 | 76 | ||
| 78 | void | 77 | void |
| 79 | fatal (s1, s2) | 78 | fatal (char *s1, char *s2) |
| 80 | char *s1, *s2; | ||
| 81 | { | 79 | { |
| 82 | error (s1, s2); | 80 | error (s1, s2); |
| 83 | exit (EXIT_FAILURE); | 81 | exit (EXIT_FAILURE); |
| @@ -86,8 +84,7 @@ fatal (s1, s2) | |||
| 86 | /* Like malloc but get fatal error if memory is exhausted. */ | 84 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 87 | 85 | ||
| 88 | char * | 86 | char * |
| 89 | xmalloc (size) | 87 | xmalloc (int size) |
| 90 | int size; | ||
| 91 | { | 88 | { |
| 92 | char *result = malloc ((unsigned)size); | 89 | char *result = malloc ((unsigned)size); |
| 93 | if (result == NULL) | 90 | if (result == NULL) |
| @@ -96,8 +93,7 @@ xmalloc (size) | |||
| 96 | } | 93 | } |
| 97 | 94 | ||
| 98 | char * | 95 | char * |
| 99 | xstrdup (str) | 96 | xstrdup (char *str) |
| 100 | char * str; | ||
| 101 | { | 97 | { |
| 102 | char *buf = xmalloc (strlen (str) + 1); | 98 | char *buf = xmalloc (strlen (str) + 1); |
| 103 | (void) strcpy (buf, str); | 99 | (void) strcpy (buf, str); |
| @@ -107,16 +103,15 @@ xstrdup (str) | |||
| 107 | /* Comparison function for qsort to call. */ | 103 | /* Comparison function for qsort to call. */ |
| 108 | 104 | ||
| 109 | int | 105 | int |
| 110 | cmpdoc (a, b) | 106 | cmpdoc (const void *va, const void *vb) |
| 111 | DOCSTR **a; | ||
| 112 | DOCSTR **b; | ||
| 113 | { | 107 | { |
| 108 | DOCSTR *const *a = va; | ||
| 109 | DOCSTR *const *b = vb; | ||
| 114 | register int val = strcmp ((*a)->name, (*b)->name); | 110 | register int val = strcmp ((*a)->name, (*b)->name); |
| 115 | if (val) return val; | 111 | if (val) return val; |
| 116 | return (*a)->type - (*b)->type; | 112 | return (*a)->type - (*b)->type; |
| 117 | } | 113 | } |
| 118 | 114 | ||
| 119 | |||
| 120 | enum state | 115 | enum state |
| 121 | { | 116 | { |
| 122 | WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET | 117 | WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET |
| @@ -128,7 +123,7 @@ char *states[] = | |||
| 128 | }; | 123 | }; |
| 129 | 124 | ||
| 130 | int | 125 | int |
| 131 | main () | 126 | main (void) |
| 132 | { | 127 | { |
| 133 | register DOCSTR *dp = NULL; /* allocated DOCSTR */ | 128 | register DOCSTR *dp = NULL; /* allocated DOCSTR */ |
| 134 | register LINE *lp = NULL; /* allocated line */ | 129 | register LINE *lp = NULL; /* allocated line */ |