[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tail option parsing bug
From: |
Bruno Haible |
Subject: |
tail option parsing bug |
Date: |
Tue, 15 May 2001 15:21:25 +0200 (CEST) |
Hi,
In textutils-2.0 to 2.0.14, "tail -Nb" gives an error message. Example:
$ tail -10b < /bin/tar | wc -c
tail: b: invalid suffix character in obsolescent option
0
But SUSV2 says the 'b' suffix is allowed and equivalent to 'c' with a
multiplier of 512. Below is a fix.
$ tail -10b < /bin/tar | wc -c
5120
Bruno
2001-05-12 Bruno Haible <address@hidden>
* src/tail.c (parse_obsolescent_option): Accept a b suffix.
*** textutils/src/tail.c Sun Mar 18 08:53:29 2001
--- textutils-i18n/src/tail.c Sat May 12 20:12:40 2001
***************
*** 1253,1259 ****
n_string_end = p;
t_count_lines = 1;
! if (*p == 'c')
{
t_count_lines = 0;
++p;
--- 1385,1391 ----
n_string_end = p;
t_count_lines = 1;
! if (*p == 'c' || *p == 'b')
{
t_count_lines = 0;
++p;
***************
*** 1296,1302 ****
strtol_error s_err;
unsigned long int tmp_ulong;
char *end;
! s_err = xstrtoul (n_string, &end, 10, &tmp_ulong, NULL);
if (s_err == LONGINT_OK && tmp_ulong <= OFF_T_MAX)
*n_units = (off_t) tmp_ulong;
else
--- 1428,1436 ----
strtol_error s_err;
unsigned long int tmp_ulong;
char *end;
!
! s_err = xstrtoul (n_string, &end, 10, &tmp_ulong,
! *n_string_end == 'b' ? "b" : NULL);
if (s_err == LONGINT_OK && tmp_ulong <= OFF_T_MAX)
*n_units = (off_t) tmp_ulong;
else
- tail option parsing bug,
Bruno Haible <=