View | Details | Raw Unified | Return to bug 264560
Collapse All | Expand All

(-)b/contrib/mandoc/main.c (+16 lines)
Lines 137-142 main(int argc, char *argv[]) Link Here
137
	char		*auxpaths;	/* -m: additional manpaths. */
137
	char		*auxpaths;	/* -m: additional manpaths. */
138
	char		*oarg;		/* -O: output option string. */
138
	char		*oarg;		/* -O: output option string. */
139
	char		*tagarg;	/* -O tag: default value. */
139
	char		*tagarg;	/* -O tag: default value. */
140
	char		*volume = NULL;	/* -V volume title. */
140
	unsigned char	*uc;
141
	unsigned char	*uc;
141
	size_t		 ressz;		/* Number of elements in res[]. */
142
	size_t		 ressz;		/* Number of elements in res[]. */
142
	size_t		 resnsz;	/* Number of elements in resn[]. */
143
	size_t		 resnsz;	/* Number of elements in resn[]. */
Lines 215-221 main(int argc, char *argv[]) Link Here
215
	outmode = OUTMODE_DEF;
216
	outmode = OUTMODE_DEF;
216
217
217
	while ((c = getopt(argc, argv,
218
	while ((c = getopt(argc, argv,
219
#ifdef __FreeBSD__
220
	    "aC:cfhI:iK:klM:m:O:S:s:T:V:W:w")) != -1) {
221
#else
218
	    "aC:cfhI:iK:klM:m:O:S:s:T:VW:w")) != -1) {
222
	    "aC:cfhI:iK:klM:m:O:S:s:T:VW:w")) != -1) {
223
#endif
219
		if (c == 'i' && search.argmode == ARG_EXPR) {
224
		if (c == 'i' && search.argmode == ARG_EXPR) {
220
			optind--;
225
			optind--;
221
			break;
226
			break;
Lines 320-325 main(int argc, char *argv[]) Link Here
320
				return mandoc_msg_getrc();
325
				return mandoc_msg_getrc();
321
			}
326
			}
322
			break;
327
			break;
328
#ifdef __FreeBSD__
329
		case 'V':
330
			volume = strdup(optarg);
331
			if (volume == NULL)
332
				err(1, "strdup");
333
			break;
334
#endif
323
		case 'W':
335
		case 'W':
324
			if (woptions(optarg, &os_e, &outst.wstop) == -1)
336
			if (woptions(optarg, &os_e, &outst.wstop) == -1)
325
				return mandoc_msg_getrc();
337
				return mandoc_msg_getrc();
Lines 635-641 main(int argc, char *argv[]) Link Here
635
	}
647
	}
636
648
637
	mchars_alloc();
649
	mchars_alloc();
650
#ifdef __FreeBSD__
651
	mp = mparse_alloc(options, os_e, os_s, volume);
652
#else
638
	mp = mparse_alloc(options, os_e, os_s);
653
	mp = mparse_alloc(options, os_e, os_s);
654
#endif
639
655
640
	/*
656
	/*
641
	 * Remember the original working directory, if possible.
657
	 * Remember the original working directory, if possible.
(-)b/contrib/mandoc/mandoc_parse.h (+4 lines)
Lines 35-41 Link Here
35
struct	roff_meta;
35
struct	roff_meta;
36
struct	mparse;
36
struct	mparse;
37
37
38
#ifdef __FreeBSD__
39
struct mparse	 *mparse_alloc(int, enum mandoc_os, const char *, const char *);
40
#else
38
struct mparse	 *mparse_alloc(int, enum mandoc_os, const char *);
41
struct mparse	 *mparse_alloc(int, enum mandoc_os, const char *);
42
#endif
39
void		  mparse_copy(const struct mparse *);
43
void		  mparse_copy(const struct mparse *);
40
void		  mparse_free(struct mparse *);
44
void		  mparse_free(struct mparse *);
41
int		  mparse_open(struct mparse *, const char *);
45
int		  mparse_open(struct mparse *, const char *);
(-)b/contrib/mandoc/mandocdb.c (+4 lines)
Lines 429-435 mandocdb(int argc, char *argv[]) Link Here
429
429
430
	exitcode = (int)MANDOCLEVEL_OK;
430
	exitcode = (int)MANDOCLEVEL_OK;
431
	mchars_alloc();
431
	mchars_alloc();
432
#ifdef __FreeBSD__
433
	mp = mparse_alloc(mparse_options, MANDOC_OS_OTHER, NULL, NULL);
434
#else
432
	mp = mparse_alloc(mparse_options, MANDOC_OS_OTHER, NULL);
435
	mp = mparse_alloc(mparse_options, MANDOC_OS_OTHER, NULL);
436
#endif
433
	mandoc_ohash_init(&mpages, 6, offsetof(struct mpage, inodev));
437
	mandoc_ohash_init(&mpages, 6, offsetof(struct mpage, inodev));
434
	mandoc_ohash_init(&mlinks, 6, offsetof(struct mlink, file));
438
	mandoc_ohash_init(&mlinks, 6, offsetof(struct mlink, file));
435
439
(-)b/contrib/mandoc/mdoc_validate.c (-15 / +19 lines)
Lines 2784-2797 post_dt(POST_ARGS) Link Here
2784
2784
2785
	free(mdoc->meta.title);
2785
	free(mdoc->meta.title);
2786
	free(mdoc->meta.msec);
2786
	free(mdoc->meta.msec);
2787
	free(mdoc->meta.vol);
2788
	free(mdoc->meta.arch);
2787
	free(mdoc->meta.arch);
2789
2788
2790
	mdoc->meta.title = NULL;
2789
	mdoc->meta.title = NULL;
2791
	mdoc->meta.msec = NULL;
2790
	mdoc->meta.msec = NULL;
2792
	mdoc->meta.vol = NULL;
2793
	mdoc->meta.arch = NULL;
2791
	mdoc->meta.arch = NULL;
2794
2792
2793
#ifndef __FreeBSD__
2794
	free(mdoc->meta.vol);
2795
	mdoc->meta.vol = NULL;
2796
#endif
2797
2795
	/* Mandatory first argument: title. */
2798
	/* Mandatory first argument: title. */
2796
2799
2797
	nn = n->child;
2800
	nn = n->child;
Lines 2827-2845 post_dt(POST_ARGS) Link Here
2827
	mdoc->meta.msec = mandoc_strdup(nn->string);
2830
	mdoc->meta.msec = mandoc_strdup(nn->string);
2828
2831
2829
	/* Infer volume title from section number. */
2832
	/* Infer volume title from section number. */
2830
2833
	if (!mdoc->meta.vol) {
2831
	cp = mandoc_a2msec(nn->string);
2834
		cp = mandoc_a2msec(nn->string);
2832
	if (cp == NULL) {
2835
		if (cp == NULL) {
2833
		mandoc_msg(MANDOCERR_MSEC_BAD,
2836
			mandoc_msg(MANDOCERR_MSEC_BAD,
2834
		    nn->line, nn->pos, "Dt ... %s", nn->string);
2837
				    nn->line, nn->pos, "Dt ... %s", nn->string);
2835
		mdoc->meta.vol = mandoc_strdup(nn->string);
2838
			mdoc->meta.vol = mandoc_strdup(nn->string);
2836
	} else {
2839
		} else {
2837
		mdoc->meta.vol = mandoc_strdup(cp);
2840
			mdoc->meta.vol = mandoc_strdup(cp);
2838
		if (mdoc->filesec != '\0' &&
2841
			if (mdoc->filesec != '\0' &&
2839
		    mdoc->filesec != *nn->string &&
2842
			    mdoc->filesec != *nn->string &&
2840
		    *nn->string >= '1' && *nn->string <= '9')
2843
			    *nn->string >= '1' && *nn->string <= '9')
2841
			mandoc_msg(MANDOCERR_MSEC_FILE, nn->line, nn->pos,
2844
				mandoc_msg(MANDOCERR_MSEC_FILE, nn->line, nn->pos,
2842
			    "*.%c vs Dt ... %c", mdoc->filesec, *nn->string);
2845
				    "*.%c vs Dt ... %c", mdoc->filesec, *nn->string);
2846
		}
2843
	}
2847
	}
2844
2848
2845
	/* Optional third argument: architecture. */
2849
	/* Optional third argument: architecture. */
(-)b/contrib/mandoc/read.c (+9 lines)
Lines 657-663 mparse_open(struct mparse *curp, const char *file) Link Here
657
}
657
}
658
658
659
struct mparse *
659
struct mparse *
660
#ifdef __FreeBSD__
661
mparse_alloc(int options, enum mandoc_os os_e, const char *os_s,
662
    const char *vol)
663
#else
660
mparse_alloc(int options, enum mandoc_os os_e, const char *os_s)
664
mparse_alloc(int options, enum mandoc_os os_e, const char *os_s)
665
#endif
661
{
666
{
662
	struct mparse	*curp;
667
	struct mparse	*curp;
663
668
Lines 680-685 mparse_alloc(int options, enum mandoc_os os_e, const char *os_s) Link Here
680
	}
685
	}
681
	curp->man->meta.first->tok = TOKEN_NONE;
686
	curp->man->meta.first->tok = TOKEN_NONE;
682
	curp->man->meta.os_e = os_e;
687
	curp->man->meta.os_e = os_e;
688
#ifdef __FreeBSD__
689
	if (vol)
690
		curp->man->meta.vol = strdup(vol);
691
#endif
683
	tag_alloc();
692
	tag_alloc();
684
	return curp;
693
	return curp;
685
}
694
}

Return to bug 264560