[net.bugs.4bsd] Two bug fixes to ul

pwb (04/22/83)

The following are two bug fixes to ul(1).  The first
bug was detected locally.  The second bug has been
reported on the net previously, but we decided on a
more general fix which we are resubmitting to netland.

		Phil Bonesteele  ...{decvax,ucbvax}!trw-unix!pwb



1983-0046.01          TRW/UNIX Modification          1983-0046.01

NAME
     ul - argument processing for -t option doesn't work

DATE ENACTED
     March 8, 1983

KEYWORDS
     underline, ul(1), termcap(3), termcap(5)

PROBLEM DESCRIPTION
     The argument processing for the -t option of ul(1) does not
                                                  --
     work.

PROBLEM BACKGROUND
     The manual page for ul(1) states a space must be provided
                         --
     between the `-t' option designator and the terminal type
     specification, while the code attempts to handle the option
     with or without the space and fails in both cases.  If there
     is no space between the -t option designator and the termi-
     nal type, as in `-tvt100', ul(1) enters an infinite loop.
                                --
     If a space is provided, as in `-t vt100', the terminal type
     is set correctly and ul(1) attempts to underline the file
                          --
     `vt100'.

RESOLUTION
     Change the code for the -t option starting on line number 33
     from
               case 't':
               case 'T': /* for nroff compatibility */
                    if (argv[0][2])
                         termtype = &argv[0][2];
                    else {
                         termtype = argv[1];
                         argc--;
                         argv++;
                    }
                    break;

     to
               case 't':
               case 'T': /* for nroff compatibility */
                    if (argv[0][2])
                         termtype = &argv[0][2];
                    else {
                         termtype = *++argv;
                         argc--;
                    }
                    argc--;
                    argv++;
                    break;

4bsd                      TRW (3/30/83)                         1

1983-0046.01          TRW/UNIX Modification          1983-0046.01

FILES
     /usr/src/cmd/ul.c

REQUESTOR
     Phil Bonesteele

AUTHOR
     Phil Bonesteele

SEE ALSO
     1983-0046.02

4bsd                      TRW (3/30/83)                         2


1983-0046.02          TRW/UNIX Modification          1983-0046.02

NAME
     ul - ignores first file argument

DATE ENACTED
     March 9, 1983

KEYWORDS
     underline, ul(1), termcap(3), termcap(5)

PROBLEM DESCRIPTION
     When ul(1) performs underlining for a `dumb' terminal, it
          --
     ignores the first file argument.

PROBLEM BACKGROUND
     For `dumb' terminals, all file arguments are passed to
     cat(1) by a call to execv(2) without inserting the name of
     ---                 -----
     cat(1) into argv[0].  Thus the first file argument arrives
     ---
     to cat(1) in argv[0] and is ignored.  If there is only one
        ---
     file argument, this causes cat(1) to read standard input.
                                ---

RESOLUTION
     Change the if statement on line number 58
     from
               if (tgetflag("os"))
                    execv("/bin/cat",argv);
     to
               if (tgetflag("os")) {
                    *--argv = "cat";
                    execv("/bin/cat",argv);
               }

     and change the if statment on line number 79
     from
               if (chul==0&&stul==0&&endul==0&&tgetflag("ul"))
                    execv("/bin/cat",argv);
     to
               if (chul==0&&stul==0&&endul==0&&tgetflag("ul")) {
                    *--argv = "cat";
                    execv("/bin/cat",argv);
               }

FILES
     /usr/src/cmd/ul.c

REQUESTOR
     Michael Gorlick

AUTHOR
     Phil Bonesteele

SEE ALSO
     This request originated from a bug report posted to

4bsd                      TRW (3/30/83)                         1

1983-0046.02          TRW/UNIX Modification          1983-0046.02

     net.bugs.4bsd on January 19, 1983.
     1983-0046.01

4bsd                      TRW (3/30/83)                         2