mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
67 Commits
FILEUTILS-
...
SH-UTILS-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86110845b2 | ||
|
|
f9045181fd | ||
|
|
850ad58630 | ||
|
|
a95c870766 | ||
|
|
56d806cf6f | ||
|
|
c2efd628df | ||
|
|
5eceb4fed1 | ||
|
|
38457c3dac | ||
|
|
fee163dd57 | ||
|
|
f954f74302 | ||
|
|
0271d97259 | ||
|
|
9cb8617078 | ||
|
|
7c5f9f7faa | ||
|
|
053855b040 | ||
|
|
a5b5719d3b | ||
|
|
01b69091e2 | ||
|
|
d30fa5d58e | ||
|
|
b54cd94fe7 | ||
|
|
5de0b392f2 | ||
|
|
3613700a38 | ||
|
|
318a497768 | ||
|
|
7b428cdeda | ||
|
|
b28595b502 | ||
|
|
f9714aa24d | ||
|
|
a9ff449aa6 | ||
|
|
236c02759b | ||
|
|
777948e773 | ||
|
|
6e45576dd6 | ||
|
|
2bc35b0348 | ||
|
|
818d29db9b | ||
|
|
47f70113d4 | ||
|
|
2fa0c16e5e | ||
|
|
8060afb088 | ||
|
|
a1bc39d130 | ||
|
|
e6fae6c23f | ||
|
|
adb160df0f | ||
|
|
74a776f9ae | ||
|
|
12ea18c68d | ||
|
|
f870ecb4a6 | ||
|
|
6d6bfafbdd | ||
|
|
7178674807 | ||
|
|
1954f681c6 | ||
|
|
bb6a548712 | ||
|
|
403816eb85 | ||
|
|
adb7c216b2 | ||
|
|
92d78458e0 | ||
|
|
dd5db06467 | ||
|
|
b13e6b03cc | ||
|
|
a2b8387b70 | ||
|
|
4229a555fc | ||
|
|
688833b80e | ||
|
|
ca0246a4c1 | ||
|
|
c1cdafa1b4 | ||
|
|
ed960988ee | ||
|
|
3ee97d4d5b | ||
|
|
b34f300eaf | ||
|
|
2e5cc5e04e | ||
|
|
182c784a99 | ||
|
|
b14b621029 | ||
|
|
8825dba4e7 | ||
|
|
9922b56ffb | ||
|
|
6681674e3c | ||
|
|
99f35e8204 | ||
|
|
c46f149efd | ||
|
|
644d185dea | ||
|
|
6fc4ae7a28 | ||
|
|
3f92a4421a |
6
COPYING
6
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -304,8 +304,8 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
info_TEXINFOS = fileutils.texi
|
||||
DIST_OTHER = perm.texi getdate.texi
|
||||
EXTRA_DIST = perm.texi getdate.texi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 0.30 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 0.31 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
@@ -39,7 +39,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
info_TEXINFOS = fileutils.texi
|
||||
DIST_OTHER = perm.texi getdate.texi
|
||||
EXTRA_DIST = perm.texi getdate.texi
|
||||
CONFIG_HEADER = ../config.h
|
||||
|
||||
MAKEINFO = makeinfo
|
||||
@@ -50,16 +50,16 @@ DVIS = fileutils.dvi
|
||||
TEXINFOS = fileutils.texi
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
|
||||
version.texi
|
||||
version.texi
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(INFOS) $(MANS) $(DIST_OTHER) $(DATA)
|
||||
$(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) $(DATA)
|
||||
DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(DIST_OTHER) $(DATA)
|
||||
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA)
|
||||
default: all
|
||||
|
||||
|
||||
@@ -158,6 +158,8 @@ uninstall: uninstall-info
|
||||
|
||||
all: $(INFO_DEPS) Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
installdirs:
|
||||
$(top_srcdir)/mkinstalldirs $(infodir)
|
||||
|
||||
@@ -188,12 +190,11 @@ maintainer-clean: maintainer-clean-vti maintainer-clean-info \
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default mostlyclean-vti distclean-vti clean-vti \
|
||||
maintainer-clean-vti install-info uninstall-info mostlyclean-info \
|
||||
distclean-info clean-info maintainer-clean-info tags dist info dvi \
|
||||
check installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean \
|
||||
maintainer-clean
|
||||
maintainer-clean-vti install-info uninstall-info mostlyclean-info \
|
||||
distclean-info clean-info maintainer-clean-info tags dist info dvi \
|
||||
check installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .texi .info .dvi
|
||||
|
||||
@@ -2144,16 +2144,26 @@ time, 12-hour (hh:mm:ss [AP]M)
|
||||
@cindex seconds since the epoch
|
||||
@cindex beginning of time
|
||||
seconds since the epoch, i.e., 1 January 1970 00:00:00 UTC (a
|
||||
GNU extension)
|
||||
GNU extension).
|
||||
Note that this value is the number of seconds between the epoch
|
||||
and the current date as defined by the localtime system call.
|
||||
It isn't changed by the @samp{--date} option.
|
||||
@item %S
|
||||
second (00@dots{}61)
|
||||
@item %T
|
||||
time, 24-hour (hh:mm:ss)
|
||||
@item %X
|
||||
locale's time representation (%H:%M:%S)
|
||||
@item %z
|
||||
RFC-822 style numeric time zone (e.g., -0600 or +0100), or nothing
|
||||
if no time zone is determinable.
|
||||
Note that this value reflects the @emph{current} time zone.
|
||||
It isn't changed by the @samp{--date} option.
|
||||
@item %Z
|
||||
timezone (e.g., EDT), or nothing if no timezone is
|
||||
determinable
|
||||
time zone (e.g., EDT), or nothing if no timezone is
|
||||
determinable.
|
||||
Note that this value reflects the @emph{current} time zone.
|
||||
It isn't changed by the @samp{--date} option.
|
||||
@end table
|
||||
|
||||
|
||||
@@ -2320,15 +2330,6 @@ current time and date. @var{datestr} can be in almost any common
|
||||
format. It can contain month names, timezones, @samp{am} and @samp{pm},
|
||||
@samp{yesterday}, @samp{ago}, @samp{next}, etc. @xref{Date input formats}.
|
||||
|
||||
@item -r @var{file}
|
||||
@itemx --reference=@var{file}
|
||||
@opindex -r
|
||||
@opindex --reference
|
||||
Display the time and date as obtained from a reference @var{file},
|
||||
instead of the current time and date. Each file has a few timestamps
|
||||
associated with it. In this context, the time and date of the last
|
||||
modification are used.
|
||||
|
||||
@item -f @var{datefile}
|
||||
@itemx --file=@var{datefile}
|
||||
@opindex -f
|
||||
@@ -2339,6 +2340,22 @@ input. This is useful when you have many dates to process, because the
|
||||
system overhead of starting up the @code{date} executable many times can
|
||||
be considerable.
|
||||
|
||||
@itemx --rfc-822
|
||||
@opindex -R
|
||||
@opindex --rfc-822
|
||||
Display the time and date using the RFC-822-specified
|
||||
format, @samp{%a, %_d %b %Y %H:%M:%S %z}.
|
||||
If @samp{--utc} is also specified, use @samp{GMT} in place of @samp{%z}.
|
||||
|
||||
@item -r @var{file}
|
||||
@itemx --reference=@var{file}
|
||||
@opindex -r
|
||||
@opindex --reference
|
||||
Display the time and date as obtained from a reference @var{file},
|
||||
instead of the current time and date. Each file has a few timestamps
|
||||
associated with it. In this context, the time and date of the last
|
||||
modification are used.
|
||||
|
||||
@item -s @var{datestr}
|
||||
@itemx --set=@var{datestr}
|
||||
@opindex -s
|
||||
@@ -2419,6 +2436,14 @@ To set the system clock forward by two minutes:
|
||||
date --set='+2 minutes'
|
||||
@end example
|
||||
|
||||
@item
|
||||
To print the date in the format specified by RFC-822,
|
||||
use @samp{date --rfc}. I just did and saw this:
|
||||
|
||||
@example
|
||||
Mon, 25 Mar 1996 23:34:17 -0600
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
|
||||
@@ -1695,6 +1695,7 @@ mode:
|
||||
@cindex checking for sortedness
|
||||
Check whether the given files are already sorted: if they are not all
|
||||
sorted, print an error message and exit with a status of 1.
|
||||
Otherwise, exit successfully.
|
||||
|
||||
@item -m
|
||||
@opindex -m
|
||||
@@ -1728,6 +1729,8 @@ input line length or restrictions on bytes allowed within lines. In
|
||||
addition, if the final byte of an input file is not a newline, GNU
|
||||
@code{sort} silently supplies one.
|
||||
|
||||
Upon any error, @code{sort} exits with a status of @samp{2}.
|
||||
|
||||
@vindex TMPDIR
|
||||
If the environment variable @code{TMPDIR} is set, @code{sort} uses its
|
||||
value as the directory for temporary files instead of @file{/tmp}. The
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
noinst_LIBRARIES = fu
|
||||
|
||||
DIST_OTHER = alloca.c euidaccess.c fnmatch.c fsusage.c ftruncate.c \
|
||||
EXTRA_DIST = alloca.c euidaccess.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.y memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
|
||||
posixtm.y rename.c rmdir.c stpcpy.c strdup.c strstr.c strtol.c strtoul.c
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 0.30 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 0.31 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
@@ -40,7 +40,7 @@ transform = @program_transform_name@
|
||||
|
||||
noinst_LIBRARIES = fu
|
||||
|
||||
DIST_OTHER = alloca.c euidaccess.c fnmatch.c fsusage.c ftruncate.c \
|
||||
EXTRA_DIST = alloca.c euidaccess.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.y memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
|
||||
posixtm.y rename.c rmdir.c stpcpy.c strdup.c strstr.c strtol.c strtoul.c
|
||||
|
||||
@@ -78,11 +78,11 @@ LIBS = @LIBS@
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(LDFLAGS) -o $@
|
||||
fu_OBJECTS = getdate.o posixtm.o argmatch.o backupfile.o basename.o \
|
||||
dirname.o error.o fileblocks.o filemode.o full-write.o getopt.o \
|
||||
getopt1.o getversion.o group-member.o idcache.o isdir.o \
|
||||
long-options.o makepath.o modechange.o obstack.o safe-read.o \
|
||||
save-cwd.o savedir.o stripslash.o userspec.o xgetcwd.o xmalloc.o \
|
||||
xstrdup.o xstrtol.o xstrtoul.o yesno.o
|
||||
dirname.o error.o fileblocks.o filemode.o full-write.o getopt.o \
|
||||
getopt1.o getversion.o group-member.o idcache.o isdir.o long-options.o \
|
||||
makepath.o modechange.o obstack.o safe-read.o save-cwd.o savedir.o \
|
||||
stripslash.o userspec.o xgetcwd.o xmalloc.o xstrdup.o xstrtol.o \
|
||||
xstrtoul.o yesno.o
|
||||
LIBFILES = libfu.a
|
||||
|
||||
AR = ar
|
||||
@@ -90,26 +90,26 @@ RANLIB = @RANLIB@
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in alloca.c fileblocks.c fnmatch.c \
|
||||
fsusage.c ftruncate.c mountlist.c
|
||||
fsusage.c ftruncate.c mountlist.c
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(INFOS) $(MANS) $(DIST_OTHER) $(DATA)
|
||||
$(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) $(DATA)
|
||||
DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(DIST_OTHER) $(DATA)
|
||||
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA)
|
||||
DEP_FILES = .deps/alloca.P .deps/argmatch.P .deps/backupfile.P \
|
||||
.deps/basename.P .deps/dirname.P .deps/error.P .deps/fileblocks.P \
|
||||
.deps/filemode.P .deps/fnmatch.P .deps/fsusage.P .deps/ftruncate.P \
|
||||
.deps/full-write.P .deps/getdate.P .deps/getopt.P .deps/getopt1.P \
|
||||
.deps/getversion.P .deps/group-member.P .deps/idcache.P \
|
||||
.deps/isdir.P .deps/long-options.P .deps/makepath.P \
|
||||
.deps/modechange.P .deps/mountlist.P .deps/obstack.P \
|
||||
.deps/posixtm.P .deps/safe-read.P .deps/save-cwd.P .deps/savedir.P \
|
||||
.deps/stripslash.P .deps/userspec.P .deps/xgetcwd.P .deps/xmalloc.P \
|
||||
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
|
||||
.deps/basename.P .deps/dirname.P .deps/error.P .deps/fileblocks.P \
|
||||
.deps/filemode.P .deps/fnmatch.P .deps/fsusage.P .deps/ftruncate.P \
|
||||
.deps/full-write.P .deps/getdate.P .deps/getopt.P .deps/getopt1.P \
|
||||
.deps/getversion.P .deps/group-member.P .deps/idcache.P .deps/isdir.P \
|
||||
.deps/long-options.P .deps/makepath.P .deps/modechange.P \
|
||||
.deps/mountlist.P .deps/obstack.P .deps/posixtm.P .deps/safe-read.P \
|
||||
.deps/save-cwd.P .deps/savedir.P .deps/stripslash.P .deps/userspec.P \
|
||||
.deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P \
|
||||
.deps/xstrtoul.P .deps/yesno.P
|
||||
SOURCES = $(fu_SOURCES)
|
||||
OBJECTS = $(fu_OBJECTS)
|
||||
|
||||
@@ -221,6 +221,8 @@ uninstall:
|
||||
|
||||
all: $(LIBFILES) $(HEADERS) Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
installdirs:
|
||||
|
||||
|
||||
@@ -254,14 +256,13 @@ maintainer-clean: maintainer-clean-noinstLIBRARIES \
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
|
||||
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags dist info dvi check installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean \
|
||||
maintainer-clean
|
||||
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags dist info dvi check installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Since this directory contains two parsers, we have to be careful to avoid
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/* xstrtod.c - error-checking interface to strtod
|
||||
Copyright (C) 1996 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 Jim Meyering. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -11,9 +30,13 @@ double strtod ();
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include "xstrtod.h"
|
||||
|
||||
/* An interface to strtod that encapsulates all the error checking
|
||||
one should usually perform. Like strtod, but upon successful
|
||||
conversion put the result in *RESULT and return zero. Return
|
||||
non-zero and don't modify *RESULT upon any failure. */
|
||||
|
||||
int
|
||||
xstrtod (str, ptr, result)
|
||||
const char *str;
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
Thu Mar 21 16:43:13 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* src/*.c (main): Declare to be of type int, not void.
|
||||
|
||||
Sat Mar 16 10:46:23 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* configure.in (PACKAGE_VERSION): New macro.
|
||||
* acconfig.h (PACKAGE_VERSION): Add it.
|
||||
* src/Makefile.am: Remove rules for generating version.c.
|
||||
Remove references to version.o, version.h, and stamp-v.
|
||||
* version.c: Remove file.
|
||||
* version.h: Remove file.
|
||||
* chgrp.c chmod.c chown.c cp.c dd.c df.c du.c install.c ln.c
|
||||
ls.c mkdir.c mkfifo.c mknod.c mv.c mvdir.c rm.c rmdir.c sync.c
|
||||
touch.c: Don't include version.h.
|
||||
(main): Use PACKAGE_VERSION instead of version_string.
|
||||
|
||||
Sun Mar 10 22:36:11 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* backupfile.c (max_backup_version): Declare file_name_length to
|
||||
be of type size_t. This avoid a warning from gcc -Wall.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1710
old/sh-utils/ChangeLog.0
Normal file
1710
old/sh-utils/ChangeLog.0
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,11 @@
|
||||
User visible changes in release 1.13
|
||||
* New program: chroot.
|
||||
* internationalized diagnostic messages (so far, only french translations)
|
||||
* `date -d "01/01/1998 3 years" +%Y' now works properly. It prints 2001.
|
||||
* expr's match operator has been corrected to use basic regular expressions
|
||||
* New programs: factor, seq.
|
||||
* date accepts new option --rfc-822 (-R) and new %z format.
|
||||
* date accepts new option: --rfc-822 (-R)
|
||||
* date accepts new format: %z
|
||||
* date: fix bugs in the handling of date -u +'%s %Z'.
|
||||
* date accepts new option --reference=FILE (-r FILE) analogous to the
|
||||
like-named touch option.
|
||||
|
||||
@@ -1,3 +1,62 @@
|
||||
Wed Mar 27 23:33:36 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* cksum.c (cksum): Use format "%lu %ld" (instead of "%10lu %8ld")
|
||||
to be POSIX compliant. From Stephen Gildea <gildea@x.org>.
|
||||
|
||||
Sun Mar 24 08:47:40 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* join.c (main): Use EXIT_FAILURE, not 2, as exit code in error call.
|
||||
* od.c (skip, main): Likewise.
|
||||
* tr.c (main): Likewise.
|
||||
|
||||
* cat.c cksum.c comm.c csplit.c cut.c expand.c fmt.c fold.c head.c
|
||||
join.c md5sum.c nl.c od.c paste.c pr.c split.c sum.c tac.c tail.c
|
||||
tr.c unexpand.c uniq.c wc.c: Exit with status EXIT_SUCCESS or
|
||||
EXIT_FAILURE, rather than 0 or 1.
|
||||
|
||||
Sat Mar 23 23:14:40 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* system.h [EXIT_FAILURE]: Undefine and define to 1 also if it
|
||||
is defined to zero. Suggested by Paul Eggert.
|
||||
|
||||
* sort.c [SORT_FAILURE]: New macro.
|
||||
Be careful to exit with 1 only when -c is used and the
|
||||
input is not properly sorted. In all other cases, use
|
||||
SORT_FAILURE as required by POSIX.
|
||||
(main): Change some `error (1, ...' to use SORT_FAILURE.
|
||||
Upon successful termination, exit with EXIT_SUCCESS instead of `0'.
|
||||
Replace all uses of `2' (as exit code) with SORT_FAILURE.
|
||||
|
||||
Thu Mar 21 22:47:50 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* csplit.c: Include assert.h, but disable assertions.
|
||||
(process_line_count): Replace if-abort with a slightly relaxed
|
||||
assertion. Before, `echo |csplit - 1 1' would abort.
|
||||
Reported by Samuli.Karkkainen@hut.fi.
|
||||
(parse_patterns): Disallow uses like `csplit FILE 0' with zero
|
||||
line number, `csplit FILE 2 1' with decreasing line numbers, and
|
||||
warn about uses like `csplit FILE 3 3' that have equal line numbers.
|
||||
|
||||
* sort.c (main): Declare to be of type int, not void.
|
||||
From Peter Seebach <seebs@taniemarie.solon.com>.
|
||||
* cat.c cksum.c comm.c csplit.c cut.c expand.c fold.c head.c join.c
|
||||
nl.c paste.c pr.c split.c sum.c tac.c tail.c tr.c unexpand.c uniq.c
|
||||
wc.c (main): Likewise.
|
||||
|
||||
Sat Mar 16 16:30:07 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* configure.in (PACKAGE_VERSION): New macro.
|
||||
* acconfig.h (PACKAGE_VERSION): Add it.
|
||||
* src/Makefile.am: Remove rules for generating version.c.
|
||||
Remove references to version.o, version.h, and stamp-v.
|
||||
* version.c: Remove file.
|
||||
* version.h: Remove file.
|
||||
* cat.c cksum.c comm.c csplit.c cut.c expand.c fmt.c fold.c
|
||||
head.c join.c md5sum.c nl.c od.c paste.c pr.c sort.c split.c
|
||||
sum.c tac.c tail.c tr.c unexpand.c uniq.c wc.c: Don't include
|
||||
version.h.
|
||||
(main): Use PACKAGE_VERSION instead of version_string.
|
||||
|
||||
Mon Mar 11 16:07:08 CST 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
|
||||
* sort.c (write_bytes): Renamed from xfwrite.
|
||||
@@ -21,6 +80,7 @@ Sat Mar 9 13:30:12 1996 Jim Meyering (meyering@na-net.ornl.gov)
|
||||
gettext distribution.
|
||||
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_LC_MESSAGES,
|
||||
HAVE_STPCPY): New macros.
|
||||
Add PACKAGE and VERSION.
|
||||
* configure.in (PACKAGE): Define with AC_DEFINE_UNQUOTED.
|
||||
(VERSION): Likewise.
|
||||
(ALL_LINGUAS): Define.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
User-visible changes in release 1.15
|
||||
* diagnose some improper or questionable invokations of csplit
|
||||
* properly handle `echo |csplit - 1 1', rather than aborting
|
||||
* join without -t now ignores leading blanks
|
||||
* sort accepts new option: -z for NUL terminated records
|
||||
* join accepts new option: --ignore-case, -i
|
||||
|
||||
214
po/Makefile.in.in
Normal file
214
po/Makefile.in.in
Normal file
@@ -0,0 +1,214 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996 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.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = $(prefix)/share/gettext
|
||||
subdir = po
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CC = @CC@
|
||||
GENCAT = @GENCAT@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
TUPDATE = tupdate
|
||||
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
SOURCES = cat-id-tbl.c
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
||||
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
|
||||
|
||||
POTFILES = \
|
||||
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
|
||||
.po.pox:
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
$(TUPDATE) $(srcdir)/$(PACKAGE).pot $< > $*.pox
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
.po.gmo:
|
||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) -o $$file $<
|
||||
|
||||
.po.cat:
|
||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
||||
&& rm -f $@ && $(GENCAT) $@ $*.msg
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
|
||||
all-yes: cat-id-tbl.c $(CATALOGS)
|
||||
all-no:
|
||||
|
||||
$(PACKAGE).pot: $(POTFILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in
|
||||
if cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \
|
||||
rm -f $(PACKAGE).po; \
|
||||
else \
|
||||
rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; \
|
||||
fi
|
||||
|
||||
cat-id-tbl.c: stamp-cat-id
|
||||
stamp-cat-id: $(PACKAGE).pot
|
||||
rm -f cat-id-tbl.tmp.c
|
||||
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
|
||||
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp.c
|
||||
if cmp -s cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; then \
|
||||
rm cat-id-tbl.tmp.c; \
|
||||
else \
|
||||
echo cat-id-tbl.c changed; \
|
||||
rm -f $(srcdir)/cat-id-tbl.c; \
|
||||
mv cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; \
|
||||
fi
|
||||
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
|
||||
|
||||
|
||||
install: install-exec install-data
|
||||
install-exec:
|
||||
install-data: all
|
||||
$(top_srcdir)/mkinstalldirs $(datadir)
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
case "$$cat" in \
|
||||
*.gmo) destdir=$(gnulocaledir);; \
|
||||
*) destdir=$(localedir);; \
|
||||
esac; \
|
||||
lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
|
||||
dir=$$destdir/$$lang/LC_MESSAGES; \
|
||||
$(top_srcdir)/mkinstalldirs $$dir; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# This installation goal is only used in GNU gettext. Packages which
|
||||
# only use the library should use install instead.
|
||||
install-src: install
|
||||
$(top_srcdir)/mkinstalldirs $(gettextsrcdir)
|
||||
cd $(srcdir) && \
|
||||
$(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/po-Makefile.in.in
|
||||
|
||||
uninstall:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
|
||||
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
done
|
||||
rm -f $(gettextsrcdir)/po-Makefile.in.in
|
||||
|
||||
check: all
|
||||
|
||||
cat-id-tbl.o: ../intl/libgettext.h
|
||||
|
||||
TAGS ID:
|
||||
|
||||
mostlyclean:
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp.c
|
||||
rm -fr *.o
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist dist-gettext: update-po $(DISTFILES)
|
||||
for file in $(DISTFILES); do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
done
|
||||
|
||||
update-po: Makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
|
||||
mv $$lang.po $$lang.old.po; \
|
||||
if $(TUPDATE) $(PACKAGE).pot $$lang.old.po > $$lang.po; then \
|
||||
rm -f $$lang.old.po; \
|
||||
else \
|
||||
echo "tupdate for $$cat failed!"; \
|
||||
rm -f $$lang.po; \
|
||||
mv $$lang.old.po $$lang.po; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
POTFILES: POTFILES.in
|
||||
( if test 'x$(srcdir)' != 'x.'; then \
|
||||
posrcprefix='$(top_srcdir)/'; \
|
||||
else \
|
||||
posrcprefix="../"; \
|
||||
fi; \
|
||||
sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
-e "s@.*@ $$posrcprefix& \\\\@" \
|
||||
-e '$$s/\(.*\) \\/\1/' < $(srcdir)/POTFILES.in > POTFILES )
|
||||
|
||||
Makefile: Makefile.in.in ../config.status POTFILES
|
||||
cd .. \
|
||||
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
|
||||
$(SHELL) ./config.status
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Usage: basename name [suffix]
|
||||
NAME is a pathname; SUFFIX is a suffix to strip from it.
|
||||
@@ -30,14 +30,11 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
char *basename __P ((char *));
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
static void remove_suffix __P ((register char *name, register char *suffix));
|
||||
extern char *basename ();
|
||||
extern void strip_trailing_slashes ();
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
@@ -66,14 +63,36 @@ If specified, also remove a trailing SUFFIX.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
/* Remove SUFFIX from the end of NAME if it is there, unless NAME
|
||||
consists entirely of SUFFIX. */
|
||||
|
||||
static void
|
||||
remove_suffix (char *name, const char *suffix)
|
||||
{
|
||||
char *np;
|
||||
const char *sp;
|
||||
|
||||
np = name + strlen (name);
|
||||
sp = suffix + strlen (suffix);
|
||||
|
||||
while (np > name && sp > suffix)
|
||||
if (*--np != *--sp)
|
||||
return;
|
||||
if (np > name)
|
||||
*np = '\0';
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *name;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "basename", version_string, usage);
|
||||
parse_long_options (argc, argv, "basename", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc == 1 || argc > 3)
|
||||
{
|
||||
@@ -92,21 +111,3 @@ main (int argc, char **argv)
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
/* Remove SUFFIX from the end of NAME if it is there, unless NAME
|
||||
consists entirely of SUFFIX. */
|
||||
|
||||
static void
|
||||
remove_suffix (register char *name, register char *suffix)
|
||||
{
|
||||
register char *np, *sp;
|
||||
|
||||
np = name + strlen (name);
|
||||
sp = suffix + strlen (suffix);
|
||||
|
||||
while (np > name && sp > suffix)
|
||||
if (*--np != *--sp)
|
||||
return;
|
||||
if (np > name)
|
||||
*np = '\0';
|
||||
}
|
||||
|
||||
41
src/cat.c
41
src/cat.c
@@ -31,7 +31,6 @@
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
@@ -73,7 +72,7 @@ static char *line_num_end = line_buf + 10;
|
||||
static int newlines2 = 0;
|
||||
|
||||
/* Count of non-fatal error conditions. */
|
||||
static int exit_stat = 0;
|
||||
static int exit_status = 0;
|
||||
|
||||
static void
|
||||
usage (int status)
|
||||
@@ -106,7 +105,7 @@ Concatenate FILE(s), or standard input, to standard output.\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Compute the next line number. */
|
||||
@@ -152,7 +151,7 @@ simple_cat (
|
||||
if (n_read < 0)
|
||||
{
|
||||
error (0, errno, "%s", infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,7 +163,7 @@ simple_cat (
|
||||
/* Write this block out. */
|
||||
|
||||
if (full_write (output_desc, buf, n_read) < 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +244,7 @@ cat (
|
||||
do
|
||||
{
|
||||
if (full_write (output_desc, wp, outsize) < 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
wp += outsize;
|
||||
}
|
||||
while (bpout - wp >= outsize);
|
||||
@@ -287,7 +286,7 @@ cat (
|
||||
else
|
||||
{
|
||||
error (0, errno, _("cannot do ioctl on `%s'"), infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
newlines2 = newlines;
|
||||
return;
|
||||
}
|
||||
@@ -298,7 +297,7 @@ cat (
|
||||
int n_write = bpout - outbuf;
|
||||
|
||||
if (full_write (output_desc, outbuf, n_write) < 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
bpout = outbuf;
|
||||
}
|
||||
|
||||
@@ -308,7 +307,7 @@ cat (
|
||||
if (n_read < 0)
|
||||
{
|
||||
error (0, errno, "%s", infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
newlines2 = newlines;
|
||||
return;
|
||||
}
|
||||
@@ -439,7 +438,7 @@ cat (
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
/* Optimal size of i/o operations of output. */
|
||||
@@ -574,14 +573,14 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (2);
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("cat - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("cat - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -592,7 +591,7 @@ main (int argc, char **argv)
|
||||
/* Get device, i-node number, and optimal blocksize of output. */
|
||||
|
||||
if (fstat (output_desc, &stat_buf) < 0)
|
||||
error (1, errno, _("standard output"));
|
||||
error (EXIT_FAILURE, errno, _("standard output"));
|
||||
|
||||
outsize = ST_BLKSIZE (stat_buf);
|
||||
/* Input file can be output file for non-regular files.
|
||||
@@ -638,7 +637,7 @@ main (int argc, char **argv)
|
||||
if (input_desc < 0)
|
||||
{
|
||||
error (0, errno, "%s", infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -646,7 +645,7 @@ main (int argc, char **argv)
|
||||
if (fstat (input_desc, &stat_buf) < 0)
|
||||
{
|
||||
error (0, errno, "%s", infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
goto contin;
|
||||
}
|
||||
insize = ST_BLKSIZE (stat_buf);
|
||||
@@ -661,7 +660,7 @@ main (int argc, char **argv)
|
||||
&& (input_desc != fileno (stdin) || output_desc != fileno (stdout)))
|
||||
{
|
||||
error (0, 0, _("%s: input file is output file"), infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
goto contin;
|
||||
}
|
||||
|
||||
@@ -711,15 +710,15 @@ main (int argc, char **argv)
|
||||
if (strcmp (infile, "-") && close (input_desc) < 0)
|
||||
{
|
||||
error (0, errno, "%s", infile);
|
||||
exit_stat = 1;
|
||||
exit_status = 1;
|
||||
}
|
||||
}
|
||||
while (++argind < argc);
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (close (1) < 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_stat);
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "xstrtoul.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -261,7 +260,7 @@ Change the group membership of each FILE to GROUP.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int group;
|
||||
@@ -298,7 +297,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("chgrp - %s\n", version_string);
|
||||
printf ("chgrp - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-R Recursively change modes of directory contents.
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "modechange.h"
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
void mode_string ();
|
||||
@@ -230,7 +229,7 @@ one or more of the letters rwxXstugo.\n"));
|
||||
/* Parse the ASCII mode given on the command line into a linked list
|
||||
of `struct mode_change' and apply that to each file argument. */
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct mode_change *changes;
|
||||
@@ -297,7 +296,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("chmod - %s\n", version_string);
|
||||
printf ("chmod - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
| user
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
@@ -234,7 +233,7 @@ to login group if implied by a period. A colon may replace the period.\n"));
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
uid_t user = (uid_t) -1; /* New uid; -1 if not to be changed. */
|
||||
@@ -277,7 +276,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("chown - %s\n", version_string);
|
||||
printf ("chown - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
85
src/chroot.c
Normal file
85
src/chroot.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* chroot -- run command or shell with special root directory
|
||||
Copyright (C) 1995 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 Roland McGrath. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The name this program was run with, for error messages. */
|
||||
char *program_name;
|
||||
|
||||
static void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != 0)
|
||||
fprintf (stderr, "Try `%s --help' for more information.\n",
|
||||
program_name);
|
||||
else
|
||||
{
|
||||
printf ("Usage: %s [OPTION] NEWROOT [COMMAND...]\n", program_name);
|
||||
printf ("\
|
||||
\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
If no command is given, run ``${SHELL} -i'' (default: /bin/sh).\n\
|
||||
");
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
program_name = argv[0];
|
||||
|
||||
parse_long_options (argc, argv, "chroot", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
error (0, 0, _("too few arguments"));
|
||||
usage (1);
|
||||
}
|
||||
|
||||
if (chroot (argv[1]))
|
||||
error (1, errno, "cannot change root directory to %s", argv[1]);
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
/* No command. Run an interactive shell. */
|
||||
char *shell = getenv ("SHELL");
|
||||
if (shell == NULL)
|
||||
shell = "/bin/sh";
|
||||
argv[0] = shell;
|
||||
argv[1] = "-i";
|
||||
}
|
||||
else
|
||||
/* The following arguments give the command. */
|
||||
argv += 2;
|
||||
|
||||
/* Execute the given command. */
|
||||
execvp (argv[0], argv);
|
||||
error (1, errno, "cannot execute %s", argv[0]);
|
||||
|
||||
exit (1);
|
||||
return 1;
|
||||
}
|
||||
19
src/cksum.c
19
src/cksum.c
@@ -85,7 +85,7 @@ remainder (m)
|
||||
return rem & 0xFFFFFFFF; /* Make it run on 64-bit machine. */
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i;
|
||||
@@ -99,7 +99,7 @@ main ()
|
||||
remainder (i * 5 + 4), remainder (i * 5 + 5));
|
||||
}
|
||||
printf ("\n};\n");
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#else /* !CRCTAB */
|
||||
@@ -108,7 +108,6 @@ main ()
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
@@ -250,7 +249,7 @@ cksum (char *file, int print_name)
|
||||
|
||||
crc = ~crc & 0xFFFFFFFF;
|
||||
|
||||
printf ("%10lu %8ld", crc, length);
|
||||
printf ("%lu %ld", crc, length);
|
||||
if (print_name)
|
||||
printf (" %s", file);
|
||||
putchar ('\n');
|
||||
@@ -277,10 +276,10 @@ Print CRC checksum and byte counts of each FILE.\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i, c;
|
||||
@@ -307,8 +306,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("cksum - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("cksum - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -327,8 +326,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
exit (errors);
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#endif /* !CRCTAB */
|
||||
|
||||
12
src/comm.c
12
src/comm.c
@@ -24,7 +24,6 @@
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "linebuffer.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
@@ -80,7 +79,7 @@ Compare sorted files LEFT_FILE and RIGHT_FILE line by line.\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Output the line in linebuffer LINE to stream STREAM
|
||||
@@ -212,7 +211,7 @@ compare_files (char **infiles)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -250,8 +249,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("comm - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("comm - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -260,5 +259,6 @@ main (int argc, char **argv)
|
||||
if (optind + 2 != argc)
|
||||
usage (1);
|
||||
|
||||
exit (compare_files (argv + optind));
|
||||
exit (compare_files (argv + optind) == 0
|
||||
? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
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 Torbjorn Granlund, Sweden (tege@sics.se). */
|
||||
|
||||
|
||||
11
src/cp.c
11
src/cp.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
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 Torbjorn Granlund, David MacKenzie, and Jim Meyering. */
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <getopt.h>
|
||||
#include "cp.h"
|
||||
#include "backupfile.h"
|
||||
#include "version.h"
|
||||
#include "argmatch.h"
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
@@ -192,8 +191,8 @@ static struct option const long_opts[] =
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -324,7 +323,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("cp - %s\n", version_string);
|
||||
printf ("cp - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
82
src/csplit.c
82
src/csplit.c
@@ -21,6 +21,11 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Disable assertions. Some systems have broken assert macros. */
|
||||
#define NDEBUG 1
|
||||
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
@@ -42,7 +47,6 @@
|
||||
# include <rx.h>
|
||||
#endif
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "xstrtoul.h"
|
||||
|
||||
@@ -255,7 +259,7 @@ static void
|
||||
cleanup_fatal (void)
|
||||
{
|
||||
cleanup ();
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
@@ -642,7 +646,7 @@ static unsigned int
|
||||
get_first_line_in_buffer (void)
|
||||
{
|
||||
if (head == NULL && !load_buffer ())
|
||||
error (1, errno, _("input disappeared"));
|
||||
error (EXIT_FAILURE, errno, _("input disappeared"));
|
||||
|
||||
return head->first_available;
|
||||
}
|
||||
@@ -743,7 +747,7 @@ set_input_file (const char *name)
|
||||
{
|
||||
input_desc = open (name, O_RDONLY);
|
||||
if (input_desc < 0)
|
||||
error (1, errno, "%s", name);
|
||||
error (EXIT_FAILURE, errno, "%s", name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -826,10 +830,11 @@ process_line_count (const struct control *p, int repetition)
|
||||
|
||||
linenum = get_first_line_in_buffer ();
|
||||
|
||||
/* Check for requesting a line that has already been written out.
|
||||
If this ever happens, it's due to a bug in csplit. */
|
||||
if (linenum >= last_line_to_save)
|
||||
abort ();
|
||||
/* Initially, I wanted to assert linenum < last_line_to_save, but that
|
||||
condition is false for the valid command: echo | csplit - 1 '{*}'.
|
||||
So, relax it just a little. */
|
||||
assert ((linenum == 1 && last_line_to_save == 1)
|
||||
|| linenum < last_line_to_save);
|
||||
|
||||
while (linenum++ < last_line_to_save)
|
||||
{
|
||||
@@ -899,7 +904,7 @@ process_regexp (struct control *p, int repetition)
|
||||
dump_rest_of_file ();
|
||||
close_output_file ();
|
||||
}
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
regexp_error (p, repetition, ignore);
|
||||
@@ -939,7 +944,7 @@ process_regexp (struct control *p, int repetition)
|
||||
dump_rest_of_file ();
|
||||
close_output_file ();
|
||||
}
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
regexp_error (p, repetition, ignore);
|
||||
@@ -1121,11 +1126,11 @@ check_for_offset (struct control *p, const char *str, const char *num)
|
||||
unsigned long val;
|
||||
|
||||
if (*num != '-' && *num != '+')
|
||||
error (1, 0, _("%s: `+' or `-' expected after delimeter"), str);
|
||||
error (EXIT_FAILURE, 0, _("%s: `+' or `-' expected after delimeter"), str);
|
||||
|
||||
if (xstrtoul (num + 1, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val > UINT_MAX)
|
||||
error (1, 0, _("%s: integer expected after `%c'"), str, *num);
|
||||
error (EXIT_FAILURE, 0, _("%s: integer expected after `%c'"), str, *num);
|
||||
p->offset = (unsigned int) val;
|
||||
|
||||
if (*num == '-')
|
||||
@@ -1145,7 +1150,7 @@ parse_repeat_count (int argnum, struct control *p, char *str)
|
||||
|
||||
end = str + strlen (str) - 1;
|
||||
if (*end != '}')
|
||||
error (1, 0, _("%s: `}' is required in repeat count"), str);
|
||||
error (EXIT_FAILURE, 0, _("%s: `}' is required in repeat count"), str);
|
||||
*end = '\0';
|
||||
|
||||
if (str+1 == end-1 && *(str+1) == '*')
|
||||
@@ -1155,7 +1160,8 @@ parse_repeat_count (int argnum, struct control *p, char *str)
|
||||
if (xstrtoul (str + 1, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val > UINT_MAX)
|
||||
{
|
||||
error (1, 0, _("%s}: integer required between `{' and `}'"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s}: integer required between `{' and `}'"),
|
||||
global_argv[argnum]);
|
||||
}
|
||||
p->repeat = (unsigned int) val;
|
||||
@@ -1181,7 +1187,8 @@ extract_regexp (int argnum, boolean ignore, char *str)
|
||||
|
||||
closing_delim = strrchr (str + 1, delim);
|
||||
if (closing_delim == NULL)
|
||||
error (1, 0, _("%s: closing delimeter `%c' missing"), str, delim);
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s: closing delimeter `%c' missing"), str, delim);
|
||||
|
||||
len = closing_delim - str - 1;
|
||||
p = new_control_record ();
|
||||
@@ -1219,6 +1226,7 @@ parse_patterns (int argc, int start, char **argv)
|
||||
int i; /* Index into ARGV. */
|
||||
struct control *p; /* New control record created. */
|
||||
unsigned long val;
|
||||
static unsigned long last_val = 0;
|
||||
|
||||
for (i = start; i < argc; i++)
|
||||
{
|
||||
@@ -1230,9 +1238,25 @@ parse_patterns (int argc, int start, char **argv)
|
||||
{
|
||||
p = new_control_record ();
|
||||
p->argnum = i;
|
||||
|
||||
if (xstrtoul (argv[i], NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val > INT_MAX)
|
||||
error (1, 0, _("%s: invalid pattern"), argv[i]);
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid pattern"), argv[i]);
|
||||
if (val == 0)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s: line number must be greater than zero"),
|
||||
argv[i]);
|
||||
if (val < last_val)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("line number `%s' is smaller than preceding line number, %lu"),
|
||||
argv[i], last_val);
|
||||
|
||||
if (val == last_val)
|
||||
error (0, 0,
|
||||
_("warning: line number `%s' is the same as preceding line number"),
|
||||
argv[i]);
|
||||
last_val = val;
|
||||
|
||||
p->lines_required = (int) val;
|
||||
}
|
||||
|
||||
@@ -1352,14 +1376,16 @@ get_format_conv_type (char **format_ptr)
|
||||
break;
|
||||
|
||||
case 0:
|
||||
error (1, 0, _("missing conversion specifier in suffix"));
|
||||
error (EXIT_FAILURE, 0, _("missing conversion specifier in suffix"));
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ISPRINT (ch))
|
||||
error (1, 0, _("invalid conversion specifier in suffix: %c"), ch);
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid conversion specifier in suffix: %c"), ch);
|
||||
else
|
||||
error (1, 0, _("invalid conversion specifier in suffix: \\%.3o"), ch);
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid conversion specifier in suffix: \\%.3o"), ch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,14 +1416,16 @@ max_out (char *format)
|
||||
}
|
||||
|
||||
if (percents == 0)
|
||||
error (1, 0, _("missing %% conversion specification in suffix"));
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("missing %% conversion specification in suffix"));
|
||||
else if (percents > 1)
|
||||
error (1, 0, _("too many %% conversion specifications in suffix"));
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("too many %% conversion specifications in suffix"));
|
||||
|
||||
return out_count;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
@@ -1471,7 +1499,7 @@ main (int argc, char **argv)
|
||||
case 'n':
|
||||
if (xstrtoul (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val > INT_MAX)
|
||||
error (1, 0, _("%s: invalid number"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid number"), optarg);
|
||||
digits = (int) val;
|
||||
break;
|
||||
|
||||
@@ -1490,8 +1518,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("csplit - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("csplit - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -1520,7 +1548,7 @@ main (int argc, char **argv)
|
||||
cleanup_fatal ();
|
||||
}
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1559,5 +1587,5 @@ Read standard input if FILE is -. Each PATTERN may be:\n\
|
||||
A line OFFSET is a required `+' or `-' followed by a positive integer.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
13
src/cut.c
13
src/cut.c
@@ -72,7 +72,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#define FATAL_ERROR(s) \
|
||||
@@ -222,7 +221,7 @@ range, or many ranges separated by commas. Each range is one of:\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* The following function was copied from getline.c, but with these changes:
|
||||
@@ -670,7 +669,7 @@ cut_file (char *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc, exit_status = 0;
|
||||
@@ -737,8 +736,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("cut - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("cut - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -769,7 +768,7 @@ main (int argc, char **argv)
|
||||
exit_status = 1;
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status);
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
12
src/date.c
12
src/date.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "getline.h"
|
||||
#include "error.h"
|
||||
@@ -142,7 +141,7 @@ batch_convert (const char *input_filename, const char *format)
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
@@ -159,6 +158,9 @@ main (int argc, char **argv)
|
||||
int option_specified_date;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "d:f:r:Rs:u", long_options, NULL))
|
||||
!= EOF)
|
||||
@@ -196,7 +198,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("date - %s\n", version_string);
|
||||
printf ("date - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
9
src/dd.c
9
src/dd.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 Paul Rubin, David MacKenzie, and Stuart Kemp. */
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#define equal(p, q) (strcmp ((p),(q)) == 0)
|
||||
@@ -318,7 +317,7 @@ static struct option const long_options[] =
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
#ifdef _POSIX_VERSION
|
||||
@@ -340,7 +339,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("dd - %s\n", version_string);
|
||||
printf ("dd - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
9
src/df.c
9
src/df.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
--human-readable and --megabyte options added by lm@sgi.com. */
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "mountlist.h"
|
||||
#include "fsusage.h"
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
char *xmalloc ();
|
||||
@@ -144,7 +143,7 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
@@ -231,7 +230,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("df - %s\n", version_string);
|
||||
printf ("df - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 David MacKenzie and Jim Meyering. */
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -55,15 +54,18 @@ output `.' (meaning the current directory).\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
register char *path;
|
||||
register char *slash;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "dirname", version_string, usage);
|
||||
parse_long_options (argc, argv, "dirname", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
|
||||
9
src/du.c
9
src/du.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Differences from the Unix du:
|
||||
* Doesn't simply ignore the names of regular files given as arguments
|
||||
@@ -51,7 +51,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "save-cwd.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -239,7 +238,7 @@ Summarize disk usage of each FILE, recursively for directories.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -335,7 +334,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("du - %s\n", version_string);
|
||||
printf ("du - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
35
src/echo.c
35
src/echo.c
@@ -1,27 +1,24 @@
|
||||
/* echo.c, taken from Bash.
|
||||
/* echo.c, derived from code echo.c in Bash.
|
||||
Copyright (C) 87, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
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.
|
||||
|
||||
Bash 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.
|
||||
|
||||
Bash 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 Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
|
||||
/* echo [-neE] [arg ...]
|
||||
@@ -101,14 +98,18 @@ Without -E, the following sequences are recognized and interpolated:\n\
|
||||
/* Print the words in LIST to standard output. If the first word is
|
||||
`-n', then don't print a trailing newline. We also support the
|
||||
echo syntax from Version 9 unix systems. */
|
||||
void
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int display_return = 1, do_v9 = 0;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "echo", version_string, usage);
|
||||
parse_long_options (argc, argv, "echo", PACKAGE_VERSION, usage);
|
||||
|
||||
/* System V machines already have a /bin/sh with a v9 behaviour. We
|
||||
use the identical behaviour for these machines so that the
|
||||
|
||||
12
src/env.c
12
src/env.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Richard Mlynarik and David MacKenzie */
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -111,7 +110,7 @@ static struct option const longopts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (register int argc, register char **argv, char **envp)
|
||||
{
|
||||
char *dummy_environ[1];
|
||||
@@ -119,6 +118,9 @@ main (register int argc, register char **argv, char **envp)
|
||||
int ignore_environment = 0;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF)
|
||||
{
|
||||
@@ -138,7 +140,7 @@ main (register int argc, register char **argv, char **envp)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("env - %s\n", version_string);
|
||||
printf ("env - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
21
src/expand.c
21
src/expand.c
@@ -42,7 +42,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The number of bytes added at a time to the amount of memory
|
||||
@@ -130,7 +129,7 @@ With no FILE, or when FILE is -, read standard input.\n\
|
||||
Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Add tab stop TABVAL to the end of `tab_list', except
|
||||
@@ -169,7 +168,7 @@ parse_tabstops (char *stops)
|
||||
tabval = tabval * 10 + *stops - '0';
|
||||
}
|
||||
else
|
||||
error (1, 0, _("tab size contains an invalid character"));
|
||||
error (EXIT_FAILURE, 0, _("tab size contains an invalid character"));
|
||||
}
|
||||
|
||||
add_tabstop (tabval);
|
||||
@@ -187,9 +186,9 @@ validate_tabstops (int *tabs, int entries)
|
||||
for (i = 0; i < entries; i++)
|
||||
{
|
||||
if (tabs[i] == 0)
|
||||
error (1, 0, _("tab size cannot be 0"));
|
||||
error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
|
||||
if (tabs[i] <= prev_tab)
|
||||
error (1, 0, _("tab sizes must be ascending"));
|
||||
error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
|
||||
prev_tab = tabs[i];
|
||||
}
|
||||
}
|
||||
@@ -322,7 +321,7 @@ expand (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int tabval = -1; /* Value of tabstop being read, or -1. */
|
||||
@@ -368,8 +367,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("expand - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("expand - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -394,9 +393,9 @@ main (int argc, char **argv)
|
||||
expand ();
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status);
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
12
src/expr.c
12
src/expr.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Author: Mike Parker.
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <regex.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -149,14 +148,17 @@ Pattern matches return the string matched between \\( and \\) or null; if\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
VALUE *v;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "expr", version_string, usage);
|
||||
parse_long_options (argc, argv, "expr", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
|
||||
12
src/factor.c
12
src/factor.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 Paul Rubin <phr@ocf.berkeley.edu>.
|
||||
Adapted for GNU, fixed to factor UINT_MAX by Jim Meyering. */
|
||||
@@ -39,7 +39,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "xstrtoul.h"
|
||||
@@ -168,14 +167,17 @@ do_stdin (void)
|
||||
return fail;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int fail;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "factor", version_string, usage);
|
||||
parse_long_options (argc, argv, "factor", PACKAGE_VERSION, usage);
|
||||
|
||||
fail = 0;
|
||||
if (argc == 1)
|
||||
|
||||
11
src/fmt.c
11
src/fmt.c
@@ -40,7 +40,6 @@
|
||||
#define word unused_word_type
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -302,7 +301,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
In -wNUMBER, the letter `w' may be omitted.\n"),
|
||||
stdout);
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Decode options and launch execution. */
|
||||
@@ -384,7 +383,7 @@ main (register int argc, register char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid line number increment: `%s'"),
|
||||
error (EXIT_FAILURE, 0, _("invalid line number increment: `%s'"),
|
||||
optarg);
|
||||
max_width = (int) tmp_long;
|
||||
}
|
||||
@@ -398,8 +397,8 @@ main (register int argc, register char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("fmt - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("fmt - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -425,7 +424,7 @@ main (register int argc, register char **argv)
|
||||
error (0, errno, argv[optind]);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Trim space from the front and back of the string P, yielding the prefix,
|
||||
|
||||
18
src/fold.c
18
src/fold.c
@@ -39,7 +39,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "xstrtol.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -95,7 +94,7 @@ standard output.\n\
|
||||
-w, --width=WIDTH use WIDTH columns instead of 80\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Assuming the current column is COLUMN, return the column that
|
||||
@@ -246,7 +245,7 @@ fold_file (char *filename, int width)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int width = 80;
|
||||
@@ -297,7 +296,8 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid number of columns: `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of columns: `%s'"), optarg);
|
||||
width = (int) tmp_long;
|
||||
}
|
||||
break;
|
||||
@@ -309,8 +309,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("fold - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("fold - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -323,9 +323,9 @@ main (int argc, char **argv)
|
||||
errs |= fold_file (argv[i], width);
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (errs);
|
||||
exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# 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 David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -31,11 +31,11 @@ Same as id -Gn. If no USERNAME, use current process."
|
||||
|
||||
case $# in
|
||||
1 )
|
||||
case "z${1}" in
|
||||
case "z${1}" in
|
||||
z--help )
|
||||
echo "$usage"; exit 0 ;;
|
||||
z--version )
|
||||
echo "groups - @VERSION@"; exit 0 ;;
|
||||
echo "groups - @PKG_VERSION@"; exit 0 ;;
|
||||
* ) ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
21
src/head.c
21
src/head.c
@@ -30,7 +30,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* Number of lines/chars/blocks to head. */
|
||||
@@ -107,7 +106,7 @@ If -VALUE is used as first OPTION, read -c VALUE when one of\n\
|
||||
multipliers bkm follows concatenated, else read -n VALUE.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Convert STR, a string of ASCII digits, into an unsigned integer.
|
||||
@@ -176,7 +175,7 @@ head_bytes (const char *filename, int fd, long int bytes_to_write)
|
||||
if (bytes_read > bytes_to_write)
|
||||
bytes_read = bytes_to_write;
|
||||
if (fwrite (buffer, 1, bytes_read, stdout) == 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
bytes_to_write -= bytes_read;
|
||||
}
|
||||
return 0;
|
||||
@@ -204,7 +203,7 @@ head_lines (const char *filename, int fd, long int lines_to_write)
|
||||
if (buffer[bytes_to_write++] == '\n' && --lines_to_write == 0)
|
||||
break;
|
||||
if (fwrite (buffer, 1, bytes_to_write, stdout) == 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -249,7 +248,7 @@ head_file (const char *filename, long int number)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
enum header_mode header_mode = multiple_files;
|
||||
@@ -335,7 +334,7 @@ main (int argc, char **argv)
|
||||
/* FIXME: use xstrtoul instead. */
|
||||
number = atou (optarg);
|
||||
if (number == -1)
|
||||
error (1, 0, _("invalid number `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("invalid number `%s'"), optarg);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
@@ -353,8 +352,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("head - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("head - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -377,9 +376,9 @@ main (int argc, char **argv)
|
||||
exit_status |= head_file (argv[optind], number);
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status);
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Jim Meyering <meyering@comco.com> */
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -38,9 +37,9 @@ sethostname (name, namelen)
|
||||
{
|
||||
/* Using sysinfo() is the SVR4 mechanism to set a hostname. */
|
||||
int result;
|
||||
|
||||
|
||||
result = sysinfo (SI_SET_HOSTNAME, name, namelen);
|
||||
|
||||
|
||||
return (result == -1 ? result : 0);
|
||||
}
|
||||
|
||||
@@ -73,14 +72,17 @@ Print the hostname of the current system.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *hostname;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "hostname", version_string, usage);
|
||||
parse_long_options (argc, argv, "hostname", PACKAGE_VERSION, usage);
|
||||
|
||||
#ifdef HAVE_SETHOSTNAME
|
||||
if (argc == 2)
|
||||
|
||||
12
src/id.c
12
src/id.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 Arnold Robbins, arnold@audiofax.com.
|
||||
Major rewrite by David MacKenzie, djm@gnu.ai.mit.edu. */
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <grp.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -95,12 +94,15 @@ static struct option const longopts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "gnruG", longopts, (int *) 0))
|
||||
!= EOF)
|
||||
@@ -131,7 +133,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("id - %s\n", version_string);
|
||||
printf ("id - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Copy files and set their permission modes and, if possible,
|
||||
their owner and group. Used similarly to `cp'; typically
|
||||
@@ -60,7 +60,6 @@
|
||||
#include <grp.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "backupfile.h"
|
||||
#include "modechange.h"
|
||||
#include "makepath.h"
|
||||
@@ -156,7 +155,7 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
@@ -222,7 +221,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("install - %s\n", version_string);
|
||||
printf ("install - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
37
src/join.c
37
src/join.c
@@ -61,7 +61,6 @@ char *alloca ();
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "xstrtol.h"
|
||||
#include "error.h"
|
||||
@@ -199,7 +198,7 @@ the remaining fields from FILE1, the remaining fields from FILE2, all\n\
|
||||
separated by CHAR.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Like memcmp, but ignore differences in case. */
|
||||
@@ -766,7 +765,7 @@ make_blank (struct line *blank, int count)
|
||||
blank->lim = &blank->beg[i];
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *names[2];
|
||||
@@ -782,7 +781,7 @@ main (int argc, char **argv)
|
||||
it may be increased. */
|
||||
uni_blank.nfields = 1;
|
||||
|
||||
parse_long_options (argc, argv, "join", version_string, usage);
|
||||
parse_long_options (argc, argv, "join", PACKAGE_VERSION, usage);
|
||||
|
||||
nfiles = 0;
|
||||
print_pairables = 1;
|
||||
@@ -804,7 +803,7 @@ main (int argc, char **argv)
|
||||
case 'a':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| (val != 1 && val != 2))
|
||||
error (2, 0, _("invalid field number: `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("invalid field number: `%s'"), optarg);
|
||||
if (val == 1)
|
||||
print_unpairables_1 = 1;
|
||||
else
|
||||
@@ -823,7 +822,8 @@ main (int argc, char **argv)
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val <= 0 || val > INT_MAX)
|
||||
{
|
||||
error (2, 0, _("invalid field number for file 1: `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid field number for file 1: `%s'"), optarg);
|
||||
}
|
||||
join_field_1 = (int) val - 1;
|
||||
break;
|
||||
@@ -831,20 +831,21 @@ main (int argc, char **argv)
|
||||
case '2':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val <= 0 || val > INT_MAX)
|
||||
error (2, 0, _("invalid field number for file 2: `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid field number for file 2: `%s'"), optarg);
|
||||
join_field_2 = (int) val - 1;
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
|| val <= 0 || val > INT_MAX)
|
||||
error (2, 0, _("invalid field number: `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("invalid field number: `%s'"), optarg);
|
||||
join_field_1 = join_field_2 = (int) val - 1;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
if (add_field_list (optarg))
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
@@ -855,7 +856,7 @@ main (int argc, char **argv)
|
||||
if (prev_optc == 'o' && optind <= argc - 2)
|
||||
{
|
||||
if (add_field_list (optarg))
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
/* Might be continuation of args to -o. */
|
||||
continue; /* Don't change `prev_optc'. */
|
||||
@@ -887,22 +888,22 @@ main (int argc, char **argv)
|
||||
|
||||
fp1 = strcmp (names[0], "-") ? fopen (names[0], "r") : stdin;
|
||||
if (!fp1)
|
||||
error (1, errno, "%s", names[0]);
|
||||
error (EXIT_FAILURE, errno, "%s", names[0]);
|
||||
fp2 = strcmp (names[1], "-") ? fopen (names[1], "r") : stdin;
|
||||
if (!fp2)
|
||||
error (1, errno, "%s", names[1]);
|
||||
error (EXIT_FAILURE, errno, "%s", names[1]);
|
||||
if (fp1 == fp2)
|
||||
error (1, errno, _("both files cannot be standard input"));
|
||||
error (EXIT_FAILURE, errno, _("both files cannot be standard input"));
|
||||
join (fp1, fp2);
|
||||
|
||||
if (fp1 != stdin && fclose (fp1) == EOF)
|
||||
error (1, errno, "%s", names[0]);
|
||||
error (EXIT_FAILURE, errno, "%s", names[0]);
|
||||
if (fp2 != stdin && fclose (fp2) == EOF)
|
||||
error (1, errno, "%s", names[1]);
|
||||
error (EXIT_FAILURE, errno, "%s", names[1]);
|
||||
if ((fp1 == stdin || fp2 == stdin) && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
9
src/ln.c
9
src/ln.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 Mike Parker and David MacKenzie. */
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "backupfile.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
int link (); /* Some systems don't declare this anywhere. */
|
||||
@@ -298,7 +297,7 @@ version control may be set with VERSION_CONTROL, values are:\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -371,7 +370,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("ln - %s\n", version_string);
|
||||
printf ("ln - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,15 +12,14 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -58,13 +57,16 @@ Print the name of the current user.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
register char *cp;
|
||||
int c;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
@@ -80,7 +82,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("logname - %s\n", version_string);
|
||||
printf ("logname - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
9
src/ls.c
9
src/ls.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* If the macro MULTI_COL is defined,
|
||||
the multi-column format is the default regardless
|
||||
@@ -60,7 +60,6 @@
|
||||
|
||||
#include "obstack.h"
|
||||
#include "ls.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "argmatch.h"
|
||||
|
||||
@@ -618,7 +617,7 @@ dired_dump_obstack (const char *prefix, struct obstack *os)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
register int i;
|
||||
@@ -639,7 +638,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("ls - %s\n", version_string);
|
||||
printf ("ls - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "getline.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "version.h"
|
||||
|
||||
/* Most systems do not distinguish between external and internal
|
||||
text representations. */
|
||||
@@ -119,7 +118,7 @@ a line with checksum, a character indicating type (`*' for binary, ` ' for\n\
|
||||
text), and name for each FILE.\n"),
|
||||
program_name, program_name, program_name);
|
||||
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* FIXME: this format loses with filenames containing newline. */
|
||||
@@ -403,7 +402,7 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "md5sum", version_string, usage);
|
||||
parse_long_options (argc, argv, "md5sum", PACKAGE_VERSION, usage);
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "bctw", long_options, NULL))
|
||||
!= EOF)
|
||||
@@ -444,7 +443,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (do_version)
|
||||
{
|
||||
printf ("md5sum - %s\n", version_string);
|
||||
printf ("md5sum - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
10
src/mkdir.c
10
src/mkdir.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-p, --parent Ensure that the given path(s) exist:
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "system.h"
|
||||
#include "modechange.h"
|
||||
#include "makepath.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -80,8 +79,7 @@ Create the DIRECTORY(ies), if they do not already exist.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned int newmode;
|
||||
@@ -116,7 +114,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("mkdir - %s\n", version_string);
|
||||
printf ("mkdir - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-m, --mode=mode Set the mode of created fifo's to MODE, which is
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "modechange.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -70,7 +69,7 @@ Create named pipes (FIFOs) with the given NAMEs.\n\
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned short newmode;
|
||||
@@ -105,7 +104,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("mkfifo - %s\n", version_string);
|
||||
printf ("mkfifo - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Usage: mknod [-m mode] [--mode=mode] path {bcu} major minor
|
||||
make a block or character device node
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "modechange.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -80,7 +79,7 @@ MAJOR MINOR are forbidden for TYPE p, mandatory otherwise. TYPE may be:\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned short newmode;
|
||||
@@ -114,7 +113,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("mknod - %s\n", version_string);
|
||||
printf ("mknod - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
9
src/mv.c
9
src/mv.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-f, --force Assume a 'y' answer to all questions it would
|
||||
@@ -48,7 +48,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "backupfile.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
@@ -400,7 +399,7 @@ version control may be set with VERSION_CONTROL, values are:\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -459,7 +458,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("mv - %s\n", version_string);
|
||||
printf ("mv - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
13
src/nice.c
13
src/nice.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
@@ -53,7 +52,7 @@ static struct option const longopts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int current_priority;
|
||||
@@ -64,7 +63,11 @@ main (int argc, char **argv)
|
||||
int last_optind = 0;
|
||||
|
||||
program_name = argv[0];
|
||||
parse_long_options (argc, argv, "nice", version_string, usage);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "nice", PACKAGE_VERSION, usage);
|
||||
|
||||
for (optind = 1; optind < argc; /* empty */)
|
||||
{
|
||||
|
||||
24
src/nl.c
24
src/nl.c
@@ -44,7 +44,6 @@
|
||||
|
||||
#include "linebuffer.h"
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -231,7 +230,7 @@ FORMAT is one of:\n\
|
||||
\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Build the printf format string, based on `lineno_format'. */
|
||||
@@ -282,7 +281,7 @@ build_type_arg (char **typep, struct re_pattern_buffer *regexp)
|
||||
regexp->fastmap_accurate = 0;
|
||||
errmsg = re_compile_pattern (optarg, optlen, regexp);
|
||||
if (errmsg)
|
||||
error (1, 0, "%s", errmsg);
|
||||
error (EXIT_FAILURE, 0, "%s", errmsg);
|
||||
break;
|
||||
default:
|
||||
rval = FALSE;
|
||||
@@ -460,7 +459,7 @@ nl_file (const char *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c, exit_status = 0;
|
||||
@@ -498,7 +497,7 @@ main (int argc, char **argv)
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
/* Allow it to be negative. */
|
||||
|| tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid starting line number: `%s'"),
|
||||
error (EXIT_FAILURE, 0, _("invalid starting line number: `%s'"),
|
||||
optarg);
|
||||
starting_line_number = (int) tmp_long;
|
||||
}
|
||||
@@ -508,7 +507,7 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid line number increment: `%s'"),
|
||||
error (EXIT_FAILURE, 0, _("invalid line number increment: `%s'"),
|
||||
optarg);
|
||||
page_incr = (int) tmp_long;
|
||||
}
|
||||
@@ -521,7 +520,7 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid number of blank lines: `%s'"),
|
||||
error (EXIT_FAILURE, 0, _("invalid number of blank lines: `%s'"),
|
||||
optarg);
|
||||
blank_join = (int) tmp_long;
|
||||
}
|
||||
@@ -534,7 +533,8 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid line number field width: `%s'"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid line number field width: `%s'"),
|
||||
optarg);
|
||||
lineno_width = (int) tmp_long;
|
||||
}
|
||||
@@ -578,8 +578,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("nl - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("nl - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -628,7 +628,7 @@ main (int argc, char **argv)
|
||||
exit_status = 1;
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status);
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# 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 David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -41,11 +41,11 @@ fi
|
||||
|
||||
case $# in
|
||||
1 )
|
||||
case "z${1}" in
|
||||
case "z${1}" in
|
||||
z--help )
|
||||
echo "$usage"; echo "$usage_help"; exit 0 ;;
|
||||
z--version )
|
||||
echo "nohup - @VERSION@"; exit 0 ;;
|
||||
echo "nohup - @PKG_VERSION@"; exit 0 ;;
|
||||
* ) ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
28
src/od.c
28
src/od.c
@@ -44,7 +44,6 @@ char *alloca ();
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "xstrtoul.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -387,7 +386,7 @@ number implies 3. -w without a number implies 32. By default, od\n\
|
||||
uses -A o -t d2 -w 16.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Compute the greatest common denominator of U and V
|
||||
@@ -1038,7 +1037,7 @@ skip (off_t n_skip)
|
||||
}
|
||||
|
||||
if (n_skip != 0)
|
||||
error (2, 0, _("cannot skip past end of combined input"));
|
||||
error (EXIT_FAILURE, 0, _("cannot skip past end of combined input"));
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -1655,8 +1654,9 @@ main (int argc, char **argv)
|
||||
address_pad_len = 0;
|
||||
break;
|
||||
default:
|
||||
error (2, 0,
|
||||
_("invalid output address radix `%c'; it must be one character from [doxn]"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid output address radix `%c'; \
|
||||
it must be one character from [doxn]"),
|
||||
optarg[0]);
|
||||
break;
|
||||
}
|
||||
@@ -1680,7 +1680,8 @@ main (int argc, char **argv)
|
||||
STRTOL_FATAL_ERROR (optarg, _("limit argument"), s_err);
|
||||
|
||||
if (tmp > OFF_T_MAX)
|
||||
error (2, 0, _("specified number of bytes `%s' is larger than \
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("specified number of bytes `%s' is larger than \
|
||||
the maximum\nrepresentable value of type off_t"), optarg);
|
||||
break;
|
||||
|
||||
@@ -1698,7 +1699,7 @@ the maximum\nrepresentable value of type off_t"), optarg);
|
||||
|
||||
case 't':
|
||||
if (decode_format_string (optarg))
|
||||
error (2, 0, _("invalid type string `%s'"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("invalid type string `%s'"), optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
@@ -1758,15 +1759,16 @@ the maximum\nrepresentable value of type off_t"), optarg);
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("od - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("od - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
usage (0);
|
||||
|
||||
if (flag_dump_strings && n_specs > 0)
|
||||
error (2, 0, _("no type may be specified when dumping strings"));
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("no type may be specified when dumping strings"));
|
||||
|
||||
n_files = argc - optind;
|
||||
|
||||
@@ -1929,10 +1931,10 @@ the maximum\nrepresentable value of type off_t"), optarg);
|
||||
cleanup:;
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (2, errno, _("standard input"));
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
error (2, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (err);
|
||||
exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
19
src/paste.c
19
src/paste.c
@@ -44,7 +44,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
char *xmalloc ();
|
||||
@@ -207,7 +206,7 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
{
|
||||
fileptr[files_open] = fopen (fnamptr[files_open], "r");
|
||||
if (fileptr[files_open] == NULL)
|
||||
error (1, errno, "%s", fnamptr[files_open]);
|
||||
error (EXIT_FAILURE, errno, "%s", fnamptr[files_open]);
|
||||
else if (fileno (fileptr[files_open]) == 0)
|
||||
opened_stdin = 1;
|
||||
}
|
||||
@@ -216,7 +215,7 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
fileptr[files_open] = ENDLIST;
|
||||
|
||||
if (opened_stdin && have_read_stdin)
|
||||
error (1, 0, _("standard input is closed"));
|
||||
error (EXIT_FAILURE, 0, _("standard input is closed"));
|
||||
|
||||
/* Read a line from each file and output it to stdout separated by a
|
||||
delimiter, until we go through the loop without successfully
|
||||
@@ -427,10 +426,10 @@ With no FILE, or when FILE is -, read standard input.\n\
|
||||
\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc, exit_status;
|
||||
@@ -473,8 +472,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("paste - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("paste - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -490,8 +489,8 @@ main (int argc, char **argv)
|
||||
else
|
||||
exit_status = paste_serial (argc - optind, &argv[optind]);
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
exit (exit_status);
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Usage: pathchk [-p] [--portability] path...
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -113,7 +112,7 @@ static struct option const longopts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int exit_status = 0;
|
||||
@@ -121,6 +120,9 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "p", longopts, (int *) 0)) != EOF)
|
||||
{
|
||||
@@ -140,7 +142,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("pathchk - %s\n", version_string);
|
||||
printf ("pathchk - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -339,7 +341,7 @@ validate_path (char *path, int portability)
|
||||
if (path_max < 0)
|
||||
path_max = _POSIX_PATH_MAX;
|
||||
free (parent);
|
||||
if (strlen (path) > path_max)
|
||||
if (strlen (path) > (size_t) path_max)
|
||||
{
|
||||
error (0, 0, _("path `%s' has length %d; exceeds limit of %d"),
|
||||
path, strlen (path), path_max);
|
||||
|
||||
25
src/pr.c
25
src/pr.c
@@ -101,7 +101,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
char *xmalloc ();
|
||||
@@ -458,7 +457,7 @@ cols_ready_to_print (void)
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -617,19 +616,19 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("pr - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("pr - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
usage (0);
|
||||
|
||||
if (parallel_files && explicit_columns)
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("Cannot specify number of columns when printing in parallel."));
|
||||
|
||||
if (parallel_files && print_across_flag)
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("Cannot specify both printing across and printing in parallel."));
|
||||
|
||||
for ( ; optind < argc; optind++)
|
||||
@@ -657,12 +656,12 @@ main (int argc, char **argv)
|
||||
cleanup ();
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, _("standard input"));
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
if (failed_opens > 0)
|
||||
exit(1);
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Parse options of the form -scNNN.
|
||||
@@ -746,7 +745,7 @@ init_parameters (int number_of_files)
|
||||
(columns - 1) * chars_per_gutter) / columns;
|
||||
|
||||
if (chars_per_column < 1)
|
||||
error (1, 0, _("page width too narrow"));
|
||||
error (EXIT_FAILURE, 0, _("page width too narrow"));
|
||||
|
||||
if (numbered_lines)
|
||||
{
|
||||
@@ -958,9 +957,9 @@ close_file (COLUMN *p)
|
||||
if (p->status == CLOSED)
|
||||
return;
|
||||
if (ferror (p->fp))
|
||||
error (1, errno, "%s", p->name);
|
||||
error (EXIT_FAILURE, errno, "%s", p->name);
|
||||
if (p->fp != stdin && fclose (p->fp) == EOF)
|
||||
error (1, errno, "%s", p->name);
|
||||
error (EXIT_FAILURE, errno, "%s", p->name);
|
||||
|
||||
if (!parallel_files)
|
||||
{
|
||||
@@ -1885,5 +1884,5 @@ Paginate or columnate FILE(s) for printing.\n\
|
||||
spaces. With no FILE, or when FILE is -, read standard input.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Usage: printenv [variable...]
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -72,7 +71,7 @@ If no environment VARIABLE specified, print them all.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char **env;
|
||||
@@ -83,6 +82,9 @@ main (int argc, char **argv)
|
||||
int exit_status;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
@@ -98,7 +100,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("printenv - %s\n", version_string);
|
||||
printf ("printenv - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
13
src/printf.c
13
src/printf.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Usage: printf format [argument...]
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -125,16 +124,20 @@ ARGUMENTs converted to proper type first. Variable widths are handled.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *format;
|
||||
int args_used;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
exit_status = 0;
|
||||
|
||||
parse_long_options (argc, argv, "printf", version_string, usage);
|
||||
parse_long_options (argc, argv, "printf", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
|
||||
12
src/pwd.c
12
src/pwd.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Jim Meyering <meyering@comco.com> */
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -50,14 +49,17 @@ Print the full filename of the current working directory.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *wd;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "pwd", version_string, usage);
|
||||
parse_long_options (argc, argv, "pwd", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc != 1)
|
||||
error (0, 0, _("ignoring non-option arguments"));
|
||||
|
||||
9
src/rm.c
9
src/rm.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 Paul Rubin, David MacKenzie, and Richard Stallman. */
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifdef D_INO_IN_DIRENT
|
||||
@@ -111,7 +110,7 @@ static struct option const long_opts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int err = 0;
|
||||
@@ -158,7 +157,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("rm - %s\n", version_string);
|
||||
printf ("rm - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-p, --parent Remove any parent dirs that are explicitly mentioned
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
void strip_trailing_slashes ();
|
||||
@@ -95,7 +94,7 @@ Remove the DIRECTORY(ies), if they are empty.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int errors = 0;
|
||||
@@ -124,7 +123,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("rmdir - %s\n", version_string);
|
||||
printf ("rmdir - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
89
src/seq.c
89
src/seq.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 Ulrich Drepper. */
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "version.h"
|
||||
#include "xstrtod.h"
|
||||
|
||||
static double scan_double_arg __P ((char *arg));
|
||||
static int check_format __P ((char *format_string));
|
||||
static double scan_double_arg __P ((const char *arg));
|
||||
static int check_format __P ((const char *format_string));
|
||||
static char *get_width_format __P ((void));
|
||||
static int print_numbers __P ((char *format_str));
|
||||
static int print_numbers __P ((const char *format_str));
|
||||
|
||||
/* If nonzero print all number with equal width. */
|
||||
static int equal_width;
|
||||
@@ -38,14 +38,19 @@ static int equal_width;
|
||||
static char *format_str;
|
||||
|
||||
/* The starting number. */
|
||||
static double from;
|
||||
static double first;
|
||||
|
||||
/* The name that this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The string used to separate two number. */
|
||||
/* The string used to separate two numbers. */
|
||||
static char *separator;
|
||||
|
||||
/* The string output after all numbers have been output.
|
||||
Usually "\n" or "\0". */
|
||||
/* FIXME: make this an option. */
|
||||
static char *terminator = "\n";
|
||||
|
||||
/* If nonzero, display usage information and exit. */
|
||||
static int show_help;
|
||||
|
||||
@@ -77,7 +82,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
(void) printf (_("\
|
||||
Usage: %s [OPTION]... [from [step]] to\n\
|
||||
Usage: %s [OPTION]... [FIRST [step]] LAST\n\
|
||||
"), program_name);
|
||||
(void) printf (_("\
|
||||
\n\
|
||||
@@ -95,7 +100,7 @@ Usage: %s [OPTION]... [from [step]] to\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int errs;
|
||||
@@ -103,10 +108,14 @@ main (int argc, char **argv)
|
||||
int step_is_set;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
equal_width = 0;
|
||||
format_str = NULL;
|
||||
separator = "\n";
|
||||
from = 1.0;
|
||||
first = 1.0;
|
||||
step_is_set = 0;
|
||||
|
||||
/* We have to handle negative numbers in the command line but this
|
||||
@@ -147,7 +156,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
(void) printf ("seq - %s\n", version_string);
|
||||
(void) printf ("seq - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -167,7 +176,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
from = last;
|
||||
first = last;
|
||||
last = scan_double_arg (argv[optind++]);
|
||||
|
||||
if (optind < argc)
|
||||
@@ -193,7 +202,7 @@ format string may not be specified when printing equal width strings"));
|
||||
|
||||
if (!step_is_set)
|
||||
{
|
||||
step = from <= last ? 1.0 : -1.0;
|
||||
step = first <= last ? 1.0 : -1.0;
|
||||
}
|
||||
|
||||
if (format_str != NULL)
|
||||
@@ -222,16 +231,13 @@ format string may not be specified when printing equal width strings"));
|
||||
Return if the string is correct else signal error. */
|
||||
|
||||
static double
|
||||
scan_double_arg (char *arg)
|
||||
scan_double_arg (const char *arg)
|
||||
{
|
||||
char *end_ptr;
|
||||
double ret_val;
|
||||
|
||||
/* FIXME: use xstrtod? At least set and check errno. */
|
||||
ret_val = strtod (arg, &end_ptr);
|
||||
if (end_ptr == arg || *end_ptr != '\0')
|
||||
if (xstrtod (arg, NULL, &ret_val))
|
||||
{
|
||||
error (0, 0, _("invalid float argument: %s"), arg);
|
||||
error (0, 0, _("invalid floating point argument: %s"), arg);
|
||||
usage (1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
@@ -244,7 +250,7 @@ scan_double_arg (char *arg)
|
||||
Return 0 if not, 1 if correct. */
|
||||
|
||||
static int
|
||||
check_format (char *format_string)
|
||||
check_format (const char *format_string)
|
||||
{
|
||||
while (*format_string != '\0')
|
||||
{
|
||||
@@ -305,15 +311,15 @@ get_width_format ()
|
||||
double min_val;
|
||||
double temp;
|
||||
|
||||
if (from > last)
|
||||
if (first > last)
|
||||
{
|
||||
min_val = from - step * floor ((from - last) / step);
|
||||
max_val = from;
|
||||
min_val = first - step * floor ((first - last) / step);
|
||||
max_val = first;
|
||||
}
|
||||
else
|
||||
{
|
||||
min_val = from;
|
||||
max_val = from + step * floor ((last - from) / step);
|
||||
min_val = first;
|
||||
max_val = first + step * floor ((last - first) / step);
|
||||
}
|
||||
|
||||
(void) sprintf (buffer, "%g", rint (max_val));
|
||||
@@ -380,10 +386,12 @@ get_width_format (void)
|
||||
/* Actually print the sequence of numbers in the specified range, with the
|
||||
given or default stepping and format. */
|
||||
static int
|
||||
print_numbers (char *format_str)
|
||||
print_numbers (const char *format_str)
|
||||
{
|
||||
if (from > last)
|
||||
if (first > last)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (step >= 0)
|
||||
{
|
||||
error (0, 0, _("invalid increment: %g"), step);
|
||||
@@ -391,20 +399,21 @@ print_numbers (char *format_str)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
while (1)
|
||||
for (i = 0; /* empty */; i++)
|
||||
{
|
||||
(void) printf (format_str, from);
|
||||
double x = first + i * step;
|
||||
printf (format_str, x);
|
||||
|
||||
/* FIXME: don't increment!!! Use `first + i * step'. */
|
||||
from += step;
|
||||
if (from < last)
|
||||
if (x <= last)
|
||||
break;
|
||||
|
||||
(void) fputs (separator, stdout);
|
||||
fputs (separator, stdout);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
if (step <= 0)
|
||||
{
|
||||
error (0, 0, _("invalid increment: %g"), step);
|
||||
@@ -412,18 +421,18 @@ print_numbers (char *format_str)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
while (1)
|
||||
for (i = 0; /* empty */; i++)
|
||||
{
|
||||
(void) printf (format_str, from);
|
||||
double x = first + i * step;
|
||||
printf (format_str, x);
|
||||
|
||||
/* FIXME: don't increment!!! Use `first + i * step'. */
|
||||
from += step;
|
||||
if (from > last)
|
||||
if (x >= last)
|
||||
break;
|
||||
|
||||
(void) fputs (separator, stdout);
|
||||
fputs (separator, stdout);
|
||||
}
|
||||
}
|
||||
fputs (terminator, stdout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
12
src/sleep.c
12
src/sleep.c
@@ -12,15 +12,14 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -61,7 +60,7 @@ SUFFIX may be s to keep seconds, m for minutes, h for hours or d for days.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
@@ -69,6 +68,9 @@ main (int argc, char **argv)
|
||||
int c;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
@@ -84,7 +86,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("sleep - %s\n", version_string);
|
||||
printf ("sleep - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
70
src/sort.c
70
src/sort.c
@@ -27,8 +27,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#define NDEBUG 1
|
||||
#include <assert.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "xstrtod.h"
|
||||
@@ -57,6 +58,13 @@ void free ();
|
||||
#define DEFAULT_TMPDIR "/tmp"
|
||||
#endif
|
||||
|
||||
/* Use this as exit status in case of error, not EXIT_FAILURE. This
|
||||
is necessary because EXIT_FAILURE is usually 1 and POSIX requires
|
||||
that sort exit with status 1 IFF invoked with -c and the input is
|
||||
not properly sorted. Any other irregular exit must exit with a
|
||||
status code greater than 1. */
|
||||
#define SORT_FAILURE 2
|
||||
|
||||
/* The kind of blanks for '-b' to skip in various options. */
|
||||
enum blanktype { bl_start, bl_end, bl_both };
|
||||
|
||||
@@ -240,6 +248,10 @@ FILE, or when FILE is -, read standard input.\n\
|
||||
")
|
||||
, DEFAULT_TMPDIR);
|
||||
}
|
||||
/* Don't use EXIT_FAILURE here in case it is defined to be 1.
|
||||
POSIX requires that sort return 1 IFF invoked with -c and
|
||||
the input is not properly sorted. */
|
||||
assert (status == 0 || status == SORT_FAILURE);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
@@ -273,7 +285,7 @@ xmalloc (unsigned int n)
|
||||
{
|
||||
error (0, 0, _("virtual memory exhausted"));
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@@ -298,7 +310,7 @@ xrealloc (char *p, unsigned int n)
|
||||
{
|
||||
error (0, 0, _("virtual memory exhausted"));
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@@ -314,7 +326,7 @@ xtmpfopen (const char *file)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
|
||||
return fp;
|
||||
@@ -335,7 +347,7 @@ xfopen (const char *file, const char *how)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +371,7 @@ xfclose (FILE *fp)
|
||||
{
|
||||
error (0, errno, _("flushing file"));
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -368,7 +380,7 @@ xfclose (FILE *fp)
|
||||
{
|
||||
error (0, errno, _("error closing file"));
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,7 +392,7 @@ write_bytes (const char *buf, size_t n_bytes, FILE *fp)
|
||||
{
|
||||
error (0, errno, _("write error"));
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,7 +504,7 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
{
|
||||
error (0, errno, _("read error"));
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
buf->used += cc;
|
||||
}
|
||||
@@ -1586,7 +1598,7 @@ insertkey (struct keyfield *key)
|
||||
static void
|
||||
badfieldspec (const char *s)
|
||||
{
|
||||
error (2, 0, _("invalid field specification `%s'"), s);
|
||||
error (SORT_FAILURE, 0, _("invalid field specification `%s'"), s);
|
||||
}
|
||||
|
||||
/* Handle interrupts and hangups. */
|
||||
@@ -1660,7 +1672,7 @@ set_ordering (register const char *s, struct keyfield *key,
|
||||
return (char *) s;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct keyfield *key = NULL, gkey;
|
||||
@@ -1678,7 +1690,7 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "sort", version_string, usage);
|
||||
parse_long_options (argc, argv, "sort", PACKAGE_VERSION, usage);
|
||||
|
||||
have_read_stdin = 0;
|
||||
inittables ();
|
||||
@@ -1761,7 +1773,7 @@ main (int argc, char **argv)
|
||||
if (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])]))
|
||||
{
|
||||
if (!key)
|
||||
usage (2);
|
||||
usage (SORT_FAILURE);
|
||||
for (t = 0; digits[UCHAR (*s)]; ++s)
|
||||
t = t * 10 + *s - '0';
|
||||
t2 = 0;
|
||||
@@ -1793,7 +1805,8 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
if (i == argc - 1)
|
||||
error (2, 0, _("option `-k' requires an argument"));
|
||||
error (SORT_FAILURE, 0,
|
||||
_("option `-k' requires an argument"));
|
||||
else
|
||||
s = argv[++i];
|
||||
}
|
||||
@@ -1913,7 +1926,8 @@ but lacks following character offset"));
|
||||
else
|
||||
{
|
||||
if (i == argc - 1)
|
||||
error (2, 0, _("option `-o' requires an argument"));
|
||||
error (SORT_FAILURE, 0,
|
||||
_("option `-o' requires an argument"));
|
||||
else
|
||||
outfile = argv[++i];
|
||||
}
|
||||
@@ -1930,7 +1944,8 @@ but lacks following character offset"));
|
||||
goto outer;
|
||||
}
|
||||
else
|
||||
error (2, 0, _("option `-t' requires an argument"));
|
||||
error (SORT_FAILURE, 0,
|
||||
_("option `-t' requires an argument"));
|
||||
break;
|
||||
case 'T':
|
||||
if (s[1])
|
||||
@@ -1940,7 +1955,8 @@ but lacks following character offset"));
|
||||
if (i < argc - 1)
|
||||
temp_file_prefix = argv[++i];
|
||||
else
|
||||
error (2, 0, _("option `-T' requires an argument"));
|
||||
error (SORT_FAILURE, 0,
|
||||
_("option `-T' requires an argument"));
|
||||
}
|
||||
goto outer;
|
||||
/* break; */
|
||||
@@ -1957,7 +1973,7 @@ but lacks following character offset"));
|
||||
default:
|
||||
fprintf (stderr, _("%s: unrecognized option `-%c'\n"),
|
||||
argv[0], *s);
|
||||
usage (2);
|
||||
usage (SORT_FAILURE);
|
||||
}
|
||||
if (*s)
|
||||
++s;
|
||||
@@ -2002,7 +2018,11 @@ but lacks following character offset"));
|
||||
}
|
||||
|
||||
if (checkonly)
|
||||
exit (check (files, nfiles) != 0);
|
||||
{
|
||||
/* POSIX requires that sort return 1 IFF invoked with -c and the
|
||||
input is not properly sorted. */
|
||||
exit (check (files, nfiles) == 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
if (strcmp (outfile, "-"))
|
||||
{
|
||||
@@ -2033,7 +2053,7 @@ but lacks following character offset"));
|
||||
{
|
||||
error (0, errno, "%s", files[i]);
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
if (S_ISREG (instat.st_mode)
|
||||
&& (instat.st_ino != outstat.st_ino
|
||||
@@ -2053,7 +2073,7 @@ but lacks following character offset"));
|
||||
{
|
||||
error (0, errno, "%s", files[i]);
|
||||
cleanup ();
|
||||
exit (2);
|
||||
exit (SORT_FAILURE);
|
||||
}
|
||||
xfclose (ofp);
|
||||
xfclose (fp);
|
||||
@@ -2077,12 +2097,12 @@ but lacks following character offset"));
|
||||
Solaris, Ultrix, and Irix. This premature fflush makes the output
|
||||
reappear. --karl@cs.umb.edu */
|
||||
if (fflush (ofp) < 0)
|
||||
error (1, errno, _("%s: write error"), outfile);
|
||||
error (SORT_FAILURE, errno, _("%s: write error"), outfile);
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, outfile);
|
||||
error (SORT_FAILURE, errno, outfile);
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (1, errno, _("%s: write error"), outfile);
|
||||
error (SORT_FAILURE, errno, _("%s: write error"), outfile);
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
31
src/split.c
31
src/split.c
@@ -40,7 +40,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -122,7 +121,7 @@ PREFIX is `x'. With no INPUT, or when INPUT is -, read standard input.\n\
|
||||
SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Compute the next sequential output file name suffix and store it
|
||||
@@ -177,17 +176,17 @@ cwrite (int new_file_flag, const char *bp, int bytes)
|
||||
if (new_file_flag)
|
||||
{
|
||||
if (output_desc >= 0 && close (output_desc) < 0)
|
||||
error (1, errno, "%s", outfile);
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
|
||||
next_file_name ();
|
||||
if (verbose)
|
||||
fprintf (stderr, _("creating file `%s'\n"), outfile);
|
||||
output_desc = open (outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||
if (output_desc < 0)
|
||||
error (1, errno, "%s", outfile);
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
}
|
||||
if (full_write (output_desc, bp, bytes) < 0)
|
||||
error (1, errno, "%s", outfile);
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
}
|
||||
|
||||
/* Read NCHARS bytes from the input file into BUF.
|
||||
@@ -229,7 +228,7 @@ bytes_split (int nchars, char *buf, int bufsize)
|
||||
{
|
||||
n_read = stdread (buf, bufsize);
|
||||
if (n_read < 0)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
bp_out = buf;
|
||||
to_read = n_read;
|
||||
for (;;)
|
||||
@@ -272,7 +271,7 @@ lines_split (int nlines, char *buf, int bufsize)
|
||||
{
|
||||
n_read = stdread (buf, bufsize);
|
||||
if (n_read < 0)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
bp = bp_out = buf;
|
||||
eob = bp + n_read;
|
||||
*eob = '\n';
|
||||
@@ -321,7 +320,7 @@ line_bytes_split (int nchars)
|
||||
|
||||
n_read = stdread (buf + n_buffered, nchars - n_buffered);
|
||||
if (n_read < 0)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
|
||||
n_buffered += n_read;
|
||||
if (n_buffered != nchars)
|
||||
@@ -353,7 +352,7 @@ line_bytes_split (int nchars)
|
||||
free (buf);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
@@ -454,8 +453,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("split - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("split - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -490,7 +489,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
input_desc = open (infile, O_RDONLY);
|
||||
if (input_desc < 0)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
}
|
||||
|
||||
/* No output file is open now. */
|
||||
@@ -510,7 +509,7 @@ main (int argc, char **argv)
|
||||
/* Get the optimal block size of input device and make a buffer. */
|
||||
|
||||
if (fstat (input_desc, &stat_buf) < 0)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
in_blk_size = ST_BLKSIZE (stat_buf);
|
||||
|
||||
buf = xmalloc (in_blk_size + 1);
|
||||
@@ -535,9 +534,9 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (close (input_desc) < 0)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
if (output_desc >= 0 && close (output_desc) < 0)
|
||||
error (1, errno, "%s", outfile);
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
26
src/stty.c
26
src/stty.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Usage: stty [-ag] [--all] [--save] [setting...]
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
@@ -637,7 +636,7 @@ settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct termios mode;
|
||||
@@ -650,8 +649,11 @@ main (int argc, char **argv)
|
||||
int k;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "stty", version_string, usage);
|
||||
parse_long_options (argc, argv, "stty", PACKAGE_VERSION, usage);
|
||||
|
||||
output_type = changed;
|
||||
verbose_output = 0;
|
||||
@@ -918,14 +920,14 @@ main (int argc, char **argv)
|
||||
if (speed_was_set || memcmp (&mode, &new_mode, sizeof (mode)) != 0)
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
error (1, 0,
|
||||
size_t i;
|
||||
error (1, 0,
|
||||
_("standard input: unable to perform all requested operations"));
|
||||
printf (_("new_mode: mode\n"));
|
||||
for (i=0; i<sizeof(new_mode); i++)
|
||||
printf ("0x%02x: 0x%02x\n",
|
||||
*(((unsigned char *) &new_mode) + i),
|
||||
*(((unsigned char *) &mode) + i));
|
||||
printf (_("new_mode: mode\n"));
|
||||
for (i = 0; i < sizeof (new_mode); i++)
|
||||
printf ("0x%02x: 0x%02x\n",
|
||||
*(((unsigned char *) &new_mode) + i),
|
||||
*(((unsigned char *) &mode) + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
572
src/su.c
572
src/su.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Run a shell with the real and effective UID and GID and groups
|
||||
of USER, default `root'.
|
||||
@@ -79,7 +79,6 @@
|
||||
|
||||
#if defined(HAVE_SYSLOG_H) && defined(HAVE_SYSLOG)
|
||||
#include <syslog.h>
|
||||
static void log_su ();
|
||||
#else /* !HAVE_SYSLOG_H */
|
||||
#ifdef SYSLOG_SUCCESS
|
||||
#undef SYSLOG_SUCCESS
|
||||
@@ -113,7 +112,6 @@ uid_t getuid ();
|
||||
#include <shadow.h>
|
||||
#endif
|
||||
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The default PATH for simulated logins to non-superuser accounts. */
|
||||
@@ -139,16 +137,6 @@ char *xmalloc ();
|
||||
char *xrealloc ();
|
||||
char *xstrdup ();
|
||||
|
||||
static char *concat ();
|
||||
static int correct_password ();
|
||||
static int elements ();
|
||||
static int restricted_shell ();
|
||||
static void change_identity ();
|
||||
static void modify_environment ();
|
||||
static void run_shell ();
|
||||
static void usage ();
|
||||
static void xputenv ();
|
||||
|
||||
extern char **environ;
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -181,10 +169,273 @@ static struct option const longopts[] =
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
void
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
/* Add VAL to the environment, checking for out of memory errors. */
|
||||
|
||||
static void
|
||||
xputenv (const char *val)
|
||||
{
|
||||
if (putenv (val))
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
}
|
||||
|
||||
/* Return a newly-allocated string whose contents concatenate
|
||||
those of S1, S2, S3. */
|
||||
|
||||
static char *
|
||||
concat (const char *s1, const char *s2, const char *s3)
|
||||
{
|
||||
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
||||
char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
|
||||
|
||||
strcpy (result, s1);
|
||||
strcpy (result + len1, s2);
|
||||
strcpy (result + len1 + len2, s3);
|
||||
result[len1 + len2 + len3] = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return the number of elements in ARR, a null-terminated array. */
|
||||
|
||||
static int
|
||||
elements (char **arr)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
for (n = 0; *arr; ++arr)
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
#if defined (SYSLOG_SUCCESS) || defined (SYSLOG_FAILURE)
|
||||
/* Log the fact that someone has run su to the user given by PW;
|
||||
if SUCCESSFUL is nonzero, they gave the correct password, etc. */
|
||||
|
||||
static void
|
||||
log_su (const struct passwd *pw, int successful)
|
||||
{
|
||||
const char *new_user, *old_user, *tty;
|
||||
|
||||
#ifndef SYSLOG_NON_ROOT
|
||||
if (pw->pw_uid)
|
||||
return;
|
||||
#endif
|
||||
new_user = pw->pw_name;
|
||||
/* The utmp entry (via getlogin) is probably the best way to identify
|
||||
the user, especially if someone su's from a su-shell. */
|
||||
old_user = getlogin ();
|
||||
if (old_user == NULL)
|
||||
old_user = "";
|
||||
tty = ttyname (2);
|
||||
if (tty == NULL)
|
||||
tty = "";
|
||||
/* 4.2BSD openlog doesn't have the third parameter. */
|
||||
openlog (basename (program_name), 0
|
||||
#ifdef LOG_AUTH
|
||||
, LOG_AUTH
|
||||
#endif
|
||||
);
|
||||
syslog (LOG_NOTICE,
|
||||
#ifdef SYSLOG_NON_ROOT
|
||||
"%s(to %s) %s on %s",
|
||||
#else
|
||||
"%s%s on %s",
|
||||
#endif
|
||||
successful ? "" : "FAILED SU ",
|
||||
#ifdef SYSLOG_NON_ROOT
|
||||
new_user,
|
||||
#endif
|
||||
old_user, tty);
|
||||
closelog ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ask the user for a password.
|
||||
Return 1 if the user gives the correct password for entry PW,
|
||||
0 if not. Return 1 without asking for a password if run by UID 0
|
||||
or if PW has an empty password. */
|
||||
|
||||
static int
|
||||
correct_password (const struct passwd *pw)
|
||||
{
|
||||
char *unencrypted, *encrypted, *correct;
|
||||
#ifdef HAVE_SHADOW_H
|
||||
/* Shadow passwd stuff for SVR3 and maybe other systems. */
|
||||
struct spwd *sp = getspnam (pw->pw_name);
|
||||
|
||||
endspent ();
|
||||
if (sp)
|
||||
correct = sp->sp_pwdp;
|
||||
else
|
||||
#endif
|
||||
correct = pw->pw_passwd;
|
||||
|
||||
if (getuid () == 0 || correct == 0 || correct[0] == '\0')
|
||||
return 1;
|
||||
|
||||
unencrypted = getpass (_("Password:"));
|
||||
if (unencrypted == NULL)
|
||||
{
|
||||
error (0, 0, _("getpass: cannot open /dev/tty"));
|
||||
return 0;
|
||||
}
|
||||
encrypted = crypt (unencrypted, correct);
|
||||
memset (unencrypted, 0, strlen (unencrypted));
|
||||
return strcmp (encrypted, correct) == 0;
|
||||
}
|
||||
|
||||
/* Update `environ' for the new shell based on PW, with SHELL being
|
||||
the value for the SHELL environment variable. */
|
||||
|
||||
static void
|
||||
modify_environment (const struct passwd *pw, const char *shell)
|
||||
{
|
||||
char *term;
|
||||
|
||||
if (simulate_login)
|
||||
{
|
||||
/* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
|
||||
Unset all other environment variables. */
|
||||
term = getenv ("TERM");
|
||||
environ = (char **) xmalloc (2 * sizeof (char *));
|
||||
environ[0] = 0;
|
||||
if (term)
|
||||
xputenv (concat ("TERM", "=", term));
|
||||
xputenv (concat ("HOME", "=", pw->pw_dir));
|
||||
xputenv (concat ("SHELL", "=", shell));
|
||||
xputenv (concat ("USER", "=", pw->pw_name));
|
||||
xputenv (concat ("LOGNAME", "=", pw->pw_name));
|
||||
xputenv (concat ("PATH", "=", pw->pw_uid
|
||||
? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set HOME, SHELL, and if not becoming a super-user,
|
||||
USER and LOGNAME. */
|
||||
if (change_environment)
|
||||
{
|
||||
xputenv (concat ("HOME", "=", pw->pw_dir));
|
||||
xputenv (concat ("SHELL", "=", shell));
|
||||
if (pw->pw_uid)
|
||||
{
|
||||
xputenv (concat ("USER", "=", pw->pw_name));
|
||||
xputenv (concat ("LOGNAME", "=", pw->pw_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Become the user and group(s) specified by PW. */
|
||||
|
||||
static void
|
||||
change_identity (const struct passwd *pw)
|
||||
{
|
||||
#ifdef HAVE_INITGROUPS
|
||||
errno = 0;
|
||||
if (initgroups (pw->pw_name, pw->pw_gid) == -1)
|
||||
error (1, errno, _("cannot set groups"));
|
||||
endgrent ();
|
||||
#endif
|
||||
if (setgid (pw->pw_gid))
|
||||
error (1, errno, _("cannot set group id"));
|
||||
if (setuid (pw->pw_uid))
|
||||
error (1, errno, _("cannot set user id"));
|
||||
}
|
||||
|
||||
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
|
||||
If COMMAND is nonzero, pass it to the shell with the -c option.
|
||||
If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
|
||||
arguments. */
|
||||
|
||||
static void
|
||||
run_shell (const char *shell, const char *command, char **additional_args)
|
||||
{
|
||||
const char **args;
|
||||
int argno = 1;
|
||||
|
||||
if (additional_args)
|
||||
args = (const char **) xmalloc (sizeof (char *)
|
||||
* (10 + elements (additional_args)));
|
||||
else
|
||||
args = (const char **) xmalloc (sizeof (char *) * 10);
|
||||
if (simulate_login)
|
||||
{
|
||||
char *arg0;
|
||||
char *shell_basename;
|
||||
|
||||
shell_basename = basename (shell);
|
||||
arg0 = xmalloc (strlen (shell_basename) + 2);
|
||||
arg0[0] = '-';
|
||||
strcpy (arg0 + 1, shell_basename);
|
||||
args[0] = arg0;
|
||||
}
|
||||
else
|
||||
args[0] = basename (shell);
|
||||
if (fast_startup)
|
||||
args[argno++] = "-f";
|
||||
if (command)
|
||||
{
|
||||
args[argno++] = "-c";
|
||||
args[argno++] = command;
|
||||
}
|
||||
if (additional_args)
|
||||
for (; *additional_args; ++additional_args)
|
||||
args[argno++] = *additional_args;
|
||||
args[argno] = NULL;
|
||||
execv (shell, (char **) args);
|
||||
error (1, errno, _("cannot run %s"), shell);
|
||||
}
|
||||
|
||||
/* Return 1 if SHELL is a restricted shell (one not returned by
|
||||
getusershell), else 0, meaning it is a standard shell. */
|
||||
|
||||
static int
|
||||
restricted_shell (const char *shell)
|
||||
{
|
||||
char *line;
|
||||
|
||||
setusershell ();
|
||||
while ((line = getusershell ()) != NULL)
|
||||
{
|
||||
if (*line != '#' && strcmp (line, shell) == 0)
|
||||
{
|
||||
endusershell ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
endusershell ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != 0)
|
||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||
program_name);
|
||||
else
|
||||
{
|
||||
printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
|
||||
printf (_("\
|
||||
Change the effective user id and group id to that of USER.\n\
|
||||
\n\
|
||||
-, -l, --login make the shell a login shell\n\
|
||||
-c, --commmand=COMMAND pass a single COMMAND to the shell with -c\n\
|
||||
-f, --fast pass -f to the shell (for csh or tcsh)\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\
|
||||
\n\
|
||||
A mere - implies -l. If USER not given, assume root.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
const char *new_user = DEFAULT_USER;
|
||||
@@ -195,6 +446,10 @@ main (argc, argv)
|
||||
struct passwd pw_copy;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
fast_startup = 0;
|
||||
simulate_login = 0;
|
||||
change_environment = 1;
|
||||
@@ -235,7 +490,7 @@ main (argc, argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("su - %s\n", version_string);
|
||||
printf ("su - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -305,282 +560,3 @@ main (argc, argv)
|
||||
|
||||
run_shell (shell, command, additional_args);
|
||||
}
|
||||
|
||||
/* Ask the user for a password.
|
||||
Return 1 if the user gives the correct password for entry PW,
|
||||
0 if not. Return 1 without asking for a password if run by UID 0
|
||||
or if PW has an empty password. */
|
||||
|
||||
static int
|
||||
correct_password (pw)
|
||||
struct passwd *pw;
|
||||
{
|
||||
char *unencrypted, *encrypted, *correct;
|
||||
#ifdef HAVE_SHADOW_H
|
||||
/* Shadow passwd stuff for SVR3 and maybe other systems. */
|
||||
struct spwd *sp = getspnam (pw->pw_name);
|
||||
|
||||
endspent ();
|
||||
if (sp)
|
||||
correct = sp->sp_pwdp;
|
||||
else
|
||||
#endif
|
||||
correct = pw->pw_passwd;
|
||||
|
||||
if (getuid () == 0 || correct == 0 || correct[0] == '\0')
|
||||
return 1;
|
||||
|
||||
unencrypted = getpass (_("Password:"));
|
||||
if (unencrypted == NULL)
|
||||
{
|
||||
error (0, 0, _("getpass: cannot open /dev/tty"));
|
||||
return 0;
|
||||
}
|
||||
encrypted = crypt (unencrypted, correct);
|
||||
memset (unencrypted, 0, strlen (unencrypted));
|
||||
return strcmp (encrypted, correct) == 0;
|
||||
}
|
||||
|
||||
/* Update `environ' for the new shell based on PW, with SHELL being
|
||||
the value for the SHELL environment variable. */
|
||||
|
||||
static void
|
||||
modify_environment (pw, shell)
|
||||
struct passwd *pw;
|
||||
char *shell;
|
||||
{
|
||||
char *term;
|
||||
|
||||
if (simulate_login)
|
||||
{
|
||||
/* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
|
||||
Unset all other environment variables. */
|
||||
term = getenv ("TERM");
|
||||
environ = (char **) xmalloc (2 * sizeof (char *));
|
||||
environ[0] = 0;
|
||||
if (term)
|
||||
xputenv (concat ("TERM", "=", term));
|
||||
xputenv (concat ("HOME", "=", pw->pw_dir));
|
||||
xputenv (concat ("SHELL", "=", shell));
|
||||
xputenv (concat ("USER", "=", pw->pw_name));
|
||||
xputenv (concat ("LOGNAME", "=", pw->pw_name));
|
||||
xputenv (concat ("PATH", "=", pw->pw_uid
|
||||
? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set HOME, SHELL, and if not becoming a super-user,
|
||||
USER and LOGNAME. */
|
||||
if (change_environment)
|
||||
{
|
||||
xputenv (concat ("HOME", "=", pw->pw_dir));
|
||||
xputenv (concat ("SHELL", "=", shell));
|
||||
if (pw->pw_uid)
|
||||
{
|
||||
xputenv (concat ("USER", "=", pw->pw_name));
|
||||
xputenv (concat ("LOGNAME", "=", pw->pw_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Become the user and group(s) specified by PW. */
|
||||
|
||||
static void
|
||||
change_identity (pw)
|
||||
struct passwd *pw;
|
||||
{
|
||||
#ifdef HAVE_INITGROUPS
|
||||
errno = 0;
|
||||
if (initgroups (pw->pw_name, pw->pw_gid) == -1)
|
||||
error (1, errno, _("cannot set groups"));
|
||||
endgrent ();
|
||||
#endif
|
||||
if (setgid (pw->pw_gid))
|
||||
error (1, errno, _("cannot set group id"));
|
||||
if (setuid (pw->pw_uid))
|
||||
error (1, errno, _("cannot set user id"));
|
||||
}
|
||||
|
||||
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
|
||||
If COMMAND is nonzero, pass it to the shell with the -c option.
|
||||
If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
|
||||
arguments. */
|
||||
|
||||
static void
|
||||
run_shell (shell, command, additional_args)
|
||||
char *shell;
|
||||
char *command;
|
||||
char **additional_args;
|
||||
{
|
||||
const char **args;
|
||||
int argno = 1;
|
||||
|
||||
if (additional_args)
|
||||
args = (const char **) xmalloc (sizeof (char *)
|
||||
* (10 + elements (additional_args)));
|
||||
else
|
||||
args = (const char **) xmalloc (sizeof (char *) * 10);
|
||||
if (simulate_login)
|
||||
{
|
||||
char *arg0;
|
||||
char *shell_basename;
|
||||
|
||||
shell_basename = basename (shell);
|
||||
arg0 = xmalloc (strlen (shell_basename) + 2);
|
||||
arg0[0] = '-';
|
||||
strcpy (arg0 + 1, shell_basename);
|
||||
args[0] = arg0;
|
||||
}
|
||||
else
|
||||
args[0] = basename (shell);
|
||||
if (fast_startup)
|
||||
args[argno++] = "-f";
|
||||
if (command)
|
||||
{
|
||||
args[argno++] = "-c";
|
||||
args[argno++] = command;
|
||||
}
|
||||
if (additional_args)
|
||||
for (; *additional_args; ++additional_args)
|
||||
args[argno++] = *additional_args;
|
||||
args[argno] = NULL;
|
||||
execv (shell, (char **) args);
|
||||
error (1, errno, _("cannot run %s"), shell);
|
||||
}
|
||||
|
||||
#if defined (SYSLOG_SUCCESS) || defined (SYSLOG_FAILURE)
|
||||
/* Log the fact that someone has run su to the user given by PW;
|
||||
if SUCCESSFUL is nonzero, they gave the correct password, etc. */
|
||||
|
||||
static void
|
||||
log_su (pw, successful)
|
||||
struct passwd *pw;
|
||||
int successful;
|
||||
{
|
||||
const char *new_user, *old_user, *tty;
|
||||
|
||||
#ifndef SYSLOG_NON_ROOT
|
||||
if (pw->pw_uid)
|
||||
return;
|
||||
#endif
|
||||
new_user = pw->pw_name;
|
||||
/* The utmp entry (via getlogin) is probably the best way to identify
|
||||
the user, especially if someone su's from a su-shell. */
|
||||
old_user = getlogin ();
|
||||
if (old_user == NULL)
|
||||
old_user = "";
|
||||
tty = ttyname (2);
|
||||
if (tty == NULL)
|
||||
tty = "";
|
||||
/* 4.2BSD openlog doesn't have the third parameter. */
|
||||
openlog (basename (program_name), 0
|
||||
#ifdef LOG_AUTH
|
||||
, LOG_AUTH
|
||||
#endif
|
||||
);
|
||||
syslog (LOG_NOTICE,
|
||||
#ifdef SYSLOG_NON_ROOT
|
||||
"%s(to %s) %s on %s",
|
||||
#else
|
||||
"%s%s on %s",
|
||||
#endif
|
||||
successful ? "" : "FAILED SU ",
|
||||
#ifdef SYSLOG_NON_ROOT
|
||||
new_user,
|
||||
#endif
|
||||
old_user, tty);
|
||||
closelog ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return 1 if SHELL is a restricted shell (one not returned by
|
||||
getusershell), else 0, meaning it is a standard shell. */
|
||||
|
||||
static int
|
||||
restricted_shell (shell)
|
||||
char *shell;
|
||||
{
|
||||
char *line;
|
||||
|
||||
setusershell ();
|
||||
while ((line = getusershell ()) != NULL)
|
||||
{
|
||||
if (*line != '#' && strcmp (line, shell) == 0)
|
||||
{
|
||||
endusershell ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
endusershell ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the number of elements in ARR, a null-terminated array. */
|
||||
|
||||
static int
|
||||
elements (arr)
|
||||
char **arr;
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
for (n = 0; *arr; ++arr)
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
/* Add VAL to the environment, checking for out of memory errors. */
|
||||
|
||||
static void
|
||||
xputenv (val)
|
||||
char *val;
|
||||
{
|
||||
if (putenv (val))
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
}
|
||||
|
||||
/* Return a newly-allocated string whose contents concatenate
|
||||
those of S1, S2, S3. */
|
||||
|
||||
static char *
|
||||
concat (s1, s2, s3)
|
||||
char *s1, *s2, *s3;
|
||||
{
|
||||
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
||||
char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
|
||||
|
||||
strcpy (result, s1);
|
||||
strcpy (result + len1, s2);
|
||||
strcpy (result + len1 + len2, s3);
|
||||
result[len1 + len2 + len3] = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
usage (status)
|
||||
int status;
|
||||
{
|
||||
if (status != 0)
|
||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||
program_name);
|
||||
else
|
||||
{
|
||||
printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
|
||||
printf (_("\
|
||||
Change the effective user id and group id to that of USER.\n\
|
||||
\n\
|
||||
-, -l, --login make the shell a login shell\n\
|
||||
-c, --commmand=COMMAND pass a single COMMAND to the shell with -c\n\
|
||||
-f, --fast pass -f to the shell (for csh or tcsh)\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\
|
||||
\n\
|
||||
A mere - implies -l. If USER not given, assume root.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
|
||||
13
src/sum.c
13
src/sum.c
@@ -25,7 +25,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
int safe_read ();
|
||||
@@ -76,7 +75,7 @@ Print checksum and block counts for each FILE.\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Calculate and print the rotated checksum and the size in 1K blocks
|
||||
@@ -198,7 +197,7 @@ sysv_sum_file (const char *file, int print_name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int errors = 0;
|
||||
@@ -235,8 +234,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("sum - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("sum - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -254,7 +253,7 @@ main (int argc, char **argv)
|
||||
errors = 1;
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
exit (errors);
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Jim Meyering <meyering@comco.com> */
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "long-options.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -48,7 +47,7 @@ Force changed blocks to disk, update the super block.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
program_name = argv[0];
|
||||
@@ -56,7 +55,7 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "sync", version_string, usage);
|
||||
parse_long_options (argc, argv, "sync", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc != 1)
|
||||
error (0, 0, _("ignoring all arguments"));
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Include sys/types.h before this file. */
|
||||
|
||||
|
||||
21
src/tac.c
21
src/tac.c
@@ -47,7 +47,6 @@ tac -r -s '.\|
|
||||
# include <rx.h>
|
||||
#endif
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
@@ -146,7 +145,7 @@ With no FILE, or when FILE is -, read standard input.\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -159,7 +158,7 @@ static void
|
||||
cleanup_fatal (void)
|
||||
{
|
||||
cleanup ();
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
@@ -580,7 +579,7 @@ tac_stdin (void)
|
||||
return errors;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
const char *error_message; /* Return value from re_compile_pattern. */
|
||||
@@ -613,7 +612,7 @@ main (int argc, char **argv)
|
||||
case 's':
|
||||
separator = optarg;
|
||||
if (*separator == 0)
|
||||
error (1, 0, _("separator cannot be empty"));
|
||||
error (EXIT_FAILURE, 0, _("separator cannot be empty"));
|
||||
break;
|
||||
default:
|
||||
usage (1);
|
||||
@@ -622,8 +621,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("tac - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("tac - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -639,7 +638,7 @@ main (int argc, char **argv)
|
||||
error_message = re_compile_pattern (separator, strlen (separator),
|
||||
&compiled_separator);
|
||||
if (error_message)
|
||||
error (1, 0, "%s", error_message);
|
||||
error (EXIT_FAILURE, 0, "%s", error_message);
|
||||
}
|
||||
else
|
||||
match_length = sentinel_length = strlen (separator);
|
||||
@@ -679,8 +678,8 @@ main (int argc, char **argv)
|
||||
output ((char *) NULL, (char *) NULL);
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (close (1) < 0)
|
||||
error (1, errno, _("write error"));
|
||||
exit (errors);
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
19
src/tail.c
19
src/tail.c
@@ -51,7 +51,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "xstrtol.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -64,7 +63,7 @@
|
||||
assert ((fd) == 1); \
|
||||
assert ((n_bytes) >= 0); \
|
||||
if (n_bytes > 0 && fwrite ((buffer), 1, (n_bytes), stdout) == 0) \
|
||||
error (1, errno, _("write error")); \
|
||||
error (EXIT_FAILURE, errno, _("write error")); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@@ -166,7 +165,7 @@ the [bkm] suffix multipliers, in which case it is treated like -c VALUE\n\
|
||||
or -c +VALUE.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -538,7 +537,7 @@ output:
|
||||
total += bytes_read;
|
||||
}
|
||||
if (bytes_read == -1)
|
||||
error (1, errno, "%s", filename);
|
||||
error (EXIT_FAILURE, errno, "%s", filename);
|
||||
if (forever)
|
||||
{
|
||||
fflush (stdout);
|
||||
@@ -837,7 +836,7 @@ tail_file (const char *filename, off_t n_units, int filenum)
|
||||
return errors;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
enum header_mode header_mode = multiple_files;
|
||||
@@ -970,8 +969,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("tail - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("tail - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -1013,8 +1012,8 @@ main (int argc, char **argv)
|
||||
tail_forever (argv + fileind, argc - fileind);
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
exit (exit_status);
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
13
src/tee.c
13
src/tee.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Mike Parker, Richard M. Stallman, and David MacKenzie */
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
char *xmalloc ();
|
||||
@@ -77,13 +76,17 @@ Copy standard input to each FILE, and also to standard output.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int errs;
|
||||
int optc;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
append = 0;
|
||||
ignore_interrupts = 0;
|
||||
|
||||
@@ -110,7 +113,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("tee - %s\n", version_string);
|
||||
printf ("tee - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
14
src/test.c
14
src/test.c
@@ -16,9 +16,9 @@
|
||||
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 Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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. */
|
||||
|
||||
/* Define TEST_STANDALONE to get the /bin/test version. Otherwise, you get
|
||||
the shell builtin version. */
|
||||
@@ -36,7 +36,6 @@
|
||||
# include "filecntl.h"
|
||||
#else /* TEST_STANDALONE */
|
||||
# include "system.h"
|
||||
# include "version.h"
|
||||
# include "group-member.h"
|
||||
# include "error.h"
|
||||
# if !defined (S_IXUGO)
|
||||
@@ -1065,13 +1064,16 @@ main (int margc, char **margv)
|
||||
return (test_error_return);
|
||||
#else /* TEST_STANDALONE */
|
||||
program_name = margv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif /* TEST_STANDALONE */
|
||||
|
||||
argv = margv;
|
||||
|
||||
if (margv[0] && strcmp (margv[0], "[") == 0)
|
||||
{
|
||||
parse_long_options (argc, argv, COMMAND_NAME, version_string, usage);
|
||||
parse_long_options (argc, argv, COMMAND_NAME, PACKAGE_VERSION, usage);
|
||||
|
||||
--margc;
|
||||
|
||||
@@ -1088,7 +1090,7 @@ main (int margc, char **margv)
|
||||
if (pos >= argc)
|
||||
test_exit (SHELL_BOOLEAN (FALSE));
|
||||
|
||||
parse_long_options (argc, argv, COMMAND_NAME, version_string, usage);
|
||||
parse_long_options (argc, argv, COMMAND_NAME, PACKAGE_VERSION, usage);
|
||||
value = posixtest ();
|
||||
|
||||
if (pos != argc)
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-a, --time={atime,access,use} Change access time only.
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "argmatch.h"
|
||||
|
||||
@@ -266,7 +265,7 @@ STAMP may be used without -t if none of -drt, nor --, are used.\n"));
|
||||
exit (status);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c, i;
|
||||
@@ -342,7 +341,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("touch - %s\n", version_string);
|
||||
printf ("touch - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
58
src/tr.c
58
src/tr.c
@@ -34,7 +34,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
@@ -414,7 +413,7 @@ translating nor deleting; else squeezing uses SET2 and occurs after\n\
|
||||
translation or deletion.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Return nonzero if the character C is a member of the
|
||||
@@ -1517,7 +1516,8 @@ validate (struct Spec_list *s1, struct Spec_list *s2)
|
||||
get_s1_spec_stats (s1);
|
||||
if (s1->n_indefinite_repeats > 0)
|
||||
{
|
||||
error (1, 0, _("the [c*] repeat construct may not appear in string1"));
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("the [c*] repeat construct may not appear in string1"));
|
||||
}
|
||||
|
||||
/* FIXME: it isn't clear from the POSIX spec that this is invalid,
|
||||
@@ -1525,7 +1525,7 @@ validate (struct Spec_list *s1, struct Spec_list *s2)
|
||||
with character classes, this seems a logical interpretation. */
|
||||
if (complement && s1->has_upper_or_lower)
|
||||
{
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("character classes may not be used when translating \
|
||||
and complementing"));
|
||||
}
|
||||
@@ -1535,14 +1535,14 @@ and complementing"));
|
||||
get_s2_spec_stats (s2, s1->length);
|
||||
if (s2->has_restricted_char_class)
|
||||
{
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("when translating, the only character classes that may \
|
||||
appear in\n\tstring2 are `upper' and `lower'"));
|
||||
}
|
||||
|
||||
if (s2->n_indefinite_repeats > 1)
|
||||
{
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("only one [c*] repeat construct may appear in string2"));
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ appear in\n\tstring2 are `upper' and `lower'"));
|
||||
{
|
||||
if (s2->has_equiv_class)
|
||||
{
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("[=c=] expressions may not appear in string2 \
|
||||
when translating"));
|
||||
}
|
||||
@@ -1563,14 +1563,14 @@ when translating"));
|
||||
given or string1 is empty. */
|
||||
|
||||
if (s2->length == 0)
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("when not truncating set1, string2 must be non-empty"));
|
||||
string2_extend (s1, s2);
|
||||
}
|
||||
}
|
||||
|
||||
if (complement && s2->has_upper_or_lower)
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("character classes may not be used when translating \
|
||||
and complementing"));
|
||||
}
|
||||
@@ -1578,7 +1578,7 @@ and complementing"));
|
||||
/* Not translating. */
|
||||
{
|
||||
if (s2->n_indefinite_repeats > 0)
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("the [c*] construct may appear in string2 only \
|
||||
when translating"));
|
||||
}
|
||||
@@ -1612,7 +1612,7 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader)
|
||||
nr = (*reader) (buf, size, NULL);
|
||||
|
||||
if (nr < 0)
|
||||
error (1, errno, _("read error"));
|
||||
error (EXIT_FAILURE, errno, _("read error"));
|
||||
if (nr == 0)
|
||||
break;
|
||||
i = 0;
|
||||
@@ -1663,7 +1663,7 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader)
|
||||
}
|
||||
if (out_len > 0
|
||||
&& fwrite ((char *) &buf[begin], 1, out_len, stdout) == 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
|
||||
if (char_to_squeeze != NOT_A_CHAR)
|
||||
@@ -1709,7 +1709,7 @@ read_and_delete (unsigned char *buf, long int size, PFI not_used)
|
||||
int nr = safe_read (0, (char *) buf, size);
|
||||
|
||||
if (nr < 0)
|
||||
error (1, errno, _("read error"));
|
||||
error (EXIT_FAILURE, errno, _("read error"));
|
||||
if (nr == 0)
|
||||
{
|
||||
hit_eof = 1;
|
||||
@@ -1753,7 +1753,7 @@ read_and_xlate (unsigned char *buf, long int size, PFI not_used)
|
||||
|
||||
chars_read = safe_read (0, (char *) buf, size);
|
||||
if (chars_read < 0)
|
||||
error (1, errno, _("read error"));
|
||||
error (EXIT_FAILURE, errno, _("read error"));
|
||||
if (chars_read == 0)
|
||||
{
|
||||
hit_eof = 1;
|
||||
@@ -1786,7 +1786,7 @@ set_initialize (struct Spec_list *s, int complement_this_set, SET_TYPE *in_set)
|
||||
in_set[i] = (!in_set[i]);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
@@ -1832,8 +1832,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("tr - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("tr - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -1856,10 +1856,10 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (!delete && !squeeze_repeats && non_option_args != 2)
|
||||
error (1, 0, _("two strings must be given when translating"));
|
||||
error (EXIT_FAILURE, 0, _("two strings must be given when translating"));
|
||||
|
||||
if (delete && squeeze_repeats && non_option_args != 2)
|
||||
error (1, 0, _("two strings must be given when both \
|
||||
error (EXIT_FAILURE, 0, _("two strings must be given when both \
|
||||
deleting and squeezing repeats"));
|
||||
|
||||
/* If --delete is given without --squeeze-repeats, then
|
||||
@@ -1872,24 +1872,24 @@ deleting and squeezing repeats"));
|
||||
if (posix_pedantic && non_option_args == 2)
|
||||
--non_option_args;
|
||||
else
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("only one string may be given when deleting \
|
||||
without squeezing repeats"));
|
||||
}
|
||||
|
||||
if (squeeze_repeats && non_option_args == 0)
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("at least one string must be given when squeezing repeats"));
|
||||
|
||||
spec_init (s1);
|
||||
if (parse_str ((unsigned char *) argv[optind], s1))
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (non_option_args == 2)
|
||||
{
|
||||
spec_init (s2);
|
||||
if (parse_str ((unsigned char *) argv[optind + 1], s2))
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
s2 = NULL;
|
||||
@@ -1910,7 +1910,7 @@ without squeezing repeats"));
|
||||
{
|
||||
nr = read_and_delete (io_buf, IO_BUF_SIZE, NULL);
|
||||
if (nr > 0 && fwrite ((char *) io_buf, 1, nr, stdout) == 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
while (nr > 0);
|
||||
}
|
||||
@@ -1964,7 +1964,7 @@ without squeezing repeats"));
|
||||
c1 = get_next (s1, &class_s1);
|
||||
c2 = get_next (s2, &class_s2);
|
||||
if (!class_ok[(int) class_s1][(int) class_s2])
|
||||
error (1, 0,
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("misaligned or mismatched upper and/or lower classes"));
|
||||
/* The following should have been checked by validate... */
|
||||
if (c2 == -1)
|
||||
@@ -1987,17 +1987,17 @@ without squeezing repeats"));
|
||||
chars_read = read_and_xlate (io_buf, IO_BUF_SIZE, NULL);
|
||||
if (chars_read > 0
|
||||
&& fwrite ((char *) io_buf, 1, chars_read, stdout) == 0)
|
||||
error (1, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
while (chars_read > 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
error (2, errno, _("write error"));
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (close (0) != 0)
|
||||
error (2, errno, _("standard input"));
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
13
src/tty.c
13
src/tty.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Displays "not a tty" if stdin is not a terminal.
|
||||
Displays nothing if -s option is given.
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
static void usage __P ((int status));
|
||||
@@ -54,13 +53,17 @@ static struct option const longopts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *tty;
|
||||
int optc;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
silent = 0;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "s", longopts, (int *) 0)) != EOF)
|
||||
@@ -81,7 +84,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("tty - %s\n", version_string);
|
||||
printf ("tty - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
13
src/uname.c
13
src/uname.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Option Example
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
static void print_element __P ((unsigned int mask, char *element));
|
||||
@@ -81,13 +80,17 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct utsname name;
|
||||
int c;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
toprint = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "snrvma", long_options, (int *) 0))
|
||||
@@ -130,7 +133,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("uname - %s\n", version_string);
|
||||
printf ("uname - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The number of bytes added at a time to the amount of memory
|
||||
@@ -142,7 +141,7 @@ parse_tabstops (const char *stops)
|
||||
tabval = tabval * 10 + *stops - '0';
|
||||
}
|
||||
else
|
||||
error (1, 0, _("tab size contains an invalid character"));
|
||||
error (EXIT_FAILURE, 0, _("tab size contains an invalid character"));
|
||||
}
|
||||
|
||||
add_tabstop (tabval);
|
||||
@@ -160,9 +159,9 @@ validate_tabstops (const int *tabs, int entries)
|
||||
for (i = 0; i < entries; i++)
|
||||
{
|
||||
if (tabs[i] == 0)
|
||||
error (1, 0, _("tab size cannot be 0"));
|
||||
error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
|
||||
if (tabs[i] <= prev_tab)
|
||||
error (1, 0, _("tab sizes must be ascending"));
|
||||
error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
|
||||
prev_tab = tabs[i];
|
||||
}
|
||||
}
|
||||
@@ -374,10 +373,10 @@ With no FILE, or when FILE is -, read standard input.\n\
|
||||
Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int tabval = -1; /* Value of tabstop being read, or -1. */
|
||||
@@ -425,8 +424,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("unexpand - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("unexpand - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -451,8 +450,8 @@ main (int argc, char **argv)
|
||||
unexpand ();
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (1, errno, _("write error"));
|
||||
exit (exit_status);
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
31
src/uniq.c
31
src/uniq.c
@@ -40,7 +40,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "linebuffer.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -130,7 +129,7 @@ A field is a run of whitespace, than non-whitespace characters.\n\
|
||||
Fields are skipped before chars. \n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Given a linebuffer LINE,
|
||||
@@ -219,14 +218,14 @@ check_file (const char *infile, const char *outfile)
|
||||
else
|
||||
istream = fopen (infile, "r");
|
||||
if (istream == NULL)
|
||||
error (1, errno, "%s", infile);
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
|
||||
if (!strcmp (outfile, "-"))
|
||||
ostream = stdout;
|
||||
else
|
||||
ostream = fopen (outfile, "w");
|
||||
if (ostream == NULL)
|
||||
error (1, errno, "%s", outfile);
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
|
||||
thisline = &lb1;
|
||||
prevline = &lb2;
|
||||
@@ -264,16 +263,16 @@ check_file (const char *infile, const char *outfile)
|
||||
|
||||
closefiles:
|
||||
if (ferror (istream) || fclose (istream) == EOF)
|
||||
error (1, errno, _("error reading %s"), infile);
|
||||
error (EXIT_FAILURE, errno, _("error reading %s"), infile);
|
||||
|
||||
if (ferror (ostream) || fclose (ostream) == EOF)
|
||||
error (1, errno, _("error writing %s"), outfile);
|
||||
error (EXIT_FAILURE, errno, _("error writing %s"), outfile);
|
||||
|
||||
free (lb1.buffer);
|
||||
free (lb2.buffer);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
@@ -324,7 +323,8 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid number of fields to skip: `%s'"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of fields to skip: `%s'"),
|
||||
optarg);
|
||||
skip_fields = (int) tmp_long;
|
||||
}
|
||||
@@ -335,7 +335,8 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid number of bytes to skip: `%s'"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of bytes to skip: `%s'"),
|
||||
optarg);
|
||||
skip_chars = (int) tmp_long;
|
||||
}
|
||||
@@ -350,7 +351,8 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid number of bytes to compare: `%s'"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of bytes to compare: `%s'"),
|
||||
optarg);
|
||||
check_chars = (int) tmp_long;
|
||||
}
|
||||
@@ -363,8 +365,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("uniq - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("uniq - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -380,7 +382,8 @@ main (int argc, char **argv)
|
||||
long int tmp_long;
|
||||
if (xstrtol (opt_str, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid number of bytes to compare: `%s'"),
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of bytes to compare: `%s'"),
|
||||
opt_str);
|
||||
skip_chars = (int) tmp_long;
|
||||
}
|
||||
@@ -397,5 +400,5 @@ main (int argc, char **argv)
|
||||
|
||||
check_file (infile, outfile);
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
13
src/wc.c
13
src/wc.c
@@ -24,7 +24,6 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
/* Size of atomic reads. */
|
||||
@@ -87,7 +86,7 @@ read standard input.\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
}
|
||||
exit (status);
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -254,7 +253,7 @@ wc_file (const char *file)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
@@ -293,8 +292,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("wc - %s\n", version_string);
|
||||
exit (0);
|
||||
printf ("wc - %s\n", PACKAGE_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (show_help)
|
||||
@@ -320,7 +319,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (have_read_stdin && close (0))
|
||||
error (1, errno, "-");
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
|
||||
exit (exit_status);
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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 jla; revised by djm */
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "error.h"
|
||||
|
||||
#if !defined (UTMP_FILE) && defined (_PATH_UTMP) /* 4.4BSD. */
|
||||
@@ -410,7 +409,7 @@ read_utmp (char *filename)
|
||||
{
|
||||
FILE *utmp;
|
||||
struct stat file_stats;
|
||||
int n_read;
|
||||
size_t n_read;
|
||||
size_t size;
|
||||
|
||||
utmp = fopen (filename, "r");
|
||||
@@ -573,6 +572,9 @@ main (int argc, char **argv)
|
||||
#endif /* WHO */
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
#ifdef WHO
|
||||
while ((optc = getopt_long (argc, argv, "imqsuwHT", longopts, &longind))
|
||||
@@ -620,7 +622,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("%s - %s\n", COMMAND_NAME, version_string);
|
||||
printf ("%s - %s\n", COMMAND_NAME, PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
10
src/whoami.c
10
src/whoami.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Equivalent to `id -un'. */
|
||||
/* Written by Richard Mlynarik. */
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <pwd.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "system.h"
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -70,6 +69,9 @@ main (int argc, char **argv)
|
||||
int c;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
@@ -85,7 +87,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
printf ("whoami - %s\n", version_string);
|
||||
printf ("whoami - %s\n", PACKAGE_VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
10
src/yes.c
10
src/yes.c
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "long-options.h"
|
||||
#include "version.h"
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
@@ -50,8 +49,11 @@ void
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
parse_long_options (argc, argv, "yes", version_string, usage);
|
||||
parse_long_options (argc, argv, "yes", PACKAGE_VERSION, usage);
|
||||
|
||||
if (argc == 1)
|
||||
while (1)
|
||||
|
||||
Reference in New Issue
Block a user