Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * docproc is a simple preprocessor for the template files | |
3 | * used as placeholders for the kernel internal documentation. | |
4 | * docproc is used for documentation-frontend and | |
5 | * dependency-generator. | |
6 | * The two usages have in common that they require | |
7 | * some knowledge of the .tmpl syntax, therefore they | |
8 | * are kept together. | |
9 | * | |
10 | * documentation-frontend | |
11 | * Scans the template file and call kernel-doc for | |
12 | * all occurrences of ![EIF]file | |
6dd16f44 RD |
13 | * Beforehand each referenced file is scanned for |
14 | * any symbols that are exported via these macros: | |
15 | * EXPORT_SYMBOL(), EXPORT_SYMBOL_GPL(), & | |
16 | * EXPORT_SYMBOL_GPL_FUTURE() | |
1da177e4 LT |
17 | * This is used to create proper -function and |
18 | * -nofunction arguments in calls to kernel-doc. | |
19 | * Usage: docproc doc file.tmpl | |
20 | * | |
21 | * dependency-generator: | |
22 | * Scans the template file and list all files | |
23 | * referenced in a format recognized by make. | |
24 | * Usage: docproc depend file.tmpl | |
25 | * Writes dependency information to stdout | |
26 | * in the following format: | |
27 | * file.tmpl src.c src2.c | |
28 | * The filenames are obtained from the following constructs: | |
29 | * !Efilename | |
30 | * !Ifilename | |
31 | * !Dfilename | |
32 | * !Ffilename | |
e662af42 | 33 | * !Pfilename |
1da177e4 LT |
34 | * |
35 | */ | |
36 | ||
eda603f6 | 37 | #define _GNU_SOURCE |
1da177e4 LT |
38 | #include <stdio.h> |
39 | #include <stdlib.h> | |
40 | #include <string.h> | |
41 | #include <ctype.h> | |
42 | #include <unistd.h> | |
43 | #include <limits.h> | |
eda603f6 | 44 | #include <errno.h> |
1da177e4 LT |
45 | #include <sys/types.h> |
46 | #include <sys/wait.h> | |
47 | ||
48 | /* exitstatus is used to keep track of any failing calls to kernel-doc, | |
49 | * but execution continues. */ | |
50 | int exitstatus = 0; | |
51 | ||
52 | typedef void DFL(char *); | |
53 | DFL *defaultline; | |
54 | ||
55 | typedef void FILEONLY(char * file); | |
56 | FILEONLY *internalfunctions; | |
57 | FILEONLY *externalfunctions; | |
58 | FILEONLY *symbolsonly; | |
eda603f6 | 59 | FILEONLY *findall; |
1da177e4 | 60 | |
48b9d03c | 61 | typedef void FILELINE(char * file, char * line); |
1da177e4 LT |
62 | FILELINE * singlefunctions; |
63 | FILELINE * entity_system; | |
e662af42 | 64 | FILELINE * docsection; |
1da177e4 LT |
65 | |
66 | #define MAXLINESZ 2048 | |
67 | #define MAXFILES 250 | |
68 | #define KERNELDOCPATH "scripts/" | |
69 | #define KERNELDOC "kernel-doc" | |
70 | #define DOCBOOK "-docbook" | |
eda603f6 | 71 | #define LIST "-list" |
1da177e4 LT |
72 | #define FUNCTION "-function" |
73 | #define NOFUNCTION "-nofunction" | |
2e95972c | 74 | #define NODOCSECTIONS "-no-doc-sections" |
e946c43a | 75 | #define SHOWNOTFOUND "-show-not-found" |
1da177e4 | 76 | |
2d51005c | 77 | static char *srctree, *kernsrctree; |
bb13be51 | 78 | |
eda603f6 JB |
79 | static char **all_list = NULL; |
80 | static int all_list_len = 0; | |
81 | ||
82 | static void consume_symbol(const char *sym) | |
83 | { | |
84 | int i; | |
85 | ||
86 | for (i = 0; i < all_list_len; i++) { | |
87 | if (!all_list[i]) | |
88 | continue; | |
89 | if (strcmp(sym, all_list[i])) | |
90 | continue; | |
91 | all_list[i] = NULL; | |
92 | break; | |
93 | } | |
94 | } | |
95 | ||
4356f489 | 96 | static void usage (void) |
1da177e4 LT |
97 | { |
98 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); | |
99 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); | |
100 | fprintf(stderr, "doc: frontend when generating kernel documentation\n"); | |
101 | fprintf(stderr, "depend: generate list of files referenced within file\n"); | |
2d51005c JS |
102 | fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n"); |
103 | fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n"); | |
1da177e4 LT |
104 | } |
105 | ||
106 | /* | |
6dd16f44 | 107 | * Execute kernel-doc with parameters given in svec |
1da177e4 | 108 | */ |
4356f489 | 109 | static void exec_kernel_doc(char **svec) |
1da177e4 LT |
110 | { |
111 | pid_t pid; | |
112 | int ret; | |
113 | char real_filename[PATH_MAX + 1]; | |
114 | /* Make sure output generated so far are flushed */ | |
115 | fflush(stdout); | |
6dd16f44 | 116 | switch (pid=fork()) { |
1da177e4 LT |
117 | case -1: |
118 | perror("fork"); | |
119 | exit(1); | |
120 | case 0: | |
121 | memset(real_filename, 0, sizeof(real_filename)); | |
2d51005c JS |
122 | strncat(real_filename, kernsrctree, PATH_MAX); |
123 | strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, | |
1da177e4 LT |
124 | PATH_MAX - strlen(real_filename)); |
125 | execvp(real_filename, svec); | |
126 | fprintf(stderr, "exec "); | |
127 | perror(real_filename); | |
128 | exit(1); | |
129 | default: | |
130 | waitpid(pid, &ret ,0); | |
131 | } | |
132 | if (WIFEXITED(ret)) | |
133 | exitstatus |= WEXITSTATUS(ret); | |
134 | else | |
135 | exitstatus = 0xff; | |
136 | } | |
137 | ||
138 | /* Types used to create list of all exported symbols in a number of files */ | |
139 | struct symbols | |
140 | { | |
141 | char *name; | |
142 | }; | |
143 | ||
144 | struct symfile | |
145 | { | |
146 | char *filename; | |
147 | struct symbols *symbollist; | |
148 | int symbolcnt; | |
149 | }; | |
150 | ||
151 | struct symfile symfilelist[MAXFILES]; | |
152 | int symfilecnt = 0; | |
153 | ||
4356f489 | 154 | static void add_new_symbol(struct symfile *sym, char * symname) |
1da177e4 LT |
155 | { |
156 | sym->symbollist = | |
bb66fc67 | 157 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); |
1da177e4 LT |
158 | sym->symbollist[sym->symbolcnt++].name = strdup(symname); |
159 | } | |
160 | ||
161 | /* Add a filename to the list */ | |
4356f489 | 162 | static struct symfile * add_new_file(char * filename) |
1da177e4 LT |
163 | { |
164 | symfilelist[symfilecnt++].filename = strdup(filename); | |
165 | return &symfilelist[symfilecnt - 1]; | |
166 | } | |
6dd16f44 | 167 | |
1da177e4 | 168 | /* Check if file already are present in the list */ |
4356f489 | 169 | static struct symfile * filename_exist(char * filename) |
1da177e4 LT |
170 | { |
171 | int i; | |
172 | for (i=0; i < symfilecnt; i++) | |
173 | if (strcmp(symfilelist[i].filename, filename) == 0) | |
174 | return &symfilelist[i]; | |
175 | return NULL; | |
176 | } | |
177 | ||
178 | /* | |
179 | * List all files referenced within the template file. | |
180 | * Files are separated by tabs. | |
181 | */ | |
4356f489 TK |
182 | static void adddep(char * file) { printf("\t%s", file); } |
183 | static void adddep2(char * file, char * line) { line = line; adddep(file); } | |
184 | static void noaction(char * line) { line = line; } | |
185 | static void noaction2(char * file, char * line) { file = file; line = line; } | |
1da177e4 LT |
186 | |
187 | /* Echo the line without further action */ | |
4356f489 | 188 | static void printline(char * line) { printf("%s", line); } |
1da177e4 LT |
189 | |
190 | /* | |
6dd16f44 RD |
191 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & |
192 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). | |
1da177e4 LT |
193 | * All symbols located are stored in symfilelist. |
194 | */ | |
4356f489 | 195 | static void find_export_symbols(char * filename) |
1da177e4 LT |
196 | { |
197 | FILE * fp; | |
198 | struct symfile *sym; | |
199 | char line[MAXLINESZ]; | |
200 | if (filename_exist(filename) == NULL) { | |
201 | char real_filename[PATH_MAX + 1]; | |
202 | memset(real_filename, 0, sizeof(real_filename)); | |
bb13be51 | 203 | strncat(real_filename, srctree, PATH_MAX); |
2d51005c | 204 | strncat(real_filename, "/", PATH_MAX - strlen(real_filename)); |
1da177e4 LT |
205 | strncat(real_filename, filename, |
206 | PATH_MAX - strlen(real_filename)); | |
207 | sym = add_new_file(filename); | |
208 | fp = fopen(real_filename, "r"); | |
f0f3ca8d | 209 | if (fp == NULL) { |
1da177e4 LT |
210 | fprintf(stderr, "docproc: "); |
211 | perror(real_filename); | |
074a5dde | 212 | exit(1); |
1da177e4 | 213 | } |
6dd16f44 | 214 | while (fgets(line, MAXLINESZ, fp)) { |
48b9d03c M |
215 | char *p; |
216 | char *e; | |
6dd16f44 | 217 | if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) || |
bb66fc67 | 218 | ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) { |
1da177e4 LT |
219 | /* Skip EXPORT_SYMBOL{_GPL} */ |
220 | while (isalnum(*p) || *p == '_') | |
221 | p++; | |
6dd16f44 | 222 | /* Remove parentheses & additional whitespace */ |
1da177e4 LT |
223 | while (isspace(*p)) |
224 | p++; | |
225 | if (*p != '(') | |
226 | continue; /* Syntax error? */ | |
227 | else | |
228 | p++; | |
229 | while (isspace(*p)) | |
230 | p++; | |
231 | e = p; | |
232 | while (isalnum(*e) || *e == '_') | |
233 | e++; | |
234 | *e = '\0'; | |
235 | add_new_symbol(sym, p); | |
236 | } | |
237 | } | |
238 | fclose(fp); | |
239 | } | |
240 | } | |
241 | ||
242 | /* | |
243 | * Document all external or internal functions in a file. | |
244 | * Call kernel-doc with following parameters: | |
245 | * kernel-doc -docbook -nofunction function_name1 filename | |
6dd16f44 | 246 | * Function names are obtained from all the src files |
1da177e4 LT |
247 | * by find_export_symbols. |
248 | * intfunc uses -nofunction | |
249 | * extfunc uses -function | |
250 | */ | |
4356f489 | 251 | static void docfunctions(char * filename, char * type) |
1da177e4 LT |
252 | { |
253 | int i,j; | |
254 | int symcnt = 0; | |
255 | int idx = 0; | |
256 | char **vec; | |
257 | ||
258 | for (i=0; i <= symfilecnt; i++) | |
259 | symcnt += symfilelist[i].symbolcnt; | |
2e95972c | 260 | vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *)); |
1da177e4 LT |
261 | if (vec == NULL) { |
262 | perror("docproc: "); | |
263 | exit(1); | |
264 | } | |
265 | vec[idx++] = KERNELDOC; | |
266 | vec[idx++] = DOCBOOK; | |
2e95972c | 267 | vec[idx++] = NODOCSECTIONS; |
1da177e4 LT |
268 | for (i=0; i < symfilecnt; i++) { |
269 | struct symfile * sym = &symfilelist[i]; | |
270 | for (j=0; j < sym->symbolcnt; j++) { | |
271 | vec[idx++] = type; | |
eda603f6 | 272 | consume_symbol(sym->symbollist[j].name); |
1da177e4 LT |
273 | vec[idx++] = sym->symbollist[j].name; |
274 | } | |
275 | } | |
276 | vec[idx++] = filename; | |
277 | vec[idx] = NULL; | |
278 | printf("<!-- %s -->\n", filename); | |
279 | exec_kernel_doc(vec); | |
280 | fflush(stdout); | |
281 | free(vec); | |
282 | } | |
4356f489 TK |
283 | static void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } |
284 | static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } | |
1da177e4 LT |
285 | |
286 | /* | |
c6120938 | 287 | * Document specific function(s) in a file. |
1da177e4 LT |
288 | * Call kernel-doc with the following parameters: |
289 | * kernel-doc -docbook -function function1 [-function function2] | |
290 | */ | |
4356f489 | 291 | static void singfunc(char * filename, char * line) |
1da177e4 LT |
292 | { |
293 | char *vec[200]; /* Enough for specific functions */ | |
bb66fc67 MY |
294 | int i, idx = 0; |
295 | int startofsym = 1; | |
1da177e4 LT |
296 | vec[idx++] = KERNELDOC; |
297 | vec[idx++] = DOCBOOK; | |
e946c43a | 298 | vec[idx++] = SHOWNOTFOUND; |
1da177e4 | 299 | |
bb66fc67 MY |
300 | /* Split line up in individual parameters preceded by FUNCTION */ |
301 | for (i=0; line[i]; i++) { | |
302 | if (isspace(line[i])) { | |
303 | line[i] = '\0'; | |
304 | startofsym = 1; | |
305 | continue; | |
306 | } | |
307 | if (startofsym) { | |
308 | startofsym = 0; | |
309 | vec[idx++] = FUNCTION; | |
310 | vec[idx++] = &line[i]; | |
311 | } | |
312 | } | |
eda603f6 | 313 | for (i = 0; i < idx; i++) { |
bb66fc67 MY |
314 | if (strcmp(vec[i], FUNCTION)) |
315 | continue; | |
eda603f6 JB |
316 | consume_symbol(vec[i + 1]); |
317 | } | |
1da177e4 LT |
318 | vec[idx++] = filename; |
319 | vec[idx] = NULL; | |
320 | exec_kernel_doc(vec); | |
321 | } | |
322 | ||
e662af42 JB |
323 | /* |
324 | * Insert specific documentation section from a file. | |
325 | * Call kernel-doc with the following parameters: | |
326 | * kernel-doc -docbook -function "doc section" filename | |
327 | */ | |
4356f489 | 328 | static void docsect(char *filename, char *line) |
e662af42 | 329 | { |
e946c43a JB |
330 | /* kerneldoc -docbook -show-not-found -function "section" file NULL */ |
331 | char *vec[7]; | |
e662af42 JB |
332 | char *s; |
333 | ||
334 | for (s = line; *s; s++) | |
335 | if (*s == '\n') | |
336 | *s = '\0'; | |
337 | ||
d0f95c78 NK |
338 | if (asprintf(&s, "DOC: %s", line) < 0) { |
339 | perror("asprintf"); | |
340 | exit(1); | |
341 | } | |
eda603f6 JB |
342 | consume_symbol(s); |
343 | free(s); | |
344 | ||
e662af42 JB |
345 | vec[0] = KERNELDOC; |
346 | vec[1] = DOCBOOK; | |
e946c43a JB |
347 | vec[2] = SHOWNOTFOUND; |
348 | vec[3] = FUNCTION; | |
349 | vec[4] = line; | |
350 | vec[5] = filename; | |
351 | vec[6] = NULL; | |
e662af42 JB |
352 | exec_kernel_doc(vec); |
353 | } | |
354 | ||
eda603f6 JB |
355 | static void find_all_symbols(char *filename) |
356 | { | |
357 | char *vec[4]; /* kerneldoc -list file NULL */ | |
358 | pid_t pid; | |
359 | int ret, i, count, start; | |
360 | char real_filename[PATH_MAX + 1]; | |
361 | int pipefd[2]; | |
362 | char *data, *str; | |
363 | size_t data_len = 0; | |
364 | ||
365 | vec[0] = KERNELDOC; | |
366 | vec[1] = LIST; | |
367 | vec[2] = filename; | |
368 | vec[3] = NULL; | |
369 | ||
370 | if (pipe(pipefd)) { | |
371 | perror("pipe"); | |
372 | exit(1); | |
373 | } | |
374 | ||
375 | switch (pid=fork()) { | |
376 | case -1: | |
377 | perror("fork"); | |
378 | exit(1); | |
379 | case 0: | |
380 | close(pipefd[0]); | |
381 | dup2(pipefd[1], 1); | |
382 | memset(real_filename, 0, sizeof(real_filename)); | |
383 | strncat(real_filename, kernsrctree, PATH_MAX); | |
384 | strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, | |
385 | PATH_MAX - strlen(real_filename)); | |
386 | execvp(real_filename, vec); | |
387 | fprintf(stderr, "exec "); | |
388 | perror(real_filename); | |
389 | exit(1); | |
390 | default: | |
391 | close(pipefd[1]); | |
392 | data = malloc(4096); | |
393 | do { | |
394 | while ((ret = read(pipefd[0], | |
395 | data + data_len, | |
396 | 4096)) > 0) { | |
397 | data_len += ret; | |
398 | data = realloc(data, data_len + 4096); | |
399 | } | |
400 | } while (ret == -EAGAIN); | |
401 | if (ret != 0) { | |
402 | perror("read"); | |
403 | exit(1); | |
404 | } | |
405 | waitpid(pid, &ret ,0); | |
406 | } | |
407 | if (WIFEXITED(ret)) | |
408 | exitstatus |= WEXITSTATUS(ret); | |
409 | else | |
410 | exitstatus = 0xff; | |
411 | ||
412 | count = 0; | |
413 | /* poor man's strtok, but with counting */ | |
414 | for (i = 0; i < data_len; i++) { | |
415 | if (data[i] == '\n') { | |
416 | count++; | |
417 | data[i] = '\0'; | |
418 | } | |
419 | } | |
420 | start = all_list_len; | |
421 | all_list_len += count; | |
422 | all_list = realloc(all_list, sizeof(char *) * all_list_len); | |
423 | str = data; | |
424 | for (i = 0; i < data_len && start != all_list_len; i++) { | |
425 | if (data[i] == '\0') { | |
426 | all_list[start] = str; | |
427 | str = data + i + 1; | |
428 | start++; | |
429 | } | |
430 | } | |
431 | } | |
432 | ||
1dcdad0a JN |
433 | /* |
434 | * Terminate s at first space, if any. If there was a space, return pointer to | |
435 | * the character after that. Otherwise, return pointer to the terminating NUL. | |
436 | */ | |
437 | static char *chomp(char *s) | |
438 | { | |
439 | while (*s && !isspace(*s)) | |
440 | s++; | |
441 | ||
442 | if (*s) | |
443 | *s++ = '\0'; | |
444 | ||
445 | return s; | |
446 | } | |
447 | ||
a48dc45e JN |
448 | /* Return pointer to directive content, or NULL if not a directive. */ |
449 | static char *is_directive(char *line) | |
450 | { | |
451 | if (line[0] == '!') | |
452 | return line + 1; | |
453 | ||
454 | return NULL; | |
455 | } | |
456 | ||
1da177e4 LT |
457 | /* |
458 | * Parse file, calling action specific functions for: | |
459 | * 1) Lines containing !E | |
460 | * 2) Lines containing !I | |
461 | * 3) Lines containing !D | |
462 | * 4) Lines containing !F | |
e662af42 | 463 | * 5) Lines containing !P |
eda603f6 JB |
464 | * 6) Lines containing !C |
465 | * 7) Default lines - lines not matching the above | |
1da177e4 | 466 | */ |
4356f489 | 467 | static void parse_file(FILE *infile) |
1da177e4 LT |
468 | { |
469 | char line[MAXLINESZ]; | |
a48dc45e | 470 | char *p, *s; |
6dd16f44 | 471 | while (fgets(line, MAXLINESZ, infile)) { |
a48dc45e JN |
472 | p = is_directive(line); |
473 | if (!p) { | |
868fb192 JN |
474 | defaultline(line); |
475 | continue; | |
476 | } | |
477 | ||
a48dc45e | 478 | switch (*p++) { |
868fb192 | 479 | case 'E': |
1dcdad0a | 480 | chomp(p); |
a48dc45e | 481 | externalfunctions(p); |
868fb192 JN |
482 | break; |
483 | case 'I': | |
1dcdad0a | 484 | chomp(p); |
a48dc45e | 485 | internalfunctions(p); |
868fb192 JN |
486 | break; |
487 | case 'D': | |
1dcdad0a | 488 | chomp(p); |
a48dc45e | 489 | symbolsonly(p); |
868fb192 JN |
490 | break; |
491 | case 'F': | |
492 | /* filename */ | |
1dcdad0a | 493 | s = chomp(p); |
868fb192 JN |
494 | /* function names */ |
495 | while (isspace(*s)) | |
496 | s++; | |
a48dc45e | 497 | singlefunctions(p, s); |
868fb192 JN |
498 | break; |
499 | case 'P': | |
500 | /* filename */ | |
1dcdad0a | 501 | s = chomp(p); |
868fb192 JN |
502 | /* DOC: section name */ |
503 | while (isspace(*s)) | |
504 | s++; | |
a48dc45e | 505 | docsection(p, s); |
868fb192 JN |
506 | break; |
507 | case 'C': | |
1dcdad0a | 508 | chomp(p); |
868fb192 | 509 | if (findall) |
a48dc45e | 510 | findall(p); |
868fb192 JN |
511 | break; |
512 | default: | |
1da177e4 LT |
513 | defaultline(line); |
514 | } | |
515 | } | |
516 | fflush(stdout); | |
517 | } | |
518 | ||
519 | ||
520 | int main(int argc, char *argv[]) | |
521 | { | |
568fb2de | 522 | const char *subcommand, *filename; |
1da177e4 | 523 | FILE * infile; |
eda603f6 | 524 | int i; |
bb13be51 RL |
525 | |
526 | srctree = getenv("SRCTREE"); | |
527 | if (!srctree) | |
528 | srctree = getcwd(NULL, 0); | |
2d51005c | 529 | kernsrctree = getenv("KBUILD_SRC"); |
b767b905 | 530 | if (!kernsrctree || !*kernsrctree) |
2d51005c | 531 | kernsrctree = srctree; |
1da177e4 LT |
532 | if (argc != 3) { |
533 | usage(); | |
534 | exit(1); | |
535 | } | |
568fb2de JN |
536 | |
537 | subcommand = argv[1]; | |
538 | filename = argv[2]; | |
539 | ||
1da177e4 | 540 | /* Open file, exit on error */ |
568fb2de | 541 | infile = fopen(filename, "r"); |
bb66fc67 MY |
542 | if (infile == NULL) { |
543 | fprintf(stderr, "docproc: "); | |
568fb2de | 544 | perror(filename); |
bb66fc67 MY |
545 | exit(2); |
546 | } | |
1da177e4 | 547 | |
568fb2de | 548 | if (strcmp("doc", subcommand) == 0) { |
1da177e4 LT |
549 | /* Need to do this in two passes. |
550 | * First pass is used to collect all symbols exported | |
6dd16f44 | 551 | * in the various files; |
1da177e4 | 552 | * Second pass generate the documentation. |
6dd16f44 | 553 | * This is required because some functions are declared |
1da177e4 LT |
554 | * and exported in different files :-(( |
555 | */ | |
556 | /* Collect symbols */ | |
557 | defaultline = noaction; | |
558 | internalfunctions = find_export_symbols; | |
559 | externalfunctions = find_export_symbols; | |
560 | symbolsonly = find_export_symbols; | |
561 | singlefunctions = noaction2; | |
e662af42 | 562 | docsection = noaction2; |
eda603f6 | 563 | findall = find_all_symbols; |
1da177e4 LT |
564 | parse_file(infile); |
565 | ||
566 | /* Rewind to start from beginning of file again */ | |
567 | fseek(infile, 0, SEEK_SET); | |
568 | defaultline = printline; | |
569 | internalfunctions = intfunc; | |
570 | externalfunctions = extfunc; | |
571 | symbolsonly = printline; | |
572 | singlefunctions = singfunc; | |
e662af42 | 573 | docsection = docsect; |
eda603f6 | 574 | findall = NULL; |
1da177e4 LT |
575 | |
576 | parse_file(infile); | |
eda603f6 JB |
577 | |
578 | for (i = 0; i < all_list_len; i++) { | |
579 | if (!all_list[i]) | |
580 | continue; | |
581 | fprintf(stderr, "Warning: didn't use docs for %s\n", | |
582 | all_list[i]); | |
583 | } | |
568fb2de | 584 | } else if (strcmp("depend", subcommand) == 0) { |
1da177e4 LT |
585 | /* Create first part of dependency chain |
586 | * file.tmpl */ | |
568fb2de | 587 | printf("%s\t", filename); |
1da177e4 LT |
588 | defaultline = noaction; |
589 | internalfunctions = adddep; | |
590 | externalfunctions = adddep; | |
591 | symbolsonly = adddep; | |
592 | singlefunctions = adddep2; | |
e662af42 | 593 | docsection = adddep2; |
eda603f6 | 594 | findall = adddep; |
1da177e4 LT |
595 | parse_file(infile); |
596 | printf("\n"); | |
f0f3ca8d | 597 | } else { |
568fb2de | 598 | fprintf(stderr, "Unknown option: %s\n", subcommand); |
1da177e4 LT |
599 | exit(1); |
600 | } | |
601 | fclose(infile); | |
602 | fflush(stdout); | |
603 | return exitstatus; | |
604 | } |