Subject: Re: bin/2837: su manpage inaccurate
To: None <netbsd-bugs@NetBSD.ORG>
From: William O Ferry <WOFerry+@CMU.EDU>
List: netbsd-bugs
Date: 10/12/1996 15:47:50
Whoops!  Looks like I didn't think things through far enough there. 
Thanks again to Theo, who pointed out that su does handle everything
correctly, I just needed to use the syntax "su [-Kflm] [login [-c shell
arguments]]".  So I retract my fixes below, as they are not the correct
solution.  Instead it would be nice if the manpage reflected the
necessity of the "-c" option before the shell.  I don't know enough
about the manpage format to be able to submit a fix for this.  But it
really is a documentation problem, not a software problem.  I guess the
usage string in su.c needs to be updated, though.

                                                        Will Ferry

Excerpts from netbsd-bugs: 12-Oct-96 Re: bin/2837: su manpage in.. by
William O Ferry@CMU.EDU 
>     Okay, thanks to a note from Theo de Raadt saying that su was working
> right, but csh wasn't, here's a simple fix.  `man csh` documents a "-c"
> option, which treats the remainder of the line as a command and
> arguments, as opposed to the default behavior of opening the argument as
> a shell script and trying to run it (which was generating the problems
> above).
> WARPDRIVE.RES.CMU.EDU (root) /usr/src/usr.bin/su % diff -uN su.c.orig su.c
> --- su.c.orig      Fri Oct 13 23:25:22 1995
> +++ su.c        Sat Oct 12 14:33:51 1996
> @@ -108,7 +108,7 @@
>                         break;
>                 case '?':
>                 default:
> -                       (void)fprintf(stderr, "usage: su [%s] [login]\n",
> +                       (void)fprintf(stderr, "usage: su [%s] [login
> [shell arguments]]\n",
>                             ARGSTR);
>                         exit(1);
>                 }
> @@ -251,6 +251,9 @@
>         }
>         if (iscsh == YES) {
> +               if (np[1])
> +                 /* if passed any additional arguments, csh needs a "-c" */
> +                       *np-- = "-c";
>                 if (fastlogin)
>                         *np-- = "-f";
>                 if (asme)