comparison lib-src/etags.c @ 66985:bf8620d8ff03

Cxref mode writes to stdout: do not close tagf, which has never been opened. Specify in the --help that vgrind writes to stdout.
author Francesco Potortì <pot@gnu.org>
date Fri, 18 Nov 2005 13:56:44 +0000
parents 90109c37ac78
children 3661e9b3c48f 7beb78bc1f8e
comparison
equal deleted inserted replaced
66984:9d0a2cc054be 66985:bf8620d8ff03
39 * If you want to add support for a new language, start by looking at the LUA 39 * If you want to add support for a new language, start by looking at the LUA
40 * language, which is the simplest. Alternatively, consider shipping a 40 * language, which is the simplest. Alternatively, consider shipping a
41 * configuration file containing regexp definitions for etags. 41 * configuration file containing regexp definitions for etags.
42 */ 42 */
43 43
44 char pot_etags_version[] = "@(#) pot revision number is 17.14"; 44 char pot_etags_version[] = "@(#) pot revision number is 17.15";
45 45
46 #define TRUE 1 46 #define TRUE 1
47 #define FALSE 0 47 #define FALSE 0
48 48
49 #ifdef DEBUG 49 #ifdef DEBUG
477 static bool ignoreindent; /* -I: ignore indentation in C */ 477 static bool ignoreindent; /* -I: ignore indentation in C */
478 static bool packages_only; /* --packages-only: in Ada, only tag packages*/ 478 static bool packages_only; /* --packages-only: in Ada, only tag packages*/
479 479
480 /* STDIN is defined in LynxOS system headers */ 480 /* STDIN is defined in LynxOS system headers */
481 #ifdef STDIN 481 #ifdef STDIN
482 #undef STDIN 482 # undef STDIN
483 #endif 483 #endif
484 484
485 #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ 485 #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */
486 static bool parsing_stdin; /* --parse-stdin used */ 486 static bool parsing_stdin; /* --parse-stdin used */
487 487
992 tag file than to use this."); 992 tag file than to use this.");
993 993
994 if (CTAGS) 994 if (CTAGS)
995 { 995 {
996 puts ("-v, --vgrind\n\ 996 puts ("-v, --vgrind\n\
997 Generates an index of items intended for human consumption,\n\ 997 Print on the standard output an index of items intended for\n\
998 similar to the output of vgrind. The index is sorted, and\n\ 998 human consumption, similar to the output of vgrind. The index\n\
999 gives the page number of each item."); 999 is sorted, and gives the page number of each item.");
1000 puts ("-w, --no-warn\n\ 1000 puts ("-w, --no-warn\n\
1001 Suppress warning messages about entries defined in multiple\n\ 1001 Suppress warning messages about entries defined in multiple\n\
1002 files."); 1002 files.");
1003 puts ("-x, --cxref\n\ 1003 puts ("-x, --cxref\n\
1004 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ 1004 Like --vgrind, but in the style of cxref, rather than vgrind.\n\
1426 free (filebuf.buffer); 1426 free (filebuf.buffer);
1427 free (token_name.buffer); 1427 free (token_name.buffer);
1428 1428
1429 if (!CTAGS || cxref_style) 1429 if (!CTAGS || cxref_style)
1430 { 1430 {
1431 put_entries (nodehead); /* write the remaining tags (ETAGS) */ 1431 /* Write the remaining tags to tagf (ETAGS) or stdout (CXREF). */
1432 put_entries (nodehead);
1432 free_tree (nodehead); 1433 free_tree (nodehead);
1433 nodehead = NULL; 1434 nodehead = NULL;
1434 if (!CTAGS) 1435 if (!CTAGS)
1435 { 1436 {
1436 fdesc *fdp; 1437 fdesc *fdp;
1440 if (!fdp->written) 1441 if (!fdp->written)
1441 fprintf (tagf, "\f\n%s,0\n", fdp->taggedfname); 1442 fprintf (tagf, "\f\n%s,0\n", fdp->taggedfname);
1442 1443
1443 while (nincluded_files-- > 0) 1444 while (nincluded_files-- > 0)
1444 fprintf (tagf, "\f\n%s,include\n", *included_files++); 1445 fprintf (tagf, "\f\n%s,include\n", *included_files++);
1446
1447 if (fclose (tagf) == EOF)
1448 pfatal (tagfile);
1445 } 1449 }
1446 1450
1447 if (fclose (tagf) == EOF)
1448 pfatal (tagfile);
1449 exit (EXIT_SUCCESS); 1451 exit (EXIT_SUCCESS);
1450 } 1452 }
1451 1453
1452 if (update) 1454 if (update)
1453 { 1455 {