Re: man -m not working with latest snapshot (Dec 20)

2014-12-21 Thread Ingo Schwarze
Hi Alessandro and Bryan,

Bryan Steele wrote on Sat, Dec 20, 2014 at 11:56:46AM -0500:
 On Sat, Dec 20, 2014 at 04:10:05PM +0100, Alessandro DE LAURENZIS wrote:

 just22@poseidon:[~] uname -a
 OpenBSD poseidon.atlantide.net 5.6 GENERIC.MP#714 amd64
 
 just22@poseidon:[~] type man
 man is hashed (/usr/bin/man)
 
 just22@poseidon:[~] man -m /home/just22/share/man/ man
 man: -m/home/just22/share/man/: Bad argument

Oops.  While almost all options are now identical for mandoc(1)
and man(1), -m is one of the rare remaining exceptions.  For
historical reasons, we can't easily change that.

  man -m  means prepend to manpath

  mandoc -m   means use macro set

The option parsing was borked in this respect.  When called as
man(1), the code used the -m argument *both* for the manpath *and*
tried to also interpret it as a macro set, and the latter of course
failed.

I just committed a fix, so it should work again in the next snapshot;
or if you are in a hurry, you can go to /usr/src/usr.bin/mandoc,
cvs up, recompile and reinstall in just that one directory.
You need main.c rev. 1.115.

 It seems a space is missing... Is it just me?

Well, that wasn't the main problem, but admittedly, appending
option arguments to options without an intervening space is
rather archaic syntax and not recommended by POSIX.
So i inserted some spaces into some error messages.

Thanks for reporting!

 schwarze@ switched the tree over to using the mandoc(1) implementation
 of man(1). That probably just made it into snaps.
 
 http://marc.info/?l=openbsd-cvsm=141857975006131w=2

Yes, that was definitely the cause of the issue.

Yours,
  Ingo


Log Message:
---
Use -m for macro set selection in mandoc(1) mode only, not in man(1)
and apropos(1) mode.  While here, put a space character between 
options and option arguments in error messages.
Both reported by Alessandro DE LAURENZIS just22 dot adl at gmail dot com.

Modified Files:
--
mdocml:
main.c

Revision Data
-
Index: main.c
===
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -Lmain.c -Lmain.c -u -p -r1.208 -r1.209
--- main.c
+++ main.c
@@ -206,13 +206,13 @@ main(int argc, char *argv[])
case 'I':
if (strncmp(optarg, os=, 3)) {
fprintf(stderr,
-   %s: -I%s: Bad argument\n,
+   %s: -I %s: Bad argument\n,
progname, optarg);
return((int)MANDOCLEVEL_BADARG);
}
if (defos) {
fprintf(stderr,
-   %s: -I%s: Duplicate argument\n,
+   %s: -I %s: Duplicate argument\n,
progname, optarg);
return((int)MANDOCLEVEL_BADARG);
}
@@ -401,7 +401,7 @@ main(int argc, char *argv[])
 
/* mandoc(1) */
 
-   if ( ! moptions(options, auxpaths))
+   if (search.argmode == ARG_FILE  ! moptions(options, auxpaths))
return((int)MANDOCLEVEL_BADARG);
 
if (use_pager  isatty(STDOUT_FILENO))
@@ -700,7 +700,7 @@ koptions(int *options, char *arg)
} else if ( ! strcmp(arg, us-ascii)) {
*options = ~(MPARSE_UTF8 | MPARSE_LATIN1);
} else {
-   fprintf(stderr, %s: -K%s: Bad argument\n,
+   fprintf(stderr, %s: -K %s: Bad argument\n,
progname, arg);
return(0);
}
@@ -720,7 +720,7 @@ moptions(int *options, char *arg)
else if (0 == strcmp(arg, an))
*options |= MPARSE_MAN;
else {
-   fprintf(stderr, %s: -m%s: Bad argument\n,
+   fprintf(stderr, %s: -m %s: Bad argument\n,
progname, arg);
return(0);
}
@@ -754,7 +754,7 @@ toptions(struct curparse *curp, char *ar
else if (0 == strcmp(arg, pdf))
curp-outtype = OUTT_PDF;
else {
-   fprintf(stderr, %s: -T%s: Bad argument\n,
+   fprintf(stderr, %s: -T %s: Bad argument\n,
progname, arg);
return(0);
}
@@ -793,7 +793,7 @@ woptions(struct curparse *curp, char *ar
curp-wlevel = MANDOCLEVEL_FATAL;
break;
default:
-   fprintf(stderr, %s: -W%s: Bad argument\n,
+   fprintf(stderr, %s: -W %s: Bad argument\n,
progname, o);
return(0);
}



man -m not working with latest snapshot (Dec 20)

2014-12-20 Thread Alessandro DE LAURENZIS
Greetings,

just22@poseidon:[~] uname -a
OpenBSD poseidon.atlantide.net 5.6 GENERIC.MP#714 amd64

just22@poseidon:[~] type man
man is hashed (/usr/bin/man)

just22@poseidon:[~] man -m /home/just22/share/man/ man
man: -m/home/just22/share/man/: Bad argument

It seems a space is missing... Is it just me?

-- 
Alessandro DE LAURENZIS
[mailto:just22@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis



Re: man -m not working with latest snapshot (Dec 20)

2014-12-20 Thread Bryan Steele
On Sat, Dec 20, 2014 at 04:10:05PM +0100, Alessandro DE LAURENZIS wrote:
 Greetings,
 
 just22@poseidon:[~] uname -a
 OpenBSD poseidon.atlantide.net 5.6 GENERIC.MP#714 amd64
 
 just22@poseidon:[~] type man
 man is hashed (/usr/bin/man)
 
 just22@poseidon:[~] man -m /home/just22/share/man/ man
 man: -m/home/just22/share/man/: Bad argument
 
 It seems a space is missing... Is it just me?
 
 -- 
 Alessandro DE LAURENZIS
 [mailto:just22@gmail.com]
 LinkedIn: http://it.linkedin.com/in/delaurenzis

schwarze@ switched the tree over to using the mandoc(1) implementation
of man(1). That probably just made it into snaps.

http://marc.info/?l=openbsd-cvsm=141857975006131w=2

-Bryan.