source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Be a bit more lenient in what to accept for section names given
@ 2014-12-17 18:45 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-12-17 18:45 UTC (permalink / raw)
  To: source

Log Message:
-----------
Be a bit more lenient in what to accept for section names given
as the first man(1) command line argument without -s:
Accept digits like "1", "2"; digit+letter like "3p", "1X"; and "n".
Issue reported by Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).

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

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.206
retrieving revision 1.207
diff -Lmain.c -Lmain.c -u -p -r1.206 -r1.207
--- main.c
+++ main.c
@@ -114,6 +114,7 @@ main(int argc, char *argv[])
 	struct manpaths	 paths;
 	char		*auxpaths;
 	char		*defos;
+	unsigned char	*uc;
 #if HAVE_SQLITE3
 	struct manpage	*res, *resp;
 	char		*conf_file, *defpaths;
@@ -309,11 +310,11 @@ main(int argc, char *argv[])
 				argv = help_argv;
 				argc = 1;
 			}
-		} else if (argv[0] != NULL && (
-		    (isdigit((unsigned char)argv[0][0]) &&
-		     (argv[0][1] == '\0' || !strcmp(argv[0], "3p"))) ||
-		    (argv[0][0] == 'n' && argv[0][1] == '\0'))) {
-			search.sec = argv[0];
+		} else if (((uc = argv[0]) != NULL) &&
+		    ((isdigit(uc[0]) && (uc[1] == '\0' ||
+		      (isalpha(uc[1]) && uc[2] == '\0'))) ||
+		     (uc[0] == 'n' && uc[1] == '\0'))) {
+			search.sec = uc;
 			argv++;
 			argc--;
 		}
--
 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:[~2014-12-17 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-17 18:45 mdocml: Be a bit more lenient in what to accept for section names given 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).