=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/main.c,v retrieving revision 1.82 retrieving revision 1.83 diff -c -r1.82 -r1.83 *** src/usr.bin/mandoc/main.c 2011/12/25 17:34:57 1.82 --- src/usr.bin/mandoc/main.c 2012/05/24 23:33:23 1.83 *************** *** 1,7 **** ! /* $Id: main.c,v 1.82 2011/12/25 17:34:57 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons ! * Copyright (c) 2010, 2011 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,7 ---- ! /* $Id: main.c,v 1.83 2012/05/24 23:33:23 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons ! * Copyright (c) 2010, 2011, 2012 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 79,84 **** --- 79,85 ---- struct curparse curp; enum mparset type; enum mandoclevel rc; + char *defos; progname = strrchr(argv[0], '/'); if (progname == NULL) *************** *** 98,107 **** 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); --- 99,122 ---- 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); *************** *** 126,132 **** /* NOTREACHED */ } ! curp.mp = mparse_alloc(type, curp.wlevel, mmsg, &curp); /* * Conditionally start up the lookaside buffer before parsing. --- 141,147 ---- /* NOTREACHED */ } ! curp.mp = mparse_alloc(type, curp.wlevel, mmsg, &curp, defos); /* * Conditionally start up the lookaside buffer before parsing. *************** *** 153,158 **** --- 168,174 ---- (*curp.outfree)(curp.outdata); if (curp.mp) mparse_free(curp.mp); + free(defos); return((int)rc); }