main.c (a66b65d0) | main.c (aa2d850a) |
---|---|
1/* $Id: main.c,v 1.19 2009/12/22 23:58:00 schwarze Exp $ */ | 1/* $Id: main.c,v 1.20 2009/12/23 22:30:17 schwarze Exp $ */ |
2/* 3 * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 76 unchanged lines hidden (view full) --- 86static int ffile(struct buf *, struct buf *, 87 const char *, struct curparse *); 88static int fdesc(struct buf *, struct buf *, 89 struct curparse *); 90static int pset(const char *, int, struct curparse *, 91 struct man **, struct mdoc **); 92static struct man *man_init(struct curparse *); 93static struct mdoc *mdoc_init(struct curparse *); | 2/* 3 * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 76 unchanged lines hidden (view full) --- 86static int ffile(struct buf *, struct buf *, 87 const char *, struct curparse *); 88static int fdesc(struct buf *, struct buf *, 89 struct curparse *); 90static int pset(const char *, int, struct curparse *, 91 struct man **, struct mdoc **); 92static struct man *man_init(struct curparse *); 93static struct mdoc *mdoc_init(struct curparse *); |
94__dead static void version(void); 95__dead static void usage(void); | 94static void version(void) __attribute__((noreturn)); 95static void usage(void) __attribute__((noreturn)); |
96 97static const char *progname; 98 99 100int 101main(int argc, char *argv[]) 102{ 103 int c, rc; --- 89 unchanged lines hidden (view full) --- 193 mdoc_free(curp.mdoc); 194 if (curp.man) 195 man_free(curp.man); 196 197 return(rc ? EXIT_SUCCESS : EXIT_FAILURE); 198} 199 200 | 96 97static const char *progname; 98 99 100int 101main(int argc, char *argv[]) 102{ 103 int c, rc; --- 89 unchanged lines hidden (view full) --- 193 mdoc_free(curp.mdoc); 194 if (curp.man) 195 man_free(curp.man); 196 197 return(rc ? EXIT_SUCCESS : EXIT_FAILURE); 198} 199 200 |
201__dead static void | 201static void |
202version(void) 203{ 204 205 (void)printf("%s %s\n", progname, VERSION); 206 exit(EXIT_SUCCESS); 207} 208 209 | 202version(void) 203{ 204 205 (void)printf("%s %s\n", progname, VERSION); 206 exit(EXIT_SUCCESS); 207} 208 209 |
210__dead static void | 210static void |
211usage(void) 212{ 213 214 (void)fprintf(stderr, "usage: %s [-V] [-foption...] " 215 "[-mformat] [-Ooption] [-Toutput] " 216 "[-Werr...]\n", progname); 217 exit(EXIT_FAILURE); 218} --- 294 unchanged lines hidden (view full) --- 513 514 if (0 == strcmp(arg, "doc")) 515 *tflags = INTT_MDOC; 516 else if (0 == strcmp(arg, "andoc")) 517 *tflags = INTT_AUTO; 518 else if (0 == strcmp(arg, "an")) 519 *tflags = INTT_MAN; 520 else { | 211usage(void) 212{ 213 214 (void)fprintf(stderr, "usage: %s [-V] [-foption...] " 215 "[-mformat] [-Ooption] [-Toutput] " 216 "[-Werr...]\n", progname); 217 exit(EXIT_FAILURE); 218} --- 294 unchanged lines hidden (view full) --- 513 514 if (0 == strcmp(arg, "doc")) 515 *tflags = INTT_MDOC; 516 else if (0 == strcmp(arg, "andoc")) 517 *tflags = INTT_AUTO; 518 else if (0 == strcmp(arg, "an")) 519 *tflags = INTT_MAN; 520 else { |
521 fprintf(stderr, "%s: Bad argument", arg); | 521 fprintf(stderr, "%s: Bad argument\n", arg); |
522 return(0); 523 } 524 525 return(1); 526} 527 528 529static int --- 4 unchanged lines hidden (view full) --- 534 *tflags = OUTT_ASCII; 535 else if (0 == strcmp(arg, "lint")) 536 *tflags = OUTT_LINT; 537 else if (0 == strcmp(arg, "tree")) 538 *tflags = OUTT_TREE; 539 else if (0 == strcmp(arg, "html")) 540 *tflags = OUTT_HTML; 541 else { | 522 return(0); 523 } 524 525 return(1); 526} 527 528 529static int --- 4 unchanged lines hidden (view full) --- 534 *tflags = OUTT_ASCII; 535 else if (0 == strcmp(arg, "lint")) 536 *tflags = OUTT_LINT; 537 else if (0 == strcmp(arg, "tree")) 538 *tflags = OUTT_TREE; 539 else if (0 == strcmp(arg, "html")) 540 *tflags = OUTT_HTML; 541 else { |
542 fprintf(stderr, "%s: Bad argument", arg); | 542 fprintf(stderr, "%s: Bad argument\n", arg); |
543 return(0); 544 } 545 546 return(1); 547} 548 549 550static int --- 32 unchanged lines hidden (view full) --- 583 case (5): 584 *fflags |= NO_IGN_ESCAPE | 585 NO_IGN_MACRO | NO_IGN_CHARS; 586 break; 587 case (6): 588 *fflags &= ~NO_IGN_ESCAPE; 589 break; 590 default: | 543 return(0); 544 } 545 546 return(1); 547} 548 549 550static int --- 32 unchanged lines hidden (view full) --- 583 case (5): 584 *fflags |= NO_IGN_ESCAPE | 585 NO_IGN_MACRO | NO_IGN_CHARS; 586 break; 587 case (6): 588 *fflags &= ~NO_IGN_ESCAPE; 589 break; 590 default: |
591 fprintf(stderr, "%s: Bad argument", o); | 591 fprintf(stderr, "%s: Bad argument\n", o); |
592 return(0); 593 } 594 } 595 596 return(1); 597} 598 599 --- 12 unchanged lines hidden (view full) --- 612 switch (getsubopt(&arg, UNCONST(toks), &v)) { 613 case (0): 614 *wflags |= WARN_WALL; 615 break; 616 case (1): 617 *wflags |= WARN_WERR; 618 break; 619 default: | 592 return(0); 593 } 594 } 595 596 return(1); 597} 598 599 --- 12 unchanged lines hidden (view full) --- 612 switch (getsubopt(&arg, UNCONST(toks), &v)) { 613 case (0): 614 *wflags |= WARN_WALL; 615 break; 616 case (1): 617 *wflags |= WARN_WERR; 618 break; 619 default: |
620 fprintf(stderr, "%s: Bad argument", o); | 620 fprintf(stderr, "%s: Bad argument\n", o); |
621 return(0); 622 } 623 } 624 625 return(1); 626} 627 628 --- 34 unchanged lines hidden --- | 621 return(0); 622 } 623 } 624 625 return(1); 626} 627 628 --- 34 unchanged lines hidden --- |