Compare commits

...

59 Commits

Author SHA1 Message Date
Jim Meyering
d63b8caa5c use generated fs_name function 2001-12-16 22:59:07 +00:00
Jim Meyering
2fae9e5d26 Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION
instead of hard-coding --help and --version descriptions.
Split --help output into smaller pieces.
Use fputs, not printf.
2001-12-15 20:46:30 +00:00
Jim Meyering
9be58099c4 *** empty log message *** 2001-12-15 20:46:00 +00:00
Jim Meyering
49db4dd32c *** empty log message *** 2001-12-15 16:59:00 +00:00
Jim Meyering
c6be028a84 (STREQ): Define. 2001-12-15 16:58:53 +00:00
Jim Meyering
e92b78f873 (__restrict_arr): Update from libc. 2001-12-15 16:57:15 +00:00
Jim Meyering
83c58cadbc from Marcus Brinkmann 2001-12-15 16:45:38 +00:00
Jim Meyering
c3d224580c *** empty log message *** 2001-12-15 10:38:55 +00:00
Jim Meyering
894cb43a58 *** empty log message *** 2001-12-15 10:37:11 +00:00
Jim Meyering
d063f15ca1 (ME_REMOTE): Recognize file systems of type smbfs
as `remote' if the name starts with `//'.
2001-12-15 10:36:58 +00:00
Jim Meyering
7e03c96656 *** empty log message *** 2001-12-15 09:29:14 +00:00
Jim Meyering
ae66a6b2b0 Also accept SunOS4's `Not owner' diagnostic. 2001-12-15 09:28:50 +00:00
Jim Meyering
686562b5a7 Run each --help and --version test with a few different settings
of LC_MESSAGES.
2001-12-15 09:14:21 +00:00
Jim Meyering
b094fe9daa Fail also if ./$i --version fails. 2001-12-15 09:07:18 +00:00
Jim Meyering
16a1aff95a *** empty log message *** 2001-12-14 11:21:13 +00:00
Jim Meyering
7f892add00 (jm_MACROS): Check for iswspace.
Suggestion from Bruno Haible.
2001-12-14 11:21:04 +00:00
Jim Meyering
a9f5b7cff2 *** empty log message *** 2001-12-13 11:17:49 +00:00
Jim Meyering
6b1cbebf24 *** empty log message *** 2001-12-13 11:12:35 +00:00
Jim Meyering
fc0b04b093 *** empty log message *** 2001-12-13 11:12:23 +00:00
Jim Meyering
8471372f24 (wc): Use ISSPACE and iswspace in addition to hard-coding
the ASCII space character.
2001-12-13 11:12:18 +00:00
Jim Meyering
80f17f22f2 *** empty log message *** 2001-12-11 11:51:17 +00:00
Jim Meyering
098bfeea80 (main):
Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
s/getting attributes/failed to get attributes/
2001-12-11 11:49:36 +00:00
Jim Meyering
0ef9bacdc7 split long line 2001-12-11 11:49:14 +00:00
Jim Meyering
879adb17cc (change_file_mode, main):
Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
s/getting attributes/failed to get attributes/
2001-12-11 11:48:54 +00:00
Jim Meyering
92c8fc20fb (change_file_owner):
Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
s/getting attributes/failed to get attributes/
2001-12-11 11:48:21 +00:00
Jim Meyering
47a2e7569c (main):
Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
s/getting attributes/failed to get attributes/
2001-12-11 11:47:54 +00:00
Jim Meyering
d5654c49bd (re_protect):
Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
s/getting attributes/failed to get attributes/
2001-12-11 11:47:25 +00:00
Jim Meyering
a6a92722ff Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
s/getting attributes/failed to get attributes/
2001-12-11 11:46:49 +00:00
Jim Meyering
f5a1b61888 *** empty log message *** 2001-12-11 11:41:15 +00:00
Jim Meyering
24d1484e1c (buggy_lseek_support): Remove function.
(skip_via_lseek) [__linux__]: New function.
(skip): Use skip_via_lseek, not buggy_lseek_support.
2001-12-11 11:40:50 +00:00
Jim Meyering
efc6e85c74 . 2001-12-10 00:17:05 +00:00
Jim Meyering
a988aefd03 Remove explicit declarations of xmalloc and xrealloc,
Instead, include "xalloc.h".
(initbuffer): Don't cast xmalloc return value to char*.
(readline): Reword comment.
Don't cast xrealloc return value to char*
Return NULL, not 0.
2001-12-10 00:13:36 +00:00
Jim Meyering
a49772f23b *** empty log message *** 2001-12-09 22:57:15 +00:00
Jim Meyering
ea1f6ec04b *** empty log message *** 2001-12-09 22:56:52 +00:00
Jim Meyering
0b072ba82c (posix_time_parse): Add cast to avoid warning about
`signed and unsigned type in conditional expression'.
2001-12-09 22:56:16 +00:00
Jim Meyering
0928d79889 (mode_compile): Add cast to avoid warning about
`signed and unsigned type in conditional expression'.
2001-12-09 22:54:19 +00:00
Jim Meyering
6994cb9650 (xreadlink): Add cast to avoid a warning. 2001-12-09 22:46:53 +00:00
Jim Meyering
5b34b167f9 (readtoken): Declare an index to be of type unsigned
to avoid a pedantic warning.
2001-12-09 22:39:02 +00:00
Jim Meyering
923091ff96 Don't include assert.h.
(getstr): Remove warning-evoking assertions.
Return -1 if offset parameter is out of bounds.
Change the type of a local from int to size_t.
2001-12-09 22:08:19 +00:00
Jim Meyering
26061de96f (my_strftime_localtime_r): Include this function
definition in the `#if ! HAVE_TM_GMTOFF' block.
2001-12-09 21:02:43 +00:00
Jim Meyering
102ad5c8ff *** empty log message *** 2001-12-09 21:01:23 +00:00
Jim Meyering
bb0d2464f8 Remove declarations of xmalloc and xrealloc.
Include xalloc.h instead.
2001-12-09 21:01:15 +00:00
Jim Meyering
2de5b90948 *** empty log message *** 2001-12-09 10:27:44 +00:00
Jim Meyering
d85b445409 *** empty log message *** 2001-12-08 20:44:05 +00:00
Jim Meyering
707c2dc263 *** empty log message *** 2001-12-08 20:42:13 +00:00
Jim Meyering
7f8213c31e *** empty log message *** 2001-12-08 20:41:53 +00:00
Jim Meyering
e1958d172e (wget_files): Remove ansi2knr.c, since it's
no longer available at that location.
2001-12-08 20:41:46 +00:00
Jim Meyering
7f0947ae50 *** empty log message *** 2001-12-08 19:19:19 +00:00
Jim Meyering
dcfb371a6b tweak to align with libc 2001-12-08 06:57:58 +00:00
Jim Meyering
acca325884 (join invocation): tweak wording 2001-12-05 14:14:43 +00:00
Jim Meyering
3e729d218d *** empty log message *** 2001-12-04 21:38:54 +00:00
Jim Meyering
56117f587b *** empty log message *** 2001-12-04 21:37:37 +00:00
Jim Meyering
568ec722bb *** empty log message *** 2001-12-04 17:55:12 +00:00
Jim Meyering
a95d10ec54 Don't use diff's -u option. It's not portable.
Besides, with GNU diff one can use the DIFF_OPTIONS envvar.
2001-12-04 17:55:08 +00:00
Jim Meyering
8f730b8a46 (usage): Don't split translatable strings in the middle of a sentence. 2001-12-03 16:07:50 +00:00
Jim Meyering
2f8490672b *** empty log message *** 2001-12-03 16:07:23 +00:00
Jim Meyering
99fbca4eba (usage): Merge lone "\n" into adjacent string. 2001-12-03 15:56:48 +00:00
Jim Meyering
f05581b361 (usage): Merge lone "\n" into adjacent string. 2001-12-03 15:56:24 +00:00
Jim Meyering
5444831241 *** empty log message *** 2001-12-02 22:47:09 +00:00
75 changed files with 1468 additions and 424 deletions

View File

@@ -16,8 +16,9 @@ b_url_dir = $(alpha_subdir)
wget_files = \
$(srcdir)/config.guess \
$(srcdir)/config.sub \
$(srcdir)/doc/texinfo.tex \
$(srcdir)/src/ansi2knr.c
$(srcdir)/doc/texinfo.tex
# $(srcdir)/src/ansi2knr.c
###############################################

View File

@@ -3973,7 +3973,7 @@ join [@var{option}]@dots{} @var{file1} @var{file2}
@vindex LC_COLLATE
Either @var{file1} or @var{file2} (but not both) can be @samp{-},
meaning standard input. @var{file1} and @var{file2} should be already
meaning standard input. @var{file1} and @var{file2} should be
sorted on the join fields.
Normally, the sort order is that of the

View File

@@ -1,3 +1,42 @@
2001-12-15 Jim Meyering <meyering@lucent.com>
* regex.h (__restrict_arr): Update from libc.
* mountlist.h (ME_REMOTE): Recognize file systems of type smbfs
as `remote' if the name starts with `//'. Suggested by Michael Stone.
(STREQ): Define.
2001-12-10 Jim Meyering <meyering@lucent.com>
* linebuffer.c: Remove explicit declarations of xmalloc and xrealloc,
Instead, include "xalloc.h".
(initbuffer): Don't cast xmalloc return value to char*.
(readline): Reword comment.
Don't cast xrealloc return value to char*
Return NULL, not 0.
2001-12-09 Jim Meyering <meyering@lucent.com>
* modechange.c (mode_compile): Add cast to avoid pedantic warning about
`signed and unsigned type in conditional expression'.
* posixtm.c (posix_time_parse): Likewise.
* xreadlink.c (xreadlink): Add cast to avoid a pedantic warning.
* readtokens.c (readtoken): Declare an index to be of type unsigned
to avoid a pedantic warning.
* getstr.c: Don't include assert.h.
(getstr): Remove warning-evoking assertions.
Return -1 if offset parameter is out of bounds.
Change the type of a local from int to size_t.
* strftime.c (my_strftime_localtime_r): Include this function
definition in the `#if ! HAVE_TM_GMTOFF' block.
* xgethostname.c: Remove declarations of xmalloc and xrealloc.
Include xalloc.h instead.
2001-12-02 Jim Meyering <meyering@lucent.com>
* tempname.c: Don't declare getenv, thus reverting the change of

View File

@@ -25,8 +25,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <assert.h>
#if STDC_HEADERS
# include <stdlib.h>
#else
@@ -49,7 +47,7 @@ int
getstr (char **lineptr, size_t *n, FILE *stream, int delim1, int delim2,
size_t offset)
{
int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
size_t nchars_avail; /* Allocated but unused chars in *LINEPTR. */
char *read_pos; /* Where we're reading into *LINEPTR. */
int ret;
@@ -64,6 +62,9 @@ getstr (char **lineptr, size_t *n, FILE *stream, int delim1, int delim2,
return -1;
}
if (*n < offset)
return -1;
nchars_avail = *n - offset;
read_pos = *lineptr + offset;
@@ -75,7 +76,6 @@ getstr (char **lineptr, size_t *n, FILE *stream, int delim1, int delim2,
always (unless we get an error while reading the first char)
NUL-terminate the line buffer. */
assert(*n - nchars_avail == read_pos - *lineptr);
if (nchars_avail < 2)
{
if (*n > MIN_CHUNK)
@@ -88,7 +88,6 @@ getstr (char **lineptr, size_t *n, FILE *stream, int delim1, int delim2,
if (!*lineptr)
return -1;
read_pos = *n - nchars_avail + *lineptr;
assert(*n - nchars_avail == read_pos - *lineptr);
}
if (c == EOF || ferror (stream))

View File

@@ -25,9 +25,8 @@
#include <sys/types.h>
#include "linebuffer.h"
#include "unlocked-io.h"
#include "xalloc.h"
char *xmalloc ();
char *xrealloc ();
void free ();
/* Initialize linebuffer LINEBUFFER for use. */
@@ -37,14 +36,16 @@ initbuffer (struct linebuffer *linebuffer)
{
linebuffer->length = 0;
linebuffer->size = 200;
linebuffer->buffer = (char *) xmalloc (linebuffer->size);
linebuffer->buffer = xmalloc (linebuffer->size);
}
/* Read an arbitrarily long line of text from STREAM into LINEBUFFER.
Keep the newline; append a newline if it's the last line of a file
that ends in a non-newline character. Do not null terminate.
Return LINEBUFFER, except at end of file return 0. */
Therefore the stream can contain NUL bytes, and the length
(including the newline) is returned in linebuffer->length.
Return NULL upon error, or when STREAM is empty.
Otherwise, return LINEBUFFER. */
struct linebuffer *
readline (struct linebuffer *linebuffer, FILE *stream)
{
@@ -54,7 +55,7 @@ readline (struct linebuffer *linebuffer, FILE *stream)
char *end = buffer + linebuffer->size; /* Sentinel. */
if (feof (stream) || ferror (stream))
return 0;
return NULL;
do
{
@@ -62,7 +63,7 @@ readline (struct linebuffer *linebuffer, FILE *stream)
if (c == EOF)
{
if (p == buffer)
return 0;
return NULL;
if (p[-1] == '\n')
break;
c = '\n';
@@ -70,7 +71,7 @@ readline (struct linebuffer *linebuffer, FILE *stream)
if (p == end)
{
linebuffer->size *= 2;
buffer = (char *) xrealloc (buffer, linebuffer->size);
buffer = xrealloc (buffer, linebuffer->size);
p = p - linebuffer->buffer + buffer;
linebuffer->buffer = buffer;
end = buffer + linebuffer->size;

View File

@@ -194,18 +194,18 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
&& S_IRGRP == RGRP && S_IWGRP == WGRP && S_IXGRP == XGRP
&& S_IROTH == ROTH && S_IWOTH == WOTH && S_IXOTH == XOTH)
? octal_value
: ((octal_value & SUID ? S_ISUID : 0)
| (octal_value & SGID ? S_ISGID : 0)
| (octal_value & SVTX ? S_ISVTX : 0)
| (octal_value & RUSR ? S_IRUSR : 0)
| (octal_value & WUSR ? S_IWUSR : 0)
| (octal_value & XUSR ? S_IXUSR : 0)
| (octal_value & RGRP ? S_IRGRP : 0)
| (octal_value & WGRP ? S_IWGRP : 0)
| (octal_value & XGRP ? S_IXGRP : 0)
| (octal_value & ROTH ? S_IROTH : 0)
| (octal_value & WOTH ? S_IWOTH : 0)
| (octal_value & XOTH ? S_IXOTH : 0)));
: (mode_t) ((octal_value & SUID ? S_ISUID : 0)
| (octal_value & SGID ? S_ISGID : 0)
| (octal_value & SVTX ? S_ISVTX : 0)
| (octal_value & RUSR ? S_IRUSR : 0)
| (octal_value & WUSR ? S_IWUSR : 0)
| (octal_value & XUSR ? S_IXUSR : 0)
| (octal_value & RGRP ? S_IRGRP : 0)
| (octal_value & WGRP ? S_IWGRP : 0)
| (octal_value & XGRP ? S_IXGRP : 0)
| (octal_value & ROTH ? S_IROTH : 0)
| (octal_value & WOTH ? S_IWOTH : 0)
| (octal_value & XOTH ? S_IXOTH : 0)));
p = make_node_op_equals (mode);
if (p == NULL)

View File

@@ -1,5 +1,5 @@
/* mountlist.h -- declarations for list of mounted filesystems
Copyright (C) 1991, 1992, 1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1998, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,13 +38,22 @@ struct mount_entry
struct mount_entry *read_filesystem_list PARAMS ((int need_fs_type));
#ifndef ME_DUMMY
# define ME_DUMMY(fs_name, fs_type) \
(!strcmp (fs_type, "auto") \
|| !strcmp (fs_type, "autofs") \
# define ME_DUMMY(Fs_name, Fs_type) \
(!strcmp (Fs_type, "auto") \
|| !strcmp (Fs_type, "autofs") \
/* for Irix 6.5 */ \
|| !strcmp (fs_type, "ignore"))
|| !strcmp (Fs_type, "ignore"))
#endif
#undef STREQ
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
#ifndef ME_REMOTE
# define ME_REMOTE(fs_name, fs_type) (strchr (fs_name, ':') != 0)
/* A file system is `remote' if its Fs_name contains a `:'
or if (it is of type smbfs and its Fs_name starts with `//'). */
# define ME_REMOTE(Fs_name, Fs_type) \
(strchr ((Fs_name), ':') != 0 \
|| ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \
&& STREQ (Fs_type, "smbfs")))
#endif

View File

@@ -125,7 +125,7 @@ posix_time_parse (const char *s, unsigned int syntax_bits)
size_t s_len = strlen (s);
size_t len = (((syntax_bits & PDS_SECONDS) && (dot = strchr (s, '.')))
? dot - s
? (size_t) (dot - s)
: s_len);
if (len != 8 && len != 10 && len != 12)

View File

@@ -108,9 +108,10 @@ readtoken (FILE *stream,
if (!same_delimiters)
{
const char *t;
unsigned int j;
saved_delim = delim;
for (i = 0; i < sizeof (isdelim); i++)
isdelim[i] = 0;
for (j = 0; j < sizeof (isdelim); j++)
isdelim[j] = 0;
for (t = delim; *t; t++)
isdelim[(unsigned int) *t] = 1;
}

View File

@@ -113,10 +113,10 @@
# endif
/* Support for bounded pointers. */
# ifndef __BOUNDED_POINTERS__
# define __bounded /* nothing */
# define __unbounded /* nothing */
# define __ptrvalue /* nothing */
# if !defined _LIBC && !defined __BOUNDED_POINTERS__
# define __bounded /* nothing */
# define __unbounded /* nothing */
# define __ptrvalue /* nothing */
# endif
/* The `emacs' switch turns on certain matching commands

View File

@@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library, version 0.12.
Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1985,1989-93,1995-98,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@@ -529,10 +529,14 @@ extern int re_exec _RE_ARGS ((const char *));
# endif
# endif
#endif
/* For now unconditionally define __restrict_arr to expand to nothing.
Ideally we would have a test for the compiler which allows defining
it to restrict. */
#define __restrict_arr
/* gcc 3.1 and up support the [restrict] syntax. */
#ifndef __restrict_arr
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define __restrict_arr __restrict
# else
# define __restrict_arr
# endif
#endif
/* POSIX compatibility. */
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,

View File

@@ -191,7 +191,6 @@ my_strftime_gmtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_TM_GMTOFF */
static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
@@ -205,6 +204,7 @@ my_strftime_localtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_TM_GMTOFF */
#endif /* ! defined _LIBC */

View File

@@ -1,5 +1,5 @@
/* xgethostname.c -- return current hostname with unlimited length
Copyright (C) 1992, 1996, 2000 Free Software Foundation, Inc.
Copyright (C) 1992, 1996, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ extern int errno;
#endif
#include "error.h"
#include "xalloc.h"
#ifndef ENAMETOOLONG
# define ENAMETOOLONG 9999
@@ -39,8 +40,6 @@ extern int errno;
#endif
int gethostname ();
char *xmalloc ();
char *xrealloc ();
#ifndef INITIAL_HOSTNAME_LENGTH
# define INITIAL_HOSTNAME_LENGTH 34

View File

@@ -78,7 +78,7 @@ xreadlink (char const *filename)
return NULL;
}
if (link_length < buf_size)
if ((size_t) link_length < buf_size)
{
buffer[link_length] = 0;
return buffer;

View File

@@ -1,3 +1,8 @@
2001-12-14 Jim Meyering <meyering@lucent.com>
* jm-macros.m4 (jm_MACROS): Check for iswspace.
Suggestion from Bruno Haible.
2001-11-20 Jim Meyering <meyering@lucent.com>
* mkstemp.m4 (UTILS_FUNC_MKSTEMP): Update comment to reflect that

View File

@@ -1,4 +1,4 @@
#serial 41 -*- autoconf -*-
#serial 42 -*- autoconf -*-
dnl Misc type-related macros for fileutils, sh-utils, textutils.
@@ -134,6 +134,7 @@ AC_DEFUN([jm_MACROS],
getmntinfo \
hasmntopt \
isascii \
iswspace \
lchown \
listmntent \
localeconv \

View File

@@ -1,3 +1,50 @@
2001-12-15 Jim Meyering <meyering@lucent.com>
* Version 4.1.4.
* tests/touch/fail-diag: Also accept SunOS4's `Not owner' diagnostic.
Reported by Volker Borchert.
* tests/help-version: Fail also if ./$i --version fails.
Run each --help and --version test with a few different settings
of LC_MESSAGES. Prompted by a report from Nelson Beebe.
2001-12-11 Jim Meyering <meyering@lucent.com>
Include the word `fail' in some diagnostics to make it clearer
that they indicate a failure.
* src/chgrp.c (main): s/getting attributes/failed to get attributes/.
* src/chmod.c (change_file_mode, main): Likewise.
* src/chown-core.c (change_file_owner): Likewise.
* src/chown.c (main): Likewise.
* src/cp.c (re_protect): Likewise.
* src/touch.c (touch, main):Likewise.
Suggestion from Karl Berry.
2001-12-10 Jim Meyering <meyering@lucent.com>
* src/dd.c (buggy_lseek_support): Remove function.
(skip_via_lseek) [__linux__]: New function.
(skip): Use skip_via_lseek, not buggy_lseek_support.
Based on an outline from Paul Eggert.
2001-12-09 Jim Meyering <meyering@lucent.com>
* configure.in (ALL_LINGUAS): Add Estonian (et).
2001-12-08 Jim Meyering <meyering@lucent.com>
* Makefile.cfg (wget_files): Remove ansi2knr.c, since it's
no longer available at that location.
2001-12-04 Jim Meyering <meyering@lucent.com>
* tests/chgrp/basic: Don't use diff's -u option. It's not portable.
Besides, with GNU diff one can use the DIFF_OPTIONS envvar.
* tests/ls/no-arg: Likewise.
* tests/ls/recursive: Likewise.
* tests/ls/rt-1: Likewise.
2001-12-02 Jim Meyering <meyering@lucent.com>
* Version 4.1.3.

View File

@@ -1,3 +1,6 @@
[4.1.4]
* df --local no longer lists smbfs file systems whose name starts with //
* dd now detects the Linux/tape/lseek bug at run time and warns about it.
[4.1.3]
* ls -R once again outputs a blank line between per-directory groups of files.
This was broken by the cycle-detection change in 4.1.1.

View File

@@ -1,7 +1,25 @@
2001-11-25 Jim Meyering <meyering@lucent.com>
2001-12-15 Jim Meyering <meyering@lucent.com>
* Version 2.0.12.
* src/basename.c, src/chroot.c, src/date.c, src/dirname.c, src/echo.c,
* src/env.c, src/expr.c, src/factor.c, src/hostid.c, src/hostname.c,
* src/id.c, src/kill.c, src/logname.c, src/nice.c, src/pathchk.c,
* src/pinky.c, src/printenv.c, src/printf.c, src/pwd.c, src/seq.c,
* src/sleep.c, src/stty.c, src/su.c, src/tee.c, src/test.c, src/true.c,
* src/tty.c, src/uname.c, src/uptime.c, src/users.c, src/who.c,
* src/whoami.c, src/yes.c (usage): Use fputs, not printf.
Split --help output into smaller pieces.
Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION
instead of hard-coding --help and --version descriptions.
2001-12-08 Jim Meyering <meyering@lucent.com>
* Makefile.cfg (wget_files): Remove ansi2knr.c, since it's
no longer available at that location.
2001-11-25 Jim Meyering <meyering@lucent.com>
* basename.c, dirname.c, expr.c, factor.c, hostname.c (usage):
* logname.c, printenv.c, printf.c, pwd.c, sleep.c, test.c (usage):
* true.c, whoami.c, yes.c (usage):

View File

@@ -1,3 +1,35 @@
2001-12-13 Jim Meyering <meyering@lucent.com>
* Version 2.0.20.
2001-12-12 Bruno Haible <bruno@clisp.org>
Paul Eggert <eggert@twinsun.com>
* src/wc.c (wc): Use ISSPACE and iswspace in addition to hard-coding
the ASCII space character.
2001-12-08 Jim Meyering <meyering@lucent.com>
* Version 2.0.19.
* Makefile.cfg (wget_files): Remove ansi2knr.c, since it's
no longer available at that location.
2001-12-03 Jim Meyering <meyering@lucent.com>
* src/od.c, src/tail.c, src/tr.c (usage): I will not split translatable
strings in the middle of a sentence. I will not split translatable
strings in the middle of a sentence. I will not split translatable
strings in the middle of a sentence. ...
* src/join.c (usage): Merge lone "\n" into adjacent string.
* src/md5sum.c (usage): Likewise.
* src/paste.c (usage): Likewise.
Reported by Karl Eichwalder.
2001-12-02 Jim Meyering <meyering@lucent.com>
* Makefile.maint (emit-upload-commands): Fix typo: s/distdir/PACKAGE/.
2001-12-01 Jim Meyering <meyering@lucent.com>
* Version 2.0.18.
@@ -5879,7 +5911,7 @@ Sat Sep 23 15:43:46 1995 Jim Meyering (meyering@comco.com)
* Makefile.in (DISTFILES): Add README.alpha.
* lib/Makfile.in (GETOPT, MEMCHR, REGEX): New variables.
(OBJECTS): Use them instead of hardcoding object file names.
(OBJECTS): Use them instead of hard-coding object file names.
Suggested by Ulrich Drepper.
* md5sum.c (md5_check): Distinguish between open/read failure

View File

@@ -1,4 +1,10 @@
Changes in release 2.1
[2.0.20]
* wc recognizes all locale-defined white-space characters, not just those
in the "C" locale.
[2.0.19]
* portability tweak to make lib/regex.c compile
* split translatable strings only in the middle of sentences
[2.0.18]
* sort could segfault on systems without a working mkstemp function and
with a gettimeofday function that clobbers the static buffer that

View File

@@ -56,13 +56,13 @@ Usage: %s NAME [SUFFIX]\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Print NAME with any leading directory components removed.\n\
If specified, also remove a trailing SUFFIX.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -215,7 +215,8 @@ main (int argc, char **argv)
{
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
error (1, errno, _("getting attributes of %s"), quote (reference_file));
error (1, errno, _("failed to get attributes of %s"),
quote (reference_file));
chopt.group_name = gid_to_name (ref_stats.st_gid);
gid = ref_stats.st_gid;

View File

@@ -155,7 +155,7 @@ change_file_mode (const char *file, const struct mode_change *changes,
if (deref_symlink ? stat (file, &file_stats) : lstat (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, _("getting attributes of %s"), quote (file));
error (0, errno, _("failed to get attributes of %s"), quote (file));
return 1;
}
@@ -362,7 +362,8 @@ main (int argc, char **argv)
else if (changes == MODE_MEMORY_EXHAUSTED)
xalloc_die ();
else if (changes == MODE_BAD_REFERENCE)
error (1, errno, _("getting attributes of %s"), quote (reference_file));
error (1, errno, _("failed to get attributes of %s"),
quote (reference_file));
for (; optind < argc; ++optind)
errors |= change_file_mode (argv[optind], changes, 1);

View File

@@ -233,7 +233,7 @@ change_file_owner (int cmdline_arg, const char *file, uid_t uid, gid_t gid,
if (lstat (file, &file_stats))
{
if (chopt->force_silent == 0)
error (0, errno, _("getting attributes of %s"), quote (file));
error (0, errno, _("failed to get attributes of %s"), quote (file));
return 1;
}
@@ -245,7 +245,7 @@ change_file_owner (int cmdline_arg, const char *file, uid_t uid, gid_t gid,
&& stat (file, &file_stats))
{
if (chopt->force_silent == 0)
error (0, errno, _("getting attributes of %s"), quote (file));
error (0, errno, _("failed to get attributes of %s"), quote (file));
return 1;
}

View File

@@ -217,7 +217,8 @@ main (int argc, char **argv)
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
error (1, errno, _("getting attributes of %s"), quote (reference_file));
error (1, errno, _("failed to get attributes of %s"),
quote (reference_file));
uid = ref_stats.st_uid;
gid = ref_stats.st_gid;

View File

@@ -1,5 +1,5 @@
/* chroot -- run command or shell with special root directory
Copyright (C) 95, 96, 1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 95, 96, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,14 +46,16 @@ usage (int status)
Usage: %s NEWROOT [COMMAND...]\n\
or: %s OPTION\n\
"), program_name, program_name);
printf (_("\
fputs (_("\
Run COMMAND with root directory set to NEWROOT.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
If no command is given, run ``${SHELL} -i'' (default: /bin/sh).\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -300,7 +300,7 @@ re_protect (const char *const_dst_path, int src_offset,
if ((*(x->xstat)) (src_path, &src_sb))
{
error (0, errno, _("getting attributes of %s"),
error (0, errno, _("failed to get attributes of %s"),
quote (src_path));
return 1;
}

View File

@@ -120,7 +120,7 @@ Usage: %s [OPTION]... [+FORMAT]\n\
or: %s [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Display the current time in the given FORMAT, or set the system date.\n\
\n\
-d, --date=STRING display time described by STRING, not `now'\n\
@@ -129,61 +129,81 @@ Display the current time in the given FORMAT, or set the system date.\n\
TIMESPEC=`date' (or missing) for date only,\n\
`hours', `minutes', or `seconds' for date and\n\
time to the indicated precision.\n\
"), stdout);
fputs (_("\
-r, --reference=FILE display the last modification time of FILE\n\
-R, --rfc-822 output RFC-822 compliant date string\n\
-s, --set=STRING set time described by STRING\n\
-u, --utc, --universal print or set Coordinated Universal Time\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
printf (_("\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
FORMAT controls the output. The only valid option for the second form\n\
specifies Coordinated Universal Time. Interpreted sequences are:\n\
\n\
%%%% a literal %%\n\
%%a locale's abbreviated weekday name (Sun..Sat)\n\
%%A locale's full weekday name, variable length (Sunday..Saturday)\n\
%%b locale's abbreviated month name (Jan..Dec)\n\
%%B locale's full month name, variable length (January..December)\n\
%%c locale's date and time (Sat Nov 04 12:02:33 EST 1989)\n\
%%C century (year divided by 100 and truncated to an integer) [00-99]\n\
%%d day of month (01..31)\n\
%%D date (mm/dd/yy)\n\
%%e day of month, blank padded ( 1..31)\n\
%%h same as %%b\n\
%%H hour (00..23)\n\
%%I hour (01..12)\n\
%%j day of year (001..366)\n\
%%k hour ( 0..23)\n\
%%l hour ( 1..12)\n\
%%m month (01..12)\n\
%%M minute (00..59)\n\
%%n a newline\n\
%%p locale's AM or PM\n\
%%r time, 12-hour (hh:mm:ss [AP]M)\n\
%%s seconds since `00:00:00 1970-01-01 UTC' (a GNU extension)\n\
%%S second (00..60)\n\
%%t a horizontal tab\n\
%%T time, 24-hour (hh:mm:ss)\n\
%%u day of week (1..7); 1 represents Monday\n\
%%U week number of year with Sunday as first day of week (00..53)\n\
%%V week number of year with Monday as first day of week (01..53)\n\
%%w day of week (0..6); 0 represents Sunday\n\
%%W week number of year with Monday as first day of week (00..53)\n\
%%x locale's date representation (mm/dd/yy)\n\
%%X locale's time representation (%%H:%%M:%%S)\n\
%%y last two digits of year (00..99)\n\
%%Y year (1970...)\n\
%%z RFC-822 style numeric timezone (-0500) (a nonstandard extension)\n\
%%Z time zone (e.g., EDT), or nothing if no time zone is determinable\n\
%% a literal %\n\
%a locale's abbreviated weekday name (Sun..Sat)\n\
"), stdout);
fputs (_("\
%A locale's full weekday name, variable length (Sunday..Saturday)\n\
%b locale's abbreviated month name (Jan..Dec)\n\
%B locale's full month name, variable length (January..December)\n\
%c locale's date and time (Sat Nov 04 12:02:33 EST 1989)\n\
"), stdout);
fputs (_("\
%C century (year divided by 100 and truncated to an integer) [00-99]\n\
%d day of month (01..31)\n\
%D date (mm/dd/yy)\n\
%e day of month, blank padded ( 1..31)\n\
"), stdout);
fputs (_("\
%h same as %b\n\
%H hour (00..23)\n\
%I hour (01..12)\n\
%j day of year (001..366)\n\
"), stdout);
fputs (_("\
%k hour ( 0..23)\n\
%l hour ( 1..12)\n\
%m month (01..12)\n\
%M minute (00..59)\n\
"), stdout);
fputs (_("\
%n a newline\n\
%p locale's AM or PM\n\
%r time, 12-hour (hh:mm:ss [AP]M)\n\
%s seconds since `00:00:00 1970-01-01 UTC' (a GNU extension)\n\
"), stdout);
fputs (_("\
%S second (00..60)\n\
%t a horizontal tab\n\
%T time, 24-hour (hh:mm:ss)\n\
%u day of week (1..7); 1 represents Monday\n\
"), stdout);
fputs (_("\
%U week number of year with Sunday as first day of week (00..53)\n\
%V week number of year with Monday as first day of week (01..53)\n\
%w day of week (0..6); 0 represents Sunday\n\
%W week number of year with Monday as first day of week (00..53)\n\
"), stdout);
fputs (_("\
%x locale's date representation (mm/dd/yy)\n\
%X locale's time representation (%H:%M:%S)\n\
%y last two digits of year (00..99)\n\
%Y year (1970...)\n\
"), stdout);
fputs (_("\
%z RFC-822 style numeric timezone (-0500) (a nonstandard extension)\n\
%Z time zone (e.g., EDT), or nothing if no time zone is determinable\n\
\n\
By default, date pads numeric fields with zeroes. GNU date recognizes\n\
the following modifiers between `%%' and a numeric directive.\n\
the following modifiers between `%' and a numeric directive.\n\
\n\
`-' (hyphen) do not pad the field\n\
`_' (underscore) pad the field with spaces\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -734,28 +734,57 @@ swab_buffer (char *buf, size_t *nread)
return ++bufstart;
}
/* Return nonzero iff the file referenced by FDESC is of a type for
which lseek's return value is known to be invalid on some systems.
Otherwise, return zero.
For example, return nonzero if FDESC references a Linux tape device
because that lseek returns an offset implying it succeeds, even though
the function fails to perform the requested operation. In that case,
lseek should return a negative number and set errno. The offending
behavior has been confirmed with an Exabyte SCSI tape drive accessed
via /dev/nst0 on both Linux-2.2.17 and Linux-2.4.16. */
/* This is a wrapper for lseek. It detects and warns about a kernel
bug that makes lseek a no-op for tape devices, even though the kernel
lseek return value suggests that the function succeeded.
The parameters are the same as those of the lseek function, but
with the addition of FILENAME, the name of the file associated with
descriptor FDESC. The file name is used solely in the warning that's
printed when the bug is detected. Return the same value that lseek
would have returned, but when the lseek bug is detected, return -1
to indicate that lseek failed.
The offending behavior has been confirmed with an Exabyte SCSI tape
drive accessed via /dev/nst0 on both Linux-2.2.17 and Linux-2.4.16. */
#ifdef __linux__
static int
buggy_lseek_support (int fdesc)
{
struct stat stats;
return (fstat (fdesc, &stats) == 0
&& (S_ISCHR (stats.st_mode))
&& major (stats.st_rdev) == 9);
# include <sys/mtio.h>
# define MT_SAME_POSITION(P, Q) \
((P).mt_resid == (Q).mt_resid \
&& (P).mt_fileno == (Q).mt_fileno \
&& (P).mt_blkno == (Q).mt_blkno)
static off_t
skip_via_lseek (char const *filename, int fdesc, off_t offset, int whence)
{
struct mtget s1;
struct mtget s2;
off_t new_position;
int got_original_tape_position;
got_original_tape_position = (ioctl (fdesc, MTIOCGET, &s1) == 0);
/* known bad device type */
/* && s.mt_type == MT_ISSCSI2 */
new_position = lseek (fdesc, offset, whence);
if (0 <= new_position
&& got_original_tape_position
&& ioctl (fdesc, MTIOCGET, &s2) == 0
&& MT_SAME_POSITION (s1, s2))
{
error (0, 0, _("warning: working around lseek kernel bug for file (%s)\n\
of mt_type=0x%0lx -- see <sys/mtio.h> for the list of types"),
filename, s2.mt_type);
new_position = -1;
}
return new_position;
}
#else
# define buggy_lseek_support(Fd) 0
# define skip_via_lseek(Filename, Fd, Offset, Whence) lseek (Fd, Offset, Whence)
#endif
/* Throw away RECORDS blocks of BLOCKSIZE bytes on file descriptor FDESC,
@@ -769,13 +798,10 @@ skip (int fdesc, char *file, uintmax_t records, size_t blocksize, char *buf)
off_t offset = records * blocksize;
/* Try lseek and if an error indicates it was an inappropriate
operation, fall back on using read. Some broken versions of
lseek may return zero, so count that as an error too as a valid
zero return is not possible here. */
operation, fall back on using read. */
if (offset / blocksize != records
|| buggy_lseek_support (fdesc)
|| lseek (fdesc, offset, SEEK_CUR) <= 0)
|| skip_via_lseek (file, fdesc, offset, SEEK_CUR) < 0)
{
while (records--)
{

View File

@@ -49,13 +49,13 @@ Usage: %s NAME\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Print NAME with its trailing /component removed; if NAME contains no /'s,\n\
output `.' (meaning the current directory).\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* echo.c, derived from code echo.c in Bash.
Copyright (C) 87,89, 1991-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 87,89, 1991-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -75,15 +75,17 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [STRING]...\n"), program_name);
printf (_("\
fputs (_("\
Echo the STRING(s) to standard output.\n\
\n\
-n do not output the trailing newline\n\
-e enable interpretation of the backslash-escaped characters\n\
listed below\n\
-E disable interpretation of those sequences in STRINGs\n\
--help display this help and exit (should be alone)\n\
--version output version information and exit (should be alone)\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
Without -E, the following sequences are recognized and interpolated:\n\
\n\
@@ -91,13 +93,15 @@ Without -E, the following sequences are recognized and interpolated:\n\
\\\\ backslash\n\
\\a alert (BEL)\n\
\\b backspace\n\
"), stdout);
fputs (_("\
\\c suppress trailing newline\n\
\\f form feed\n\
\\n new line\n\
\\r carriage return\n\
\\t horizontal tab\n\
\\v vertical tab\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* env - run a program in a modified environment
Copyright (C) 1986, 1991-2000 Free Software Foundation, Inc.
Copyright (C) 1986, 1991-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -119,16 +119,18 @@ usage (int status)
printf (_("\
Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n"),
program_name);
printf (_("\
fputs (_("\
Set each NAME to VALUE in the environment and run COMMAND.\n\
\n\
-i, --ignore-environment start with an empty environment\n\
-u, --unset=NAME remove variable from the environment\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
A mere - implies -i. If no COMMAND, print the resulting environment.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -92,19 +92,19 @@ Usage: %s EXPRESSION\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf (_("\
fputs ("\n", stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
"));
printf (_("\
Print the value of EXPRESSION to standard output. A blank line below\n\
separates increasing precedence groups. EXPRESSION may be:\n\
\n\
ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n\
\n\
ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n\
"), stdout);
fputs (_("\
\n\
ARG1 < ARG2 ARG1 is less than ARG2\n\
ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n\
@@ -112,13 +112,19 @@ separates increasing precedence groups. EXPRESSION may be:\n\
ARG1 != ARG2 ARG1 is unequal to ARG2\n\
ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n\
ARG1 > ARG2 ARG1 is greater than ARG2\n\
"), stdout);
fputs (_("\
\n\
ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n\
ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n\
"), stdout);
fputs (_("\
\n\
ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n\
ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n\
ARG1 %% ARG2 arithmetic remainder of ARG1 divided by ARG2\n\
ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n\
"), stdout);
fputs (_("\
\n\
STRING : REGEXP anchored pattern match of REGEXP in STRING\n\
\n\
@@ -126,18 +132,20 @@ separates increasing precedence groups. EXPRESSION may be:\n\
substr STRING POS LENGTH substring of STRING, POS counted from 1\n\
index STRING CHARS index in STRING where any CHARS is found, or 0\n\
length STRING length of STRING\n\
"), stdout);
fputs (_("\
+ TOKEN interpret TOKEN as a string, even if it is a\n\
keyword like `match' or an operator like `/'\n\
\n\
( EXPRESSION ) value of EXPRESSION\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Beware that many operators need to be escaped or quoted for shells.\n\
Comparisons are arithmetic if both ARGs are numbers, else lexicographical.\n\
Pattern matches return the string matched between \\( and \\) or null; if\n\
\\( and \\) are not used, they return the number of characters matched or 0.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -76,15 +76,17 @@ Usage: %s [NUMBER]...\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Print the prime factors of each NUMBER.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
Print the prime factors of all specified integer NUMBERs. If no arguments\n\
are specified on the command line, they are read from standard input.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* print the hexadecimal identifier for the current host
Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -49,12 +49,11 @@ usage (int status)
Usage: %s\n\
or: %s OPTION\n\
Print the numeric identifier (in hexadecimal) for the current host.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
"),
program_name, program_name);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* hostname - set or print the name of current host system
Copyright (C) 1994-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1994-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -69,10 +69,10 @@ Usage: %s [NAME]\n\
or: %s OPTION\n\
Print or set the hostname of the current system.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
")
, program_name, program_name);
"),
program_name, program_name);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* id -- print real and effective UIDs and GIDs
Copyright (C) 1989-2000 Free Software Foundation, Inc.
Copyright (C) 1989-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -85,7 +85,7 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [USERNAME]\n"), program_name);
printf (_("\
fputs (_("\
Print information for USERNAME, or the current user.\n\
\n\
-a ignore, for compatibility with other versions\n\
@@ -94,11 +94,13 @@ Print information for USERNAME, or the current user.\n\
-n, --name print a name instead of a number, for -ugG\n\
-r, --real print the real ID instead of the effective ID, with -ugG\n\
-u, --user print only the effective user ID\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
Without any OPTION, print some useful set of identified information.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -172,8 +172,6 @@ by whitespace. When FILE1 or FILE2 (not both) is -, read standard input.\n\
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
"), stdout);
fputs (_("\
Unless -t CHAR is given, leading blanks separate fields and are ignored,\n\
else fields are separated by CHAR. Any FIELD is a field number counted\n\
from 1. FORMAT is one or more comma or blank separated specifications,\n\

768
src/kill.c Normal file
View File

@@ -0,0 +1,768 @@
/* kill -- send a signal to a process
Copyright (C) 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Marcus Brinkmann. */
#include <config.h>
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>
#include "system.h"
#include "closeout.h"
#include "human.h"
#include "error.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "kill"
#define AUTHORS "Marcus Brinkmann"
/* An invalid signal number. */
#define NO_SIG -1
/* A structure holding the number and the name of a signal. */
struct sigspec
{
int signum;
char *signame;
};
/* The list of signals was taken from bash 2.05. The best name for a
signal comes after any possible alias, so it is read it from back
to front. This is why the terminating null entry comes first. */
static struct sigspec sigspecs[] =
{
{ NO_SIG, NULL },
/* Null is used to test for the existance and ownership of a PID. */
{ 0, "0" },
/* AIX */
#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
{ SIGLOST, "LOST" },
#endif
#if defined (SIGMSG) /* HFT input data pending */
{ SIGMSG, "MSG" },
#endif
#if defined (SIGDANGER) /* system crash imminent */
{ SIGDANGER, "DANGER" },
#endif
#if defined (SIGMIGRATE) /* migrate process to another CPU */
{ SIGMIGRATE, "MIGRATE" },
#endif
#if defined (SIGPRE) /* programming error */
{ SIGPRE, "PRE" },
#endif
#if defined (SIGVIRT) /* AIX virtual time alarm */
{ SIGVIRT, "VIRT" },
#endif
#if defined (SIGALRM1) /* m:n condition variables */
{ SIGALRM1, "ALRM1" },
#endif
#if defined (SIGWAITING) /* m:n scheduling */
{ SIGWAITING, "WAITING" },
#endif
#if defined (SIGGRANT) /* HFT monitor mode granted */
{ SIGGRANT, "GRANT" },
#endif
#if defined (SIGKAP) /* keep alive poll from native keyboard */
{ SIGKAP, "KAP" },
#endif
#if defined (SIGRETRACT) /* HFT monitor mode retracted */
{ SIGRETRACT, "RETRACT" },
#endif
#if defined (SIGSOUND) /* HFT sound sequence has completed */
{ SIGSOUND, "SOUND" },
#endif
#if defined (SIGSAK) /* Secure Attention Key */
{ SIGSAK, "SAK" },
#endif
/* SunOS5 */
#if defined (SIGLWP) /* special signal used by thread library */
{ SIGLWP, "LWP" },
#endif
#if defined (SIGFREEZE) /* special signal used by CPR */
{ SIGFREEZE, "FREEZE" },
#endif
#if defined (SIGTHAW) /* special signal used by CPR */
{ SIGTHAW, "THAW" },
#endif
#if defined (SIGCANCEL) /* thread cancellation signal used by libthread */
{ SIGCANCEL, "CANCEL" },
#endif
/* HP-UX */
#if defined (SIGDIL) /* DIL signal (?) */
{ SIGDIL, "DIL" },
#endif
/* System V */
#if defined (SIGCLD) /* Like SIGCHLD. */
{ SIGCLD, "CLD" },
#endif
#if defined (SIGPWR) /* power state indication */
{ SIGPWR, "PWR" },
#endif
#if defined (SIGPOLL) /* Pollable event (for streams) */
{ SIGPOLL, "POLL" },
#endif
/* Unknown */
#if defined (SIGWINDOW)
{ SIGWINDOW, "WINDOW" },
#endif
/* Common */
#if defined (SIGHUP) /* hangup */
{ SIGHUP, "HUP" },
#endif
#if defined (SIGINT) /* interrupt */
{ SIGINT, "INT" },
#endif
#if defined (SIGQUIT) /* quit */
{ SIGQUIT, "QUIT" },
#endif
#if defined (SIGILL) /* illegal instruction (not reset when caught) */
{ SIGILL, "ILL" },
#endif
#if defined (SIGTRAP) /* trace trap (not reset when caught) */
{ SIGTRAP, "TRAP" },
#endif
#if defined (SIGIOT) /* IOT instruction */
{ SIGIOT, "IOT" },
#endif
#if defined (SIGABRT) /* Cause current process to dump core. */
{ SIGABRT, "ABRT" },
#endif
#if defined (SIGEMT) /* EMT instruction */
{ SIGEMT, "EMT" },
#endif
#if defined (SIGFPE) /* floating point exception */
{ SIGFPE, "FPE" },
#endif
#if defined (SIGKILL) /* kill (cannot be caught or ignored) */
{ SIGKILL, "KILL" },
#endif
#if defined (SIGBUS) /* bus error */
{ SIGBUS, "BUS" },
#endif
#if defined (SIGSEGV) /* segmentation violation */
{ SIGSEGV, "SEGV" },
#endif
#if defined (SIGSYS) /* bad argument to system call */
{ SIGSYS, "SYS" },
#endif
#if defined (SIGPIPE) /* write on a pipe with no one to read it */
{ SIGPIPE, "PIPE" },
#endif
#if defined (SIGALRM) /* alarm clock */
{ SIGALRM, "ALRM" },
#endif
#if defined (SIGTERM) /* software termination signal from kill */
{ SIGTERM, "TERM" },
#endif
#if defined (SIGURG) /* urgent condition on IO channel */
{ SIGURG, "URG" },
#endif
#if defined (SIGSTOP) /* sendable stop signal not from tty */
{ SIGSTOP, "STOP" },
#endif
#if defined (SIGTSTP) /* stop signal from tty */
{ SIGTSTP, "TSTP" },
#endif
#if defined (SIGCONT) /* continue a stopped process */
{ SIGCONT, "CONT" },
#endif
#if defined (SIGCHLD) /* to parent on child stop or exit */
{ SIGCHLD, "CHLD" },
#endif
#if defined (SIGTTIN) /* to readers pgrp upon background tty read */
{ SIGTTIN, "TTIN" },
#endif
#if defined (SIGTTOU) /* like TTIN for output if (tp->t_local&LTOSTOP) */
{ SIGTTOU, "TTOU" },
#endif
#if defined (SIGIO) /* input/output possible signal */
{ SIGIO, "IO" },
#endif
#if defined (SIGXCPU) /* exceeded CPU time limit */
{ SIGXCPU, "XCPU" },
#endif
#if defined (SIGXFSZ) /* exceeded file size limit */
{ SIGXFSZ, "XFSZ" },
#endif
#if defined (SIGVTALRM) /* virtual time alarm */
{ SIGVTALRM, "VTALRM" },
#endif
#if defined (SIGPROF) /* profiling time alarm */
{ SIGPROF, "PROF" },
#endif
#if defined (SIGWINCH) /* window changed */
{ SIGWINCH, "WINCH" },
#endif
/* 4.4 BSD */
#if defined (SIGINFO) && !defined (_SEQUENT_) /* information request */
{ SIGINFO, "INFO" },
#endif
#if defined (SIGUSR1) /* user defined signal 1 */
{ SIGUSR1, "USR1" },
#endif
#if defined (SIGUSR2) /* user defined signal 2 */
{ SIGUSR2, "USR2" },
#endif
#if defined (SIGKILLTHR) /* BeOS: Kill Thread */
{ SIGKILLTHR, "KILLTHR" }
#endif
};
/* The last entry of the complete signal list, including real time
signals. */
struct sigspec *sigspecs_last;
/* The number of sigspecs in the list. */
int sigspecs_size;
/* The number of digits in NSIG (approx.). */
int nsig_digits;
/* The name this program was run with, for error messages. */
char *program_name;
/* All options which require an argument are known to the
pre-scan loop in main(). */
#define OPT_SIGSPEC_LONG "sigspec"
#define OPT_SIGNUM_LONG "signum"
static struct option const long_options[] =
{
{"list", no_argument, NULL, 'l'},
{"long-list", no_argument, NULL, 'L'},
{OPT_SIGSPEC_LONG, required_argument, NULL, 's'},
{OPT_SIGNUM_LONG, required_argument, NULL, 'n'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
void
usage (int status)
{
if (status != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("\
Usage: %s [-s SIGSPEC | -n SIGNUM | -SIGSPEC] PID ...\n\
or: %s -l [SIGSPEC] ...\n\
"),
program_name, program_name);
fputs (_("\
Send the signal named by SIGSPEC or SIGNUM to processes named by PID.\n\
\n\
-s, --" OPT_SIGSPEC_LONG " SIGSPEC name or number of signal to be sent\n\
-n, --" OPT_SIGNUM_LONG " SIGNUM number of signal to be sent\n\
\n\
-l, --list list the signal names\n\
-L, --long-list list the signal names with their numbers\n\
\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
kill returns true if at least one signal was successfully sent, or\n\
false if an error occurs or an invalid option is encountered.\n\
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);
}
/* The function is called once before option parsing. It calculates
the maximum number of digits in a signum, adds the realtime signal
specs to the signal list, and adds all signals of the form -SIGTERM
and -TERM as possible options. */
static void
initialize (void)
{
char number[LONGEST_HUMAN_READABLE + 1];
struct sigspec *newspecs;
nsig_digits = strlen (human_readable ((uintmax_t) NSIG, number, 1, 1));
sigspecs_size = sizeof (sigspecs) / sizeof (struct sigspec);
#if defined (SIGRTMIN) || defined (SIGRTMAX)
/* POSIX 1003.1b-1993 defines real time signals. The following code
is so convoluted because it also takes care of incomplete
implementations. */
# ifndef SIGRTMIN
# define SIGRTMIN SIGRTMAX
# endif
# ifndef SIGRTMAX
# define SIGRTMAX SIGRTMIN
# endif
/* Sanity check. */
if (SIGRTMAX >= SIGRTMIN)
{
int rtsigc = SIGRTMAX - SIGRTMIN + 1;
int i;
/* Account for "RTMIN+" resp "RTMAX-", the number and '\0'. */
int maxlength = nsig_digits + 6 + 1;
newspecs = xmalloc (sizeof (struct sigspec)
* (sigspecs_size + rtsigc));
/* After this, newspecs will always point to the last element of
the array. */
newspecs->signum = NO_SIG;
newspecs->signame = NULL;
(++newspecs)->signum = SIGRTMAX;
newspecs->signame = "RTMAX";
if (rtsigc > 1)
{
(++newspecs)->signum = SIGRTMIN;
newspecs->signame = "RTMIN";
}
/* Create new elements for all missing realtime signals. */
for (i = 0; i < rtsigc - 2; i++)
{
(++newspecs)->signum = SIGRTMIN + 1 + i;
newspecs->signame = xmalloc (maxlength);
snprintf (newspecs->signame, maxlength, "%s%d",
(i < (rtsigc - 2)/2
? "RTMIN+" : "RTMAX-"),
(i < (rtsigc - 2)/2
? i + 1 : (rtsigc - 2) - i));
}
/* Copy the existing elements in the following space. */
for (i = 1; i < sigspecs_size; i++)
*(++newspecs) = sigspecs[i];
sigspecs_last = newspecs;
sigspecs_size += rtsigc;
}
#else
sigspecs_last = sigspecs + (sigspecs_size - 1);
#endif
}
typedef enum { LIST_NONE, LIST_FLAT, LIST_PRETTY } list_t;
/* Print out a table listing all signals specifications with their
preferred name. */
static void
list_signals (list_t type)
{
int i = 0;
int entrylen = 0;
int unsorted;
int entries;
int last_signum = NO_SIG;
int column = 0;
struct sigspec *spec = sigspecs_last;
struct sigspec **specs = xmalloc (sizeof (struct sigspec *)
* (sigspecs_size - 1));
/* Gather maximum name length and prepare sort array. Note that the
list is reversed in the array. This is taken into account by the
output routine below. */
while (spec->signum != NO_SIG)
{
specs[i++] = spec;
if (spec->signame && strlen (spec->signame) > entrylen)
entrylen = strlen (spec->signame);
spec--;
}
/* Sort the array by signal number. This is a simple bubble sort,
but the point is that the order of entries with the same signum
is presevered (otherwise the preferred alias is lost). */
if (sigspecs_size > 2)
do
{
unsorted = 0;
for (i = 0; i < sigspecs_size - 2; i++)
{
if (specs[i]->signum > specs[i+1]->signum)
{
struct sigspec *saved = specs[i];
specs[i] = specs[i+1];
specs[i+1] = saved;
unsorted = 1;
}
}
}
while (unsorted);
/* Account for "NR) NAME ". Calculate for 79 columns, the 80 takes
into account that the last entry is not followed by a space. */
entrylen += nsig_digits + 2 + 1;
entries = 80 / entrylen;
if (entries < 1)
entries = 1;
for (i = 0; i < sigspecs_size - 1; i++)
{
/* Skip duplicated signal numbers, signums without name and the
special signal number `0'. */
if (specs[i]->signame && specs[i]->signum
&& (last_signum == NO_SIG || last_signum != specs[i]->signum))
{
switch (type)
{
case LIST_PRETTY:
column++;
printf ("%*i) %-*s", nsig_digits, specs[i]->signum,
entrylen - nsig_digits - 2 + (column != entries ? 1 : 0),
specs[i]->signame);
if (column == entries - 1)
{
column = 0;
putchar ('\n');
}
break;
case LIST_FLAT:
column += printf ("%s%s",
(column == 0 ? ""
: (column + strlen (specs[i]->signame) > 78
? "\n" : " ")),
specs[i]->signame);
if (column > 79)
column = strlen (specs[i]->signame);
break;
default:
break;
}
last_signum = specs[i]->signum;
}
if (i == sigspecs_size - 2)
putchar ('\n');
}
}
/* Turn a string into a signal number, or a number into a signal
number. If STRING is "2", or "INT", then return the integer 2.
Return NO_SIG if STRING doesn't contain a valid signal
descriptor. */
static int
decode_signal (char const *sigspec)
{
struct sigspec const *spec = sigspecs_last;
long l;
if (xstrtol (sigspec, NULL, 0, &l, "") == LONGINT_OK)
{
int sig = l;
if (sig != l)
return NO_SIG;
while (spec->signum != NO_SIG && spec->signum != sig)
spec--;
return spec->signum;
}
/* A leading `SIG' may be omitted. */
while (spec->signum != NO_SIG)
{
if (spec->signame
&& (strcasecmp (sigspec, spec->signame) == 0
|| (strncasecmp (sigspec, "SIG", 3) == 0
&& strcasecmp (sigspec + 3, spec->signame) == 0)))
return (spec->signum);
spec--;
}
return NO_SIG;
}
/* Find the preferred name for the signal with the number SIGNUM. */
static char const *const
name_signal (int signum)
{
struct sigspec const *spec = sigspecs_last;
while (spec->signum != NO_SIG && spec->signum != signum)
spec--;
return spec->signame;
}
/* Send the signal SIGNUM to process PID, using kill (). If an error
occurs, it is reported and passed through to the caller. */
static int
send_signal (pid_t pid, int signum)
{
int err;
err = kill (pid, signum);
if (err)
{
uintmax_t nr = (uintmax_t) (pid < 0 ? -pid : pid);
char number[LONGEST_HUMAN_READABLE + 1];
error (0, errno, "(%s%s)", (pid < 0 ? "-" : ""),
human_readable (nr, number, 1, 1));
}
return err;
}
int
main (int argc, char **argv)
{
int optc;
int err = 0;
int success = 0;
list_t list = LIST_NONE;
int sig_num = NO_SIG;
int i;
char **extra_opt;
int extra_opt_size = 0;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
initialize ();
extra_opt = xmalloc ((argc - 1) * sizeof (char *));
for (i = 1; i < argc; i++)
{
intmax_t dummy;
/* getopt will ignore everything following `--', so we do as
well. */
if (!strcmp ("--", argv[i]))
break;
/* Skip this argument if it doesn't look like an option. */
if (argv[i][0] != '-')
continue;
/* Skip it if it follows an option requiring an argument. */
if (i > 1 && argv[i-1][0] == '-')
{
/* A short option that doesn't look like -nTERM. */
if ((argv[i-1][1] == 'n' || argv[i-1][1] == 's')
&& argv[i-1][2] == '\0')
continue;
/* A long option (not `--', which was excluded above). */
if (argv[i-1][1] == '-'
&& (!strncmp (OPT_SIGNUM_LONG, &(argv[i-1][2]),
strlen (&argv[i-1][2]))
|| !strncmp (OPT_SIGSPEC_LONG, &(argv[i-1][2]),
strlen (&argv[i-1][2]))))
continue;
}
/* At this point we know that this argument is not argument to
another option, and that it starts with `-' but is not `--'. */
if (decode_signal (&(argv[i][1])) != NO_SIG
|| xstrtoimax (argv[i], NULL, 10, &dummy, "") == LONGINT_OK)
{
/* It is either a valid signal specifier or potentially a
valid process group. So remember it and make getopt not
care about it. */
extra_opt[extra_opt_size++] = argv[i];
argv[i][0] = 'X';
}
}
while ((optc = getopt_long (argc, argv, "s:n:lL", long_options, NULL))
!= -1)
switch (optc)
{
case 's':
case 'n':
if (sig_num != NO_SIG)
{
error (0, 0, _("%s: only one signal specififier allowed"), optarg);
usage (1);
}
sig_num = decode_signal (optarg);
if (sig_num == NO_SIG)
error (1, 0, _("%s: invalid signal specifier"), optarg);
break;
case 'l':
list = LIST_FLAT;
break;
case 'L':
list = LIST_PRETTY;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}
argc -= optind;
argv += optind;
for (i = 0; i < extra_opt_size; i++)
extra_opt[i][0] = '-';
if (extra_opt_size > 0 && sig_num == NO_SIG)
{
char **arg = argv;
/* Find the first extra option collected in the remaining
argument list and if necessary, replace it with the first
remaining argument. This is a precaution in case getopt()
mangles the order of non-option arguments. */
while (*arg && *arg != extra_opt[0])
arg++;
if (*arg && *arg != argv[0])
*arg = argv[0];
argc--;
argv++;
/* Interpret the first one as a signal specifier. */
sig_num = decode_signal (&(extra_opt[0][1]));
if (sig_num == NO_SIG)
error (1, 0, _("%s: invalid signal specifier"), extra_opt[0]);
}
if (!list && sig_num == NO_SIG)
sig_num = SIGTERM;
if (argc == 0)
{
if (list)
list_signals (list);
else
{
error (0, 0, _("too few arguments"));
usage (1);
}
}
else
{
int j;
for (j = 0; j < argc; j++)
if (list)
{
int signum = decode_signal (argv[j]);
if (signum == NO_SIG)
{
error (0, 0, _("%s: invalid signal specifier"), argv[j]);
err = 1;
}
else
{
char const *const name = name_signal (signum);
printf ("%s\n", name ? name : "(unknown)");
success = 1;
}
}
else
{
intmax_t nr;
pid_t pid;
int inval = 0;
if (xstrtoimax (argv[j], NULL, 10, &nr, "") != LONGINT_OK)
inval = 1;
pid = (pid_t) nr;
if (inval || pid != nr)
{
error (0, 0, _("%s: invalid process id"), argv[j]);
err = 1;
continue;
}
if (send_signal (pid, sig_num))
err = 1;
else
success = 1;
}
}
exit ((success || !err) ? 0 : 1);
}

View File

@@ -1,5 +1,5 @@
/* logname -- print user's login name
Copyright (C) 1990-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,12 +46,12 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]\n"), program_name);
printf (_("\
fputs (_("\
Print the name of the current user.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -147,10 +147,8 @@ The following two options are useful only when verifying checksums:\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
"), stdout);
printf (_("\
\n\
The sums are computed as described in %s. When checking, the input\n\
should be a former output of this program. The default mode is to print\n\
a line with checksum, a character indicating type (`*' for binary, ` ' for\n\

View File

@@ -1,5 +1,5 @@
/* nice -- run a program with modified scheduling priority
Copyright (C) 1990-2000 Free Software Foundation, Inc.
Copyright (C) 1990-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -64,15 +64,16 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION] [COMMAND [ARG]...]\n"), program_name);
printf (_("\
fputs (_("\
Run COMMAND with an adjusted scheduling priority.\n\
With no COMMAND, print the current scheduling priority. ADJUST is 10\n\
by default. Range goes from -20 (highest priority) to 19 (lowest).\n\
\n\
-ADJUST increment priority by ADJUST first\n\
-n, --adjustment=ADJUST same as -ADJUST\n\
--help display this help and exit\n\
--version output version information and exit\n"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -334,21 +334,24 @@ TYPE is made up of one or more of these specifications:\n\
o[SIZE] octal, SIZE bytes per integer\n\
u[SIZE] unsigned decimal, SIZE bytes per integer\n\
x[SIZE] hexadecimal, SIZE bytes per integer\n\
"), stdout);
fputs (_("\
\n\
SIZE is a number. For TYPE in doux, SIZE may also be C for\n\
sizeof(char), S for sizeof(short), I for sizeof(int) or L for\n\
"), stdout);
fputs (_("\
sizeof(long). If TYPE is f, SIZE may also be F for sizeof(float), D\n\
for sizeof(double) or L for sizeof(long double).\n\
"), stdout);
fputs (_("\
\n\
RADIX is d for decimal, o for octal, x for hexadecimal or n for none.\n\
BYTES is hexadecimal with 0x or 0X prefix, it is multiplied by 512\n\
"), stdout);
fputs (_("\
with b suffix, by 1024 with k and by 1048576 with m. Adding a z suffix to\n\
any type adds a display of printable characters to the end of each line\n\
of output. -s without a number implies 3. -w without a number implies 32.\n\
of output. \
"), stdout);
fputs (_("\
-s without a number implies 3. -w without a number implies 32.\n\
By default, od uses -A o -t d2 -w 16.\n\
"), stdout);
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));

View File

@@ -420,9 +420,6 @@ Mandatory arguments to long options are mandatory for short options too.\n\
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
/* FIXME: add a couple of examples. */
fputs (_("\
\n\
"), stdout);
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);

View File

@@ -138,13 +138,13 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... NAME...\n"), program_name);
printf (_("\
fputs (_("\
Diagnose unportable constructs in NAME.\n\
\n\
-p, --portability check for all POSIX systems, not only this one\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -467,20 +467,24 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [USER]...\n"), program_name);
printf (_("\
fputs (_("\
\n\
-l produce long format output for the specified USERs\n\
-b omit the user's home directory and shell in long format\n\
-h omit the user's project file in long format\n\
-p omit the user's plan file in long format\n\
-s do short format output, this is the default\n\
"), stdout);
fputs (_("\
-f omit the line of column headings in short format\n\
-w omit the user's full name in short format\n\
-i omit the user's full name and remote host in short format\n\
-q omit the user's full name, remote host and idle time\n\
in short format\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (_("\
\n\
A lightweight `finger' program; print user information.\n\
The utmp file will be %s.\n\

View File

@@ -1,5 +1,5 @@
/* printenv -- print all or part of environment
Copyright (C) 1989-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -65,10 +65,10 @@ Usage: %s [VARIABLE]...\n\
or: %s OPTION\n\
If no environment VARIABLE specified, print them all.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"),
program_name, program_name);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -99,35 +99,45 @@ Usage: %s FORMAT [ARGUMENT]...\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Print ARGUMENT(s) according to FORMAT.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
FORMAT controls the output as in C printf. Interpreted sequences are:\n\
\n\
\\\" double quote\n\
\\0NNN character with octal value NNN (0 to 3 digits)\n\
\\\\ backslash\n\
"), stdout);
fputs (_("\
\\a alert (BEL)\n\
\\b backspace\n\
\\c produce no further output\n\
\\f form feed\n\
"), stdout);
fputs (_("\
\\n new line\n\
\\r carriage return\n\
\\t horizontal tab\n\
\\v vertical tab\n\
"), stdout);
fputs (_("\
\\xNNN byte with hexadecimal value NNN (1 to 3 digits)\n\
\n\
\\uNNNN character with hexadecimal value NNNN (4 digits)\n\
\\UNNNNNNNN character with hexadecimal value NNNNNNNN (8 digits)\n\
%%%% a single %%\n\
%%b ARGUMENT as a string with `\\' escapes interpreted\n\
"), stdout);
fputs (_("\
%% a single %\n\
%b ARGUMENT as a string with `\\' escapes interpreted\n\
\n\
and all C format specifications ending with one of diouxXfeEgGcs, with\n\
ARGUMENTs converted to proper type first. Variable widths are handled.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* pwd - print current directory
Copyright (C) 1994-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1994-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,12 +45,12 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]\n"), program_name);
printf (_("\
fputs (_("\
Print the full filename of the current working directory.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* seq - print sequence of numbers to standard output.
Copyright (C) 1994-2000 Free Software Foundation, Inc.
Copyright (C) 1994-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -84,21 +84,23 @@ Usage: %s [OPTION]... LAST\n\
or: %s [OPTION]... FIRST LAST\n\
or: %s [OPTION]... FIRST INCREMENT LAST\n\
"), program_name, program_name, program_name);
printf (_("\
fputs (_("\
Print numbers from FIRST to LAST, in steps of INCREMENT.\n\
\n\
-f, --format FORMAT use printf(3) style FORMAT (default: %%g)\n\
-f, --format FORMAT use printf(3) style FORMAT (default: %g)\n\
-s, --separator STRING use STRING to separate numbers (default: \\n)\n\
-w, --equal-width equalize width by padding with leading zeroes\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
If FIRST or INCREMENT is omitted, it defaults to 1.\n\
FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
INCREMENT should be positive if FIRST is smaller than LAST, and negative\n\
otherwise. When given, the FORMAT argument must contain exactly one of\n\
the printf-style, floating point output formats %%e, %%f, %%g\n\
"));
the printf-style, floating point output formats %e, %f, %g\n\
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* sleep - delay for a specified amount of time.
Copyright (C) 84, 1991-1997, 1999-2000 Free Software Foundation, Inc.
Copyright (C) 84, 1991-1997, 1999-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -76,10 +76,10 @@ Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default),\n\
that require NUMBER be an integer, here NUMBER may be an arbitrary floating\n\
point number.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"),
program_name, program_name);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -13,7 +13,7 @@
#include <getopt.h>
#include "error.h"
#include "filemode.h"
#include "fs.h"
#include "gs.h"
#include "quotearg.h"
#include "system.h"
#include "xreadlink.h"
@@ -38,6 +38,7 @@ static void
do_statfs (char const *filename, int terse)
{
struct statfs statfsbuf;
char const *name;
if (statfs (filename, &statfsbuf) == -1)
{
@@ -77,86 +78,12 @@ do_statfs (char const *filename, int terse)
statfsbuf.f_fsid.__val[1], statfsbuf.f_namelen);
#endif
switch (statfsbuf.f_type)
{
case AFFS_SUPER_MAGIC:
printf ("AFFS\n");
break;
case EXT_SUPER_MAGIC:
printf ("EXT\n");
break;
case EXT2_OLD_SUPER_MAGIC:
printf ("EXT2\n");
break;
case EXT2_SUPER_MAGIC:
printf ("EXT2\n");
break;
case HPFS_SUPER_MAGIC:
printf ("HPFS\n");
break;
case ISOFS_SUPER_MAGIC:
printf ("ISOFS\n");
break;
case MINIX_SUPER_MAGIC:
printf ("MINIX\n");
case MINIX_SUPER_MAGIC2:
printf ("MINIX (30 char.)\n");
break;
case MINIX2_SUPER_MAGIC:
printf ("MINIX V2\n");
break;
case MINIX2_SUPER_MAGIC2:
printf ("MINIX V2 (30 char.)\n");
break;
case MSDOS_SUPER_MAGIC:
printf ("MSDOS\n");
break;
case NCP_SUPER_MAGIC:
printf ("NOVELL\n");
break;
case NFS_SUPER_MAGIC:
printf ("NFS\n");
break;
case PROC_SUPER_MAGIC:
printf ("PROC\n");
break;
case SMB_SUPER_MAGIC:
printf ("SMB\n");
break;
case XENIX_SUPER_MAGIC:
printf ("XENIX\n");
break;
case SYSV4_SUPER_MAGIC:
printf ("SYSV4\n");
break;
case SYSV2_SUPER_MAGIC:
printf ("SYSV2\n");
break;
case COH_SUPER_MAGIC:
printf ("COH\n");
break;
case UFS_MAGIC:
printf ("UFS\n");
break;
case _XIAFS_SUPER_MAGIC:
printf ("XIA\n");
break;
case NTFS_SUPER_MAGIC:
printf ("NTFS\n");
break;
case TMPFS_MAGIC:
printf ("TMPFS\n");
break;
case REISERFS_MAGIC:
printf ("TMPFS\n");
break;
default:
#ifdef __USE_FILE_OFFSET64
printf ("UNKNOWN (0x%lx)\n", statfsbuf.f_type);
#else
printf ("UNKNOWN (0x%x)\n", statfsbuf.f_type);
#endif
}
name = fs_name (statfsbuf.f_type);
if (name)
printf ("%s\n", name);
else
printf ("UNKNOWN (0x%lx)\n", (long) statfsbuf.f_type);
#ifdef __USE_FILE_OFFSET64
printf
("Blocks: Total: %-10lld Free: %-10lld Available: %-10lld Size:%ld \n",

View File

@@ -1,5 +1,5 @@
/* stty -- change and print terminal line settings
Copyright (C) 1990-2000 Free Software Foundation, Inc.
Copyright (C) 1990-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -504,170 +504,210 @@ Usage: %s [-F DEVICE] [--file=DEVICE] [SETTING]...\n\
or: %s [-F DEVICE] [--file=DEVICE] [-g|--save]\n\
"),
program_name, program_name, program_name);
printf (_("\
fputs (_("\
Print or change terminal characteristics.\n\
\n\
-a, --all print all current settings in human-readable form\n\
-g, --save print all current settings in a stty-readable form\n\
-F, --file=DEVICE open and use the specified DEVICE instead of stdin\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
Optional - before SETTING indicates negation. An * marks non-POSIX\n\
settings. The underlying system defines which settings are available.\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Special characters:\n\
* dsusp CHAR CHAR will send a terminal stop signal once input flushed\n\
eof CHAR CHAR will send an end of file (terminate the input)\n\
eol CHAR CHAR will end the line\n\
"), stdout);
fputs (_("\
* eol2 CHAR alternate CHAR for ending the line\n\
erase CHAR CHAR will erase the last character typed\n\
intr CHAR CHAR will send an interrupt signal\n\
kill CHAR CHAR will erase the current line\n\
"), stdout);
fputs (_("\
* lnext CHAR CHAR will enter the next character quoted\n\
quit CHAR CHAR will send a quit signal\n\
* rprnt CHAR CHAR will redraw the current line\n\
start CHAR CHAR will restart the output after stopping it\n\
"), stdout);
fputs (_("\
stop CHAR CHAR will stop the output\n\
susp CHAR CHAR will send a terminal stop signal\n\
* swtch CHAR CHAR will switch to a different shell layer\n\
* werase CHAR CHAR will erase the last word typed\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Special settings:\n\
N set the input and output speeds to N bauds\n\
* cols N tell the kernel that the terminal has N columns\n\
* columns N same as cols N\n\
"), stdout);
fputs (_("\
ispeed N set the input speed to N\n\
* line N use line discipline N\n\
min N with -icanon, set N characters minimum for a completed read\n\
ospeed N set the output speed to N\n\
"), stdout);
fputs (_("\
* rows N tell the kernel that the terminal has N rows\n\
* size print the number of rows and columns according to the kernel\n\
speed print the terminal speed\n\
time N with -icanon, set read timeout of N tenths of a second\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Control settings:\n\
[-]clocal disable modem control signals\n\
[-]cread allow input to be received\n\
* [-]crtscts enable RTS/CTS handshaking\n\
csN set character size to N bits, N in [5..8]\n\
"), stdout);
fputs (_("\
[-]cstopb use two stop bits per character (one with `-')\n\
[-]hup send a hangup signal when the last process closes the tty\n\
[-]hupcl same as [-]hup\n\
[-]parenb generate parity bit in output and expect parity bit in input\n\
[-]parodd set odd parity (even with `-')\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Input settings:\n\
[-]brkint breaks cause an interrupt signal\n\
[-]icrnl translate carriage return to newline\n\
[-]ignbrk ignore break characters\n\
[-]igncr ignore carriage return\n\
"), stdout);
fputs (_("\
[-]ignpar ignore characters with parity errors\n\
* [-]imaxbel beep and do not flush a full input buffer on a character\n\
[-]inlcr translate newline to carriage return\n\
[-]inpck enable input parity checking\n\
[-]istrip clear high (8th) bit of input characters\n\
"), stdout);
fputs (_("\
* [-]iuclc translate uppercase characters to lowercase\n\
* [-]ixany let any character restart output, not only start character\n\
[-]ixoff enable sending of start/stop characters\n\
[-]ixon enable XON/XOFF flow control\n\
[-]parmrk mark parity errors (with a 255-0-character sequence)\n\
[-]tandem same as [-]ixoff\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Output settings:\n\
* bsN backspace delay style, N in [0..1]\n\
* crN carriage return delay style, N in [0..3]\n\
* ffN form feed delay style, N in [0..1]\n\
* nlN newline delay style, N in [0..1]\n\
"), stdout);
fputs (_("\
* [-]ocrnl translate carriage return to newline\n\
* [-]ofdel use delete characters for fill instead of null characters\n\
* [-]ofill use fill (padding) characters instead of timing for delays\n\
* [-]olcuc translate lowercase characters to uppercase\n\
* [-]onlcr translate newline to carriage return-newline\n\
* [-]onlret newline performs a carriage return\n\
"), stdout);
fputs (_("\
* [-]onocr do not print carriage returns in the first column\n\
[-]opost postprocess output\n\
* tabN horizontal tab delay style, N in [0..3]\n\
* tabs same as tab0\n\
* -tabs same as tab3\n\
* vtN vertical tab delay style, N in [0..1]\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Local settings:\n\
[-]crterase echo erase characters as backspace-space-backspace\n\
* crtkill kill all line by obeying the echoprt and echoe settings\n\
* -crtkill kill all line by obeying the echoctl and echok settings\n\
"), stdout);
fputs (_("\
* [-]ctlecho echo control characters in hat notation (`^c')\n\
[-]echo echo input characters\n\
* [-]echoctl same as [-]ctlecho\n\
[-]echoe same as [-]crterase\n\
[-]echok echo a newline after a kill character\n\
"), stdout);
fputs (_("\
* [-]echoke same as [-]crtkill\n\
[-]echonl echo newline even if not echoing other characters\n\
* [-]echoprt echo erased characters backward, between `\\' and '/'\n\
[-]icanon enable erase, kill, werase, and rprnt special characters\n\
[-]iexten enable non-POSIX special characters\n\
"), stdout);
fputs (_("\
[-]isig enable interrupt, quit, and suspend special characters\n\
[-]noflsh disable flushing after interrupt and quit special characters\n\
* [-]prterase same as [-]echoprt\n\
* [-]tostop stop background jobs that try to write to the terminal\n\
* [-]xcase with icanon, escape with `\\' for uppercase characters\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Combination settings:\n\
* [-]LCASE same as [-]lcase\n\
cbreak same as -icanon\n\
-cbreak same as icanon\n\
"), stdout);
fputs (_("\
cooked same as brkint ignpar istrip icrnl ixon opost isig\n\
icanon, eof and eol characters to their default values\n\
-cooked same as raw\n\
crt same as echoe echoctl echoke\n\
"), stdout);
fputs (_("\
dec same as echoe echoctl echoke -ixany intr ^c erase 0177\n\
kill ^u\n\
* [-]decctlq same as [-]ixany\n\
ek erase and kill characters to their default values\n\
evenp same as parenb -parodd cs7\n\
"), stdout);
fputs (_("\
-evenp same as -parenb cs8\n\
* [-]lcase same as xcase iuclc olcuc\n\
litout same as -parenb -istrip -opost cs8\n\
-litout same as parenb istrip opost cs7\n\
nl same as -icrnl -onlcr\n\
-nl same as icrnl -inlcr -igncr onlcr -ocrnl -onlret\n\
"), stdout);
fputs (_("\
oddp same as parenb parodd cs7\n\
-oddp same as -parenb cs8\n\
[-]parity same as [-]evenp\n\
pass8 same as -parenb -istrip cs8\n\
-pass8 same as parenb istrip cs7\n\
"), stdout);
fputs (_("\
raw same as -ignbrk -brkint -ignpar -parmrk -inpck -istrip\n\
-inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany\n\
-imaxbel -opost -isig -icanon -xcase min 1 time 0\n\
-raw same as cooked\n\
"), stdout);
fputs (_("\
sane same as cread -ignbrk brkint -inlcr -igncr icrnl\n\
-ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr\n\
-onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\n\
isig icanon iexten echo echoe echok -echonl -noflsh\n\
-xcase -tostop -echoprt echoctl echoke, all special\n\
characters to their default values.\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Handle the tty line connected to standard input. Without arguments,\n\
prints baud rate, line discipline, and deviations from stty sane. In\n\
settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or\n\
127; special values ^- or undef used to disable special characters.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -431,7 +431,7 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
printf (_("\
fputs (_("\
Change the effective user id and group id to that of USER.\n\
\n\
-, -l, --login make the shell a login shell\n\
@@ -440,11 +440,13 @@ Change the effective user id and group id to that of USER.\n\
-m, --preserve-environment do not reset environment variables\n\
-p same as -m\n\
-s, --shell=SHELL run SHELL if /etc/shells allows it\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
A mere - implies -l. If USER not given, assume root.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
close_stdout ();
}

View File

@@ -285,19 +285,26 @@ Mandatory arguments to long options are mandatory for short options too.\n\
If the first character of N (the number of bytes or lines) is a `+',\n\
print beginning with the Nth item from the start of each file, otherwise,\n\
print the last N items in the file. N may have a multiplier suffix:\n\
b for 512, k for 1024, m for 1048576 (1 Meg). A first OPTION of -VALUE\n\
b for 512, k for 1024, m for 1048576 (1 Meg). \
"), stdout);
fputs (_("\
A first OPTION of -VALUE\n\
or +VALUE is treated like -n VALUE or -n +VALUE unless VALUE has one of\n\
the [bkm] suffix multipliers, in which case it is treated like -c VALUE\n\
or -c +VALUE. \
"), stdout);
fputs (_("\
or -c +VALUE. Warning: a first option of +VALUE is obsolescent, and support\n\
Warning: a first option of +VALUE is obsolescent, and support\n\
for it will be withdrawn.\n\
\n\
With --follow (-f), tail defaults to following the file descriptor, which\n\
means that even if a tail'ed file is renamed, tail will continue to track\n\
its end. This default behavior is not desirable when you really want to\n\
"), stdout);
fputs (_("\
With --follow (-f), tail defaults to following the file descriptor, which\n\
means that even if a tail'ed file is renamed, tail will continue to track\n\
its end. \
"), stdout);
fputs (_("\
This default behavior is not desirable when you really want to\n\
track the actual name of the file, not the file descriptor (e.g., log\n\
rotation). Use --follow=name in that case. That causes tail to track the\n\
named file by reopening it periodically to see if it has been removed and\n\

View File

@@ -61,14 +61,14 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [FILE]...\n"), program_name);
printf (_("\
fputs (_("\
Copy standard input to each FILE, and also to standard output.\n\
\n\
-a, --append append to the given FILEs, do not overwrite\n\
-i, --ignore-interrupts ignore interrupt signals\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -995,25 +995,31 @@ Usage: %s EXPRESSION\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Exit with the status determined by EXPRESSION.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
EXPRESSION is true or false and sets exit status. It is one of:\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
( EXPRESSION ) EXPRESSION is true\n\
! EXPRESSION EXPRESSION is false\n\
EXPRESSION1 -a EXPRESSION2 both EXPRESSION1 and EXPRESSION2 are true\n\
EXPRESSION1 -o EXPRESSION2 either EXPRESSION1 or EXPRESSION2 is true\n\
"), stdout);
fputs (_("\
\n\
[-n] STRING the length of STRING is nonzero\n\
-z STRING the length of STRING is zero\n\
STRING1 = STRING2 the strings are equal\n\
STRING1 != STRING2 the strings are not equal\n\
"), stdout);
fputs (_("\
\n\
INTEGER1 -eq INTEGER2 INTEGER1 is equal to INTEGER2\n\
INTEGER1 -ge INTEGER2 INTEGER1 is greater than or equal to INTEGER2\n\
@@ -1021,38 +1027,46 @@ EXPRESSION is true or false and sets exit status. It is one of:\n\
INTEGER1 -le INTEGER2 INTEGER1 is less than or equal to INTEGER2\n\
INTEGER1 -lt INTEGER2 INTEGER1 is less than INTEGER2\n\
INTEGER1 -ne INTEGER2 INTEGER1 is not equal to INTEGER2\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
FILE1 -ef FILE2 FILE1 and FILE2 have the same device and inode numbers\n\
FILE1 -nt FILE2 FILE1 is newer (modification date) than FILE2\n\
FILE1 -ot FILE2 FILE1 is older than FILE2\n\
"), stdout);
fputs (_("\
\n\
-b FILE FILE exists and is block special\n\
-c FILE FILE exists and is character special\n\
-d FILE FILE exists and is a directory\n\
-e FILE FILE exists\n\
"), stdout);
fputs (_("\
-f FILE FILE exists and is a regular file\n\
-g FILE FILE exists and is set-group-ID\n\
-h FILE FILE exists and is a symbolic link (same as -L)\n\
-G FILE FILE exists and is owned by the effective group ID\n\
-k FILE FILE exists and has its sticky bit set\n\
"), stdout);
fputs (_("\
-L FILE FILE exists and is a symbolic link (same as -h)\n\
-O FILE FILE exists and is owned by the effective user ID\n\
-p FILE FILE exists and is a named pipe\n\
-r FILE FILE exists and is readable\n\
-s FILE FILE exists and has a size greater than zero\n\
"), stdout);
fputs (_("\
-S FILE FILE exists and is a socket\n\
-t [FD] file descriptor FD (stdout by default) is opened on a terminal\n\
-u FILE FILE exists and its set-user-ID bit is set\n\
-w FILE FILE exists and is writable\n\
-x FILE FILE exists and is executable\n\
"));
printf (_("\
"), stdout);
fputs (_("\
\n\
Beware that parentheses need to be escaped (e.g., by backslashes) for shells.\n\
INTEGER may also be -l STRING, which evaluates to the length of STRING.\n\
"));
"), stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -162,7 +162,7 @@ touch (const char *file)
if (open_errno)
error (0, open_errno, _("creating %s"), quote (file));
else
error (0, errno, _("getting attributes of %s"), quote (file));
error (0, errno, _("failed to get attributes of %s"), quote (file));
close (fd);
return 1;
}
@@ -348,7 +348,7 @@ main (int argc, char **argv)
if (use_ref)
{
if (stat (ref_file, &ref_stats))
error (1, errno, _("getting attributes of %s"), quote (ref_file));
error (1, errno, _("failed to get attributes of %s"), quote (ref_file));
date_set++;
}

View File

@@ -378,12 +378,16 @@ Interpreted sequences are:\n\
\n\
Translation occurs if -d is not given and both SET1 and SET2 appear.\n\
-t may be used only when translating. SET2 is extended to length of\n\
SET1 by repeating its last character as necessary. Excess characters\n\
of SET2 are ignored. Only [:lower:] and [:upper:] are guaranteed to\n\
SET1 by repeating its last character as necessary. \
"), stdout);
fputs (_("\
Excess characters\n\
of SET2 are ignored. Only [:lower:] and [:upper:] are guaranteed to\n\
expand in ascending order; used in SET2 while translating, they may\n\
only be used in pairs to specify case conversion. -s uses SET1 if not\n\
only be used in pairs to specify case conversion. \
"), stdout);
fputs (_("\
-s uses SET1 if not\n\
translating nor deleting; else squeezing uses SET2 and occurs after\n\
translation or deletion.\n\
"), stdout);

View File

@@ -21,10 +21,10 @@ Exit with a status code indicating success.\n\
\n\
These option names may not be abbreviated.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
")
, program_name, program_name);
"),
program_name, program_name);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
exit (status);
}

View File

@@ -1,5 +1,5 @@
/* tty -- print the path of the terminal connected to standard input
Copyright (C) 1990-2000 Free Software Foundation, Inc.
Copyright (C) 1990-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -60,13 +60,13 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]...\n"), program_name);
printf (_("\
fputs (_("\
Print the file name of the terminal connected to standard input.\n\
\n\
-s, --silent, --quiet print nothing, only return an exit status\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -93,20 +93,23 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]...\n"), program_name);
printf (_("\
fputs (_("\
Print certain system information. With no OPTION, same as -s.\n\
\n\
-a, --all print all information, in the following order:\n\
-s, --kernel-name print the kernel name\n\
-n, --nodename print the network node hostname\n\
-r, --kernel-release print the kernel release\n\
"), stdout);
fputs (_("\
-v, --kernel-version print the kernel version\n\
-m, --machine print the machine hardware name\n\
-p, --processor print the processor type\n\
-i, --hardware-platform print the hardware platform\n\
-o, --operating-system print the operating system\n\
--help display this help and exit\n\
--version output version information and exit\n"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* GNU's uptime.
Copyright (C) 1992-2000 Free Software Foundation, Inc.
Copyright (C) 1992-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -178,9 +178,10 @@ the number of users on the system, and the average number of jobs\n\
in the run queue over the last 1, 5 and 15 minutes.\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n"),
"),
UTMP_FILE, WTMP_FILE);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* GNU's users.
Copyright (C) 1992-2000 Free Software Foundation, Inc.
Copyright (C) 1992-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -120,9 +120,10 @@ usage (int status)
Output who is currently logged in according to FILE.\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n"),
"),
UTMP_FILE, WTMP_FILE);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -32,13 +32,17 @@
# include <wchar.h>
#endif
/* Get iswprint(). */
/* Get iswprint(), iswspace(). */
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
#if !defined iswprint && !HAVE_ISWPRINT
# define iswprint(wc) 1
#endif
#if !defined iswspace && !HAVE_ISWSPACE
# define iswspace(wc) \
((wc) == (unsigned char) (wc) && ISSPACE ((unsigned char) (wc)))
#endif
/* Include this after wctype.h so that we `#undef' ISPRINT
(from Solaris's euc.h, from widec.h, from wctype.h) before
@@ -378,6 +382,8 @@ wc (int fd, const char *file)
int width = wcwidth (wide_char);
if (width > 0)
linepos += width;
if (iswspace (wide_char))
goto mb_word_separator;
in_word = 1;
}
break;
@@ -452,6 +458,8 @@ wc (int fd, const char *file)
if (ISPRINT ((unsigned char) p[-1]))
{
linepos++;
if (ISSPACE ((unsigned char) p[-1]))
goto word_separator;
in_word = 1;
}
break;

View File

@@ -551,30 +551,40 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n"), program_name);
printf (_("\
fputs (_("\
\n\
-a, --all same as -b -d --login -p -r -t -T -u\n\
-b, --boot time of last system boot\n\
-d, --dead print dead processes\n\
-H, --heading print line of column headings\n\
"), stdout);
fputs (_("\
-i, --idle add idle time as HOURS:MINUTES, . or old\n\
(deprecated, use -u)\n\
--login print system login processes\n\
(equivalent to SUS -l)\n\
"), stdout);
fputs (_("\
-l, --lookup attempt to canonicalize hostnames via DNS\n\
(-l is deprecated, use --lookup)\n\
-m only hostname and user associated with stdin\n\
-p, --process print active processes spawned by init\n\
"), stdout);
fputs (_("\
-q, --count all login names and number of users logged on\n\
-r, --runlevel print current runlevel\n\
-s, --short print only name, line, and time (default)\n\
-t, --time print last system clock change\n\
"), stdout);
fputs (_("\
-T, -w, --mesg add user's message status as +, - or ?\n\
-u, --users lists users logged in\n\
--message same as -T\n\
--writable same as -T\n\
--help display this help and exit\n\
--version output version information and exit\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (_("\
\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual.\n\

View File

@@ -1,5 +1,5 @@
/* whoami -- print effective userid
Copyright (C) 89,90, 1991-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 89,90, 1991-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,12 +50,13 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]...\n"), program_name);
printf (_("\
fputs (_("\
Print the user name associated with the current effective user id.\n\
Same as id -un.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -1,5 +1,5 @@
/* yes - output a string repeatedly until killed
Copyright (C) 1991-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1991-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -52,11 +52,12 @@ Usage: %s [STRING]...\n\
"),
program_name, program_name);
printf (_("\
fputs (_("\
Repeatedly output a line with all specified STRING(s), or `y'.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n"));
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);

View File

@@ -85,6 +85,6 @@ changed group of `symlink' to G1
EOF
cmp expected actual \
|| { diff -u expected actual 1>&2; fail=1; }
|| { diff expected actual 1>&2; fail=1; }
(exit $fail); exit

View File

@@ -34,35 +34,38 @@ EOF
esac
fail=0
for i in $all_programs; do
# false fails even when invoked with --help or --version.
if test $i = false; then
./$i --help >/dev/null && fail=1
./$i --version >/dev/null && fail=1
continue
fi
for lang in C fr da; do
for i in $all_programs; do
# The just-built install executable is always named `ginstall'.
test $i = install && i=ginstall
# Make sure they exit successfully, under normal conditions.
./$i --help >/dev/null || fail=1
./$i --version >/dev/null || fail=1
# Make sure they fail upon `disk full' error.
if test -w /dev/full && test -c /dev/full; then
./$i --help >/dev/full 2>/dev/null && fail=1
./$i --version >/dev/full 2>/dev/null
status=$?
eval "expected=\$expected_failure_status_$i"
test x$expected = x && expected=1
if test $status = $expected; then
: # ok
else
fail=1
# false fails even when invoked with --help or --version.
if test $i = false; then
env LC_MESSAGES=$lang ./$i --help >/dev/null && fail=1
env LC_MESSAGES=$lang ./$i --version >/dev/null && fail=1
continue
fi
fi
# The just-built install executable is always named `ginstall'.
test $i = install && i=ginstall
# Make sure they exit successfully, under normal conditions.
./$i --help >/dev/null || fail=1
./$i --version >/dev/null || fail=1
# Make sure they fail upon `disk full' error.
if test -w /dev/full && test -c /dev/full; then
./$i --help >/dev/full 2>/dev/null && fail=1
./$i --version >/dev/full 2>/dev/null && fail=1
status=$?
eval "expected=\$expected_failure_status_$i"
test x$expected = x && expected=1
if test $status = $expected; then
: # ok
else
fail=1
fi
fi
done
done
tmp=tmp-$$

View File

@@ -35,7 +35,7 @@ fail=0
ls > out || fail=1
cmp out exp || fail=1
test $fail = 1 && diff -u out exp 2> /dev/null
test $fail = 1 && diff out exp 2> /dev/null
cat > exp <<\EOF
.:
@@ -54,6 +54,6 @@ EOF
ls -R > out || fail=1
cmp out exp || fail=1
test $fail = 1 && diff -u out exp 2> /dev/null
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit

View File

@@ -50,7 +50,7 @@ c:
EOF
cmp out exp || fail=1
test $fail = 1 && diff -u out exp 2> /dev/null
test $fail = 1 && diff out exp 2> /dev/null
rm -rf out exp
ls -R1 x y f > out || fail=1
@@ -63,6 +63,6 @@ y:
EOF
cmp out exp || fail=1
test $fail = 1 && diff -u out exp 2> /dev/null
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit

View File

@@ -39,7 +39,7 @@ b
c
EOF
cmp out exp || fail=1
test $fail = 1 && diff -u out exp 2> /dev/null
test $fail = 1 && diff out exp 2> /dev/null
rm -rf out exp
ls -1rt a b c > out || fail=1
@@ -49,6 +49,6 @@ b
a
EOF
cmp out exp || fail=1
test $fail = 1 && diff -u out exp 2> /dev/null
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit

View File

@@ -38,7 +38,15 @@ touch: setting times of `/': Permission denied
touch: creating `/no/such-dir': No such file or directory
EOF
cmp out exp || fail=1
cmp out exp || {
# On SunOS4, EPERM is `Not owner'
cat > exp2 <<\EOF
touch: setting times of `/': Not owner
touch: creating `/no/such-dir': No such file or directory
EOF
cmp out exp2 || fail=1
}
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit