Re: [PATCH 2/8] Next cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 28, 2011 at 04:56:30PM +0200, Werner Fink wrote:
> Next cleanup, that is split off special character parsing in do_prompt()
> and parse_args(), handle name of line of virtual console and use it in
> utmp update as well as the session id.  Also move the initial TERM
> variable to open_tty() as we use this later in open_tty().

 Oh.. so many changes in one patch ;-(

> +static ssize_t safe_write (int fd, const char *buffer, size_t count);

 Please, #include "widechar.h" where is already implemented this
 function.

> @@ -483,15 +462,29 @@ static void parse_args(int argc, char **argv, struct options *op)
>  	if ('0' <= argv[optind][0] && argv[optind][0] <= '9') {
>  		/* Assume BSD style speed. */
>  		parse_speeds(op, argv[optind++]);
> -		op->tty = argv[optind];
> +		if (argc < optind + 1) {
> +			warn(_("not enough arguments"));
> +			usage(stderr);
> +		}
> +		op->tty = argv[optind++];
>  	} else {
>  		op->tty = argv[optind++];
> -		parse_speeds(op, argv[optind]);
> +		if (argc > optind) {
> +			char *v = argv[optind++];
> +			if ('0' <= *v && *v <= '9')
> +				parse_speeds(op, v);
> +			else
> +				op->speeds[op->numspeed++] = bcode("9600");
> +		}
>  	}

 After this change the code does not make sense (and I will not apply
 such block of code). It would be better to make the speed optional
 and use some default speed there.

> +			if (c == '\\')
> +				output_special_char(getc(fd), op, tp);
> +			else
> +				(void) putchar(c);

 Don't use (void), it's legacy with no effect.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux