comparison lib-src/etags.c @ 55408:1c425ce93ce9

(GOOD, BAD): Delete macros. Throughout, replace w/ `EXIT_SUCCESS' and `EXIT_FAILURE', respectively. (main): Use `EXIT_SUCCESS' or `EXIT_FAILURE' for return value.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Fri, 07 May 2004 15:29:22 +0000
parents c6c2d0694257
children c2ab1ac6a36b 4c90ffeb71c5
comparison
equal deleted inserted replaced
55407:21d7b97dbe73 55408:1c425ce93ce9
173 #ifdef CTAGS 173 #ifdef CTAGS
174 # undef CTAGS 174 # undef CTAGS
175 # define CTAGS TRUE 175 # define CTAGS TRUE
176 #else 176 #else
177 # define CTAGS FALSE 177 # define CTAGS FALSE
178 #endif
179
180 /* Exit codes for success and failure. */
181 #ifdef VMS
182 # define GOOD 1
183 # define BAD 0
184 #else
185 # define GOOD 0
186 # define BAD 1
187 #endif 178 #endif
188 179
189 #define streq(s,t) (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t)) 180 #define streq(s,t) (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t))
190 #define strcaseeq(s,t) (assert((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t)) 181 #define strcaseeq(s,t) (assert((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t))
191 #define strneq(s,t,n) (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n)) 182 #define strneq(s,t,n) (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
828 { 819 {
829 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); 820 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
830 puts ("Copyright (C) 2002 Free Software Foundation, Inc. and Ken Arnold"); 821 puts ("Copyright (C) 2002 Free Software Foundation, Inc. and Ken Arnold");
831 puts ("This program is distributed under the same terms as Emacs"); 822 puts ("This program is distributed under the same terms as Emacs");
832 823
833 exit (GOOD); 824 exit (EXIT_SUCCESS);
834 } 825 }
835 826
836 static void 827 static void
837 print_help (argbuffer) 828 print_help (argbuffer)
838 argument *argbuffer; 829 argument *argbuffer;
847 puts (argbuffer->lang->help); 838 puts (argbuffer->lang->help);
848 help_for_lang = TRUE; 839 help_for_lang = TRUE;
849 } 840 }
850 841
851 if (help_for_lang) 842 if (help_for_lang)
852 exit (GOOD); 843 exit (EXIT_SUCCESS);
853 844
854 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ 845 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\
855 \n\ 846 \n\
856 These are the options accepted by %s.\n", progname, progname); 847 These are the options accepted by %s.\n", progname, progname);
857 #ifdef LONG_OPTIONS 848 #ifdef LONG_OPTIONS
988 print_language_names (); 979 print_language_names ();
989 980
990 puts (""); 981 puts ("");
991 puts ("Report bugs to bug-gnu-emacs@gnu.org"); 982 puts ("Report bugs to bug-gnu-emacs@gnu.org");
992 983
993 exit (GOOD); 984 exit (EXIT_SUCCESS);
994 } 985 }
995 986
996 987
997 #ifdef VMS /* VMS specific functions */ 988 #ifdef VMS /* VMS specific functions */
998 989
1411 fprintf (tagf, "\f\n%s,include\n", *included_files++); 1402 fprintf (tagf, "\f\n%s,include\n", *included_files++);
1412 } 1403 }
1413 1404
1414 if (fclose (tagf) == EOF) 1405 if (fclose (tagf) == EOF)
1415 pfatal (tagfile); 1406 pfatal (tagfile);
1416 exit (GOOD); 1407 exit (EXIT_SUCCESS);
1417 } 1408 }
1418 1409
1419 if (update) 1410 if (update)
1420 { 1411 {
1421 char cmd[BUFSIZ]; 1412 char cmd[BUFSIZ];
1430 continue; /* the for loop */ 1421 continue; /* the for loop */
1431 } 1422 }
1432 sprintf (cmd, 1423 sprintf (cmd,
1433 "mv %s OTAGS;fgrep -v '\t%s\t' OTAGS >%s;rm OTAGS", 1424 "mv %s OTAGS;fgrep -v '\t%s\t' OTAGS >%s;rm OTAGS",
1434 tagfile, argbuffer[i].what, tagfile); 1425 tagfile, argbuffer[i].what, tagfile);
1435 if (system (cmd) != GOOD) 1426 if (system (cmd) != EXIT_SUCCESS)
1436 fatal ("failed to execute shell command", (char *)NULL); 1427 fatal ("failed to execute shell command", (char *)NULL);
1437 } 1428 }
1438 append_to_tagfile = TRUE; 1429 append_to_tagfile = TRUE;
1439 } 1430 }
1440 1431
1451 { 1442 {
1452 char cmd[2*BUFSIZ+10]; 1443 char cmd[2*BUFSIZ+10];
1453 sprintf (cmd, "sort -o %.*s %.*s", BUFSIZ, tagfile, BUFSIZ, tagfile); 1444 sprintf (cmd, "sort -o %.*s %.*s", BUFSIZ, tagfile, BUFSIZ, tagfile);
1454 exit (system (cmd)); 1445 exit (system (cmd));
1455 } 1446 }
1456 return GOOD; 1447 return EXIT_SUCCESS;
1457 } 1448 }
1458 1449
1459 1450
1460 /* 1451 /*
1461 * Return a compressor given the file name. If EXTPTR is non-zero, 1452 * Return a compressor given the file name. If EXTPTR is non-zero,
6468 void 6459 void
6469 fatal (s1, s2) 6460 fatal (s1, s2)
6470 char *s1, *s2; 6461 char *s1, *s2;
6471 { 6462 {
6472 error (s1, s2); 6463 error (s1, s2);
6473 exit (BAD); 6464 exit (EXIT_FAILURE);
6474 } 6465 }
6475 6466
6476 static void 6467 static void
6477 pfatal (s1) 6468 pfatal (s1)
6478 char *s1; 6469 char *s1;
6479 { 6470 {
6480 perror (s1); 6471 perror (s1);
6481 exit (BAD); 6472 exit (EXIT_FAILURE);
6482 } 6473 }
6483 6474
6484 static void 6475 static void
6485 suggest_asking_for_help () 6476 suggest_asking_for_help ()
6486 { 6477 {
6490 progname, "--help"); 6481 progname, "--help");
6491 #else 6482 #else
6492 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", 6483 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
6493 progname, "-h"); 6484 progname, "-h");
6494 #endif 6485 #endif
6495 exit (BAD); 6486 exit (EXIT_FAILURE);
6496 } 6487 }
6497 6488
6498 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ 6489 /* Print error message. `s1' is printf control string, `s2' is arg for it. */
6499 static void 6490 static void
6500 error (s1, s2) 6491 error (s1, s2)
6786 * End: 6777 * End:
6787 */ 6778 */
6788 6779
6789 /* arch-tag: 8a9b748d-390c-4922-99db-2eeefa921051 6780 /* arch-tag: 8a9b748d-390c-4922-99db-2eeefa921051
6790 (do not change this comment) */ 6781 (do not change this comment) */
6782
6783 /* etags.c ends here */