Print this page
Update to 1.12.3.

*** 1,9 **** ! /* $Id: main.c,v 1.165 2011/10/06 22:29:12 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> ! * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * --- 1,9 ---- ! /* $Id: main.c,v 1.167 2012/11/19 17:22:26 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> ! * Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. *
*** 83,92 **** --- 83,93 ---- { int c; struct curparse curp; enum mparset type; enum mandoclevel rc; + char *defos; progname = strrchr(argv[0], '/'); if (progname == NULL) progname = argv[0]; else
*** 95,108 **** memset(&curp, 0, sizeof(struct curparse)); type = MPARSE_AUTO; curp.outtype = OUTT_ASCII; curp.wlevel = MANDOCLEVEL_FATAL; /* LINTED */ ! while (-1 != (c = getopt(argc, argv, "m:O:T:VW:"))) switch (c) { case ('m'): if ( ! moptions(&type, optarg)) return((int)MANDOCLEVEL_BADARG); break; case ('O'): --- 96,123 ---- memset(&curp, 0, sizeof(struct curparse)); type = MPARSE_AUTO; curp.outtype = OUTT_ASCII; curp.wlevel = MANDOCLEVEL_FATAL; + defos = NULL; /* LINTED */ ! while (-1 != (c = getopt(argc, argv, "I:m:O:T:VW:"))) switch (c) { + case ('I'): + if (strncmp(optarg, "os=", 3)) { + fprintf(stderr, "-I%s: Bad argument\n", + optarg); + return((int)MANDOCLEVEL_BADARG); + } + if (defos) { + fprintf(stderr, "-I%s: Duplicate argument\n", + optarg); + return((int)MANDOCLEVEL_BADARG); + } + defos = mandoc_strdup(optarg + 3); + break; case ('m'): if ( ! moptions(&type, optarg)) return((int)MANDOCLEVEL_BADARG); break; case ('O'):
*** 123,133 **** default: usage(); /* NOTREACHED */ } ! curp.mp = mparse_alloc(type, curp.wlevel, mmsg, &curp); /* * Conditionally start up the lookaside buffer before parsing. */ if (OUTT_MAN == curp.outtype) --- 138,148 ---- default: usage(); /* NOTREACHED */ } ! curp.mp = mparse_alloc(type, curp.wlevel, mmsg, &curp, defos); /* * Conditionally start up the lookaside buffer before parsing. */ if (OUTT_MAN == curp.outtype)
*** 150,159 **** --- 165,175 ---- if (curp.outfree) (*curp.outfree)(curp.outdata); if (curp.mp) mparse_free(curp.mp); + free(defos); return((int)rc); } static void
*** 168,183 **** usage(void) { fprintf(stderr, "usage: %s " "[-V] " ! "[-foption] " "[-mformat] " "[-Ooption] " "[-Toutput] " ! "[-Wlevel] " ! "[file...]\n", progname); exit((int)MANDOCLEVEL_BADARG); } --- 184,199 ---- usage(void) { fprintf(stderr, "usage: %s " "[-V] " ! "[-Ios=name] " "[-mformat] " "[-Ooption] " "[-Toutput] " ! "[-Wlevel]\n" ! "\t [file ...]\n", progname); exit((int)MANDOCLEVEL_BADARG); }