source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: merge revision 1.282: fix apropos -O
@ 2017-02-16 16:19 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-02-16 16:19 UTC (permalink / raw)
  To: source

Log Message:
-----------
merge revision 1.282: fix apropos -O

Tags:
----
VERSION_1_13

Modified Files:
--------------
    mdocml:
        main.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.273.2.6
retrieving revision 1.273.2.7
diff -Lmain.c -Lmain.c -u -p -r1.273.2.6 -r1.273.2.7
--- main.c
+++ main.c
@@ -115,17 +115,14 @@ int
 main(int argc, char *argv[])
 {
 	struct manconf	 conf;
-	struct curparse	 curp;
 	struct mansearch search;
+	struct curparse	 curp;
 	struct tag_files *tag_files;
-	const char	*progname;
-	char		*auxpaths;
-	char		*defos;
-	unsigned char	*uc;
 	struct manpage	*res, *resp;
-	char		*conf_file, *defpaths;
-	const char	*sec;
-	const char	*thisarg;
+	const char	*progname, *sec, *thisarg;
+	char		*conf_file, *defpaths, *auxpaths;
+	char		*defos, *oarg;
+	unsigned char	*uc;
 	size_t		 i, sz;
 	int		 prio, best_prio;
 	enum outmode	 outmode;
@@ -173,6 +170,7 @@ main(int argc, char *argv[])
 
 	memset(&search, 0, sizeof(struct mansearch));
 	search.outkey = "Nd";
+	oarg = NULL;
 
 	if (strcmp(progname, BINM_MAN) == 0)
 		search.argmode = ARG_NAME;
@@ -251,15 +249,7 @@ main(int argc, char *argv[])
 			auxpaths = optarg;
 			break;
 		case 'O':
-			search.outkey = optarg;
-			while (optarg != NULL) {
-				thisarg = optarg;
-				if (manconf_output(&conf.output,
-				    strsep(&optarg, ","), 0) == 0)
-					continue;
-				warnx("-O %s: Bad argument", thisarg);
-				return (int)MANDOCLEVEL_BADARG;
-			}
+			oarg = optarg;
 			break;
 		case 'S':
 			search.arch = optarg;
@@ -301,6 +291,21 @@ main(int argc, char *argv[])
 		default:
 			outmode = OUTMODE_LST;
 			break;
+		}
+	}
+
+	if (oarg != NULL) {
+		if (outmode == OUTMODE_LST)
+			search.outkey = oarg;
+		else {
+			while (oarg != NULL) {
+				thisarg = oarg;
+				if (manconf_output(&conf.output,
+				    strsep(&oarg, ","), 0) == 0)
+					continue;
+				warnx("-O %s: Bad argument", thisarg);
+				return (int)MANDOCLEVEL_BADARG;
+			}
 		}
 	}
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-16 16:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 16:19 mdocml: merge revision 1.282: fix apropos -O schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).