Compare commits

...

46 Commits

Author SHA1 Message Date
Jim Meyering
1aa070dd2e . 1998-01-11 09:14:29 +00:00
Jim Meyering
007e81132a . 1998-01-11 09:14:02 +00:00
Jim Meyering
6bcfff640e *** empty log message *** 1998-01-11 09:12:30 +00:00
Jim Meyering
aa2880362c . 1998-01-11 08:02:39 +00:00
Jim Meyering
88bd90109b *** empty log message *** 1998-01-10 22:13:49 +00:00
Jim Meyering
dba300a0d0 CHAR_BIT SCHAR_MAX UCHAR_MAX SHRT_MAX INT_MAX UINT_MAX LONG_MAX ULONG_MAX
Remove definitions of those symbols.
* src/csplit.c: Move inclusion of regex.h/rx.h to follow system.h
since it now includes limit.h which defines RE_DUP_MAX.
* src/nl.c: Likewise.
* src/tac.c: Likewise.
1998-01-10 22:12:03 +00:00
Jim Meyering
b9ed71e46e . 1998-01-10 20:53:56 +00:00
Jim Meyering
7bba3e945f initialize fail to 0 1998-01-10 16:25:46 +00:00
Jim Meyering
1bdfcabd2c . 1998-01-10 16:24:46 +00:00
Jim Meyering
c88a4c91da (EXTRA_DIST): Add const.m4. 1998-01-10 16:24:26 +00:00
Jim Meyering
136f2fd28c . 1998-01-10 15:57:57 +00:00
Jim Meyering
82739833a1 *** empty log message *** 1998-01-10 15:09:46 +00:00
Jim Meyering
1c5c2597b5 *** empty log message *** 1998-01-10 15:08:00 +00:00
Jim Meyering
eacbf12ea4 *** empty log message *** 1998-01-10 15:04:32 +00:00
Jim Meyering
0ccdf3419d (usage): Describe -D. 1998-01-10 15:03:58 +00:00
Jim Meyering
cec85a4b3a . 1998-01-10 14:25:27 +00:00
Jim Meyering
a077a7833c *** empty log message *** 1998-01-10 14:23:08 +00:00
Jim Meyering
a3094b0529 (batch_convert): Use memcpy when we don't need return value. 1998-01-10 14:21:35 +00:00
Jim Meyering
d73dd15544 . 1998-01-10 13:36:47 +00:00
Jim Meyering
27c1ad9576 *** empty log message *** 1998-01-10 13:36:09 +00:00
Jim Meyering
2eefbf7647 (usage): Correct descriptions of --sort, --time, and -t.
Suggestions from Andreas Schwab.
1998-01-10 12:53:09 +00:00
Jim Meyering
79d39ab7bf (decode_switches) [-u]: Fix bug whereby -u had no effect
without -l or -t.  Now, -u (like -c) implies --sort=time.
Suggestion from Andreas Schwab.
1998-01-10 12:07:50 +00:00
Jim Meyering
12782f54b0 *** empty log message *** 1998-01-10 11:56:26 +00:00
Jim Meyering
fff6de7b04 *** empty log message *** 1998-01-10 11:54:39 +00:00
Jim Meyering
cc76db2016 use sh-script test, not Test.pm framework 1998-01-10 11:27:24 +00:00
Jim Meyering
77c94909cf *** empty log message *** 1998-01-10 11:24:51 +00:00
Jim Meyering
3b8d19272d . 1998-01-10 11:00:46 +00:00
Jim Meyering
6099914170 *** empty log message *** 1998-01-10 10:36:41 +00:00
Jim Meyering
09d96ac539 (make_path): Reformat 3 if-stmts to test `if (newly_created_dir)' only once.
Suggestion from Andreas Schwab.
1998-01-10 10:28:37 +00:00
Jim Meyering
3edbca0e04 (make_path): Put only newly created directories on the LEADING_DIRS list. 1998-01-10 10:22:30 +00:00
Jim Meyering
c062a35803 *** empty log message *** 1998-01-08 23:17:20 +00:00
Jim Meyering
3da029a5d9 *** empty log message *** 1998-01-08 23:16:14 +00:00
Jim Meyering
de1dabf7d7 *** empty log message *** 1998-01-08 22:58:18 +00:00
Jim Meyering
03283b5000 (tac_stream): Don't perform arithmetic on now-void pointer
result of xrealloc (until recently it was char*).
1998-01-08 22:58:03 +00:00
Jim Meyering
9f5dc7e7d0 (inittables): Add && HAVE_NL_LANGINFO to the #if-test
guarding the nls month-checking code.
(nls_numeric_format): Remove unnecessary (and error-evoking w/SunOS' cc)
`unsigned' from dcls of text and lim.
(main): Cast lconvp->grouping to `unsigned char*' to appease SunOS's cc.
1998-01-08 22:56:45 +00:00
Jim Meyering
ab9cd27938 *** empty log message *** 1998-01-07 07:45:46 +00:00
Jim Meyering
c767a49741 *** empty log message *** 1998-01-06 23:53:50 +00:00
Jim Meyering
0fdd1b9130 Add %expect directive.
Move inclusion of getdate.h and dependent extern declarations down
so getdate.h's prototype follows the sometimes-enabled definition
of `const' to nothing.  Otherwise, the prototype wouldn't match
the definition because of the defined-away `const'.
(get_date): ANSI-fy definition.
From Kaveh Ghazi.
1998-01-06 23:53:33 +00:00
Jim Meyering
f19ca6fe29 *** empty log message *** 1998-01-05 17:43:31 +00:00
Jim Meyering
6cc3cf776c (df_readable): New function.
(show_dev): If a value consists entirely of 1 bits, or is derived
from some other value that consists entirely of 1 bits, report "-".
Check inode and block counts more carefully for plausibility,
to avoid arithmetic overflow when computing percentages.
1998-01-05 17:43:00 +00:00
Jim Meyering
e162abfc5b (get_fs_usage): Add parens. 1998-01-05 17:38:38 +00:00
Jim Meyering
866773c72a (PROPAGATE_ALL_ONES): New macro.
(get_fs_usage): If a value consists entirely of 1 bits,
propagate this info to the output by setting it to (uintmax_t) -1.
1998-01-05 17:33:54 +00:00
Jim Meyering
06bab849fc reindent a little 1998-01-05 10:11:08 +00:00
Jim Meyering
ed0becde29 reformat comment, dcl fail, dirname 1998-01-05 10:09:24 +00:00
Jim Meyering
8d64a37a77 remove SPECIAL_BITS #ifdefs 1998-01-05 10:06:41 +00:00
Jim Meyering
0520188821 Add support for marty's -D option 1998-01-05 10:06:07 +00:00
34 changed files with 482 additions and 414 deletions

View File

@@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.2d from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -117,7 +117,7 @@ save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
@@ -178,7 +178,7 @@ default: all
.SUFFIXES:
.SUFFIXES: .S .c .h .o .s .y
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -231,8 +231,10 @@ libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(RANLIB) libfu.a
.y.c:
echo building $@
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
.y.h:
echo building $@
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
addext_.c: addext.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` addext_.c
@@ -451,16 +453,16 @@ dvi:
check: all
$(MAKE)
installcheck:
install-exec:
install-exec:
@$(NORMAL_INSTALL)
install-data:
install-data:
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
uninstall:
all: Makefile $(LIBRARIES) $(HEADERS)

View File

@@ -1,5 +1,5 @@
/* fsusage.c -- return space usage of mounted filesystems
Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -65,6 +65,12 @@ int statfs ();
int statvfs ();
#endif
/* Many space usage primitives use all 1 bits to denote a value that is
not applicable or unknown. Propagate this information by returning
a uintmax_t value that is all 1 bits if the argument is all 1 bits,
even if the argument is unsigned and smaller than unitmax_t. */
#define PROPAGATE_ALL_ONES(x) ((x) == -1 ? (uintmax_t) -1 : (uintmax_t) (x))
int safe_read ();
/* Fill in the fields of FSP with information about space usage for
@@ -87,7 +93,7 @@ get_fs_usage (path, disk, fsp)
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
return -1;
fsp->fsu_blocksize = fsd.f_fsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#endif /* STAT_STATFS3_OSF1 */
@@ -99,11 +105,11 @@ get_fs_usage (path, disk, fsp)
return -1;
fsp->fsu_blocksize = 1024;
fsp->fsu_blocks = fsd.fd_req.btot;
fsp->fsu_bfree = fsd.fd_req.bfree;
fsp->fsu_bavail = fsd.fd_req.bfreen;
fsp->fsu_files = fsd.fd_req.gtot;
fsp->fsu_ffree = fsd.fd_req.gfree;
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.fd_req.bfreen);
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
#endif /* STAT_STATFS2_FS_DATA */
@@ -132,12 +138,14 @@ get_fs_usage (path, disk, fsp)
}
close (fd);
fsp->fsu_blocksize = fsd.s_type == Fs2b ? 1024 : 512;
fsp->fsu_blocks = fsd.s_fsize;
fsp->fsu_bfree = fsd.s_tfree;
fsp->fsu_bavail = fsd.s_tfree;
fsp->fsu_files = (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1);
fsp->fsu_ffree = fsd.s_tinode;
fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.s_tfree);
fsp->fsu_files = (fsd.s_isize == -1
? (uintmax_t) -1
: (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1));
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.s_tinode);
#endif /* STAT_READ_FILSYS */
@@ -148,7 +156,7 @@ get_fs_usage (path, disk, fsp)
if (statfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocksize = fsd.f_bsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
@@ -174,7 +182,7 @@ get_fs_usage (path, disk, fsp)
if (statfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocksize = fsd.f_fsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#endif /* STAT_STATFS2_FSIZE */
@@ -193,7 +201,7 @@ get_fs_usage (path, disk, fsp)
systems seem to always be in terms of 512-byte blocks,
no matter what value f_bsize has. */
# if _AIX || defined(_CRAY)
fsp->fsu_blocksize = fsd.f_bsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
# else
fsp->fsu_blocksize = 512;
# endif
@@ -208,18 +216,19 @@ get_fs_usage (path, disk, fsp)
return -1;
/* f_frsize isn't guaranteed to be supported. */
fsp->fsu_blocksize = fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize;
fsp->fsu_blocksize =
PROPAGATE_ALL_ONES (fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize);
#endif /* STAT_STATVFS */
#if !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ_FILSYS)
/* !Ultrix && !SVR2 */
fsp->fsu_blocks = fsd.f_blocks;
fsp->fsu_bfree = fsd.f_bfree;
fsp->fsu_bavail = fsd.f_bavail;
fsp->fsu_files = fsd.f_files;
fsp->fsu_ffree = fsd.f_ffree;
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.f_bavail);
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
#endif /* not STAT_STATFS2_FS_DATA && not STAT_READ_FILSYS */

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997, 1998 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

View File

@@ -5,8 +5,6 @@
** a couple of people on Usenet. Completely overhauled by Rich $alz
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
**
** This grammar has 13 shift/reduce conflicts.
**
** This code is in the public domain and has no copyright.
*/
@@ -51,8 +49,6 @@
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#include "getdate.h"
#if defined (STDC_HEADERS) || defined (USG)
# include <string.h>
#endif
@@ -64,10 +60,6 @@
# define bcopy(from, to, len) memcpy ((to), (from), (len))
#endif
extern struct tm *gmtime ();
extern struct tm *localtime ();
extern time_t mktime ();
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
yacc generated parsers in the same program. Note that these are only
@@ -172,6 +164,9 @@ static int yyRelYear;
%}
/* This grammar has 13 shift/reduce conflicts. */
%expect 13
%union {
int Number;
enum _MERIDIAN Meridian;
@@ -441,6 +436,15 @@ o_merid : /* NULL */
%%
/* Include this file down here because bison inserts code above which
may define-away `const'. We want the prototype for get_date to have
the same signature as the function definition does. */
#include "getdate.h"
extern struct tm *gmtime ();
extern struct tm *localtime ();
extern time_t mktime ();
/* Month and day table. */
static TABLE const MonthDayTable[] = {
{ "january", tMONTH, 1 },
@@ -886,9 +890,7 @@ difftm (a, b)
}
time_t
get_date (p, now)
const char *p;
const time_t *now;
get_date (const char *p, const time_t *now)
{
struct tm tm, tm0, *tmp;
time_t Start;

View File

@@ -1,5 +1,5 @@
/* makepath.c -- Ensure that a directory path exists.
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 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
@@ -239,29 +239,31 @@ make_path (const char *argpath,
}
}
if (newly_created_dir && verbose_fmt_string != NULL)
fprintf (stderr, verbose_fmt_string, dirpath);
if (newly_created_dir)
{
if (verbose_fmt_string)
fprintf (stderr, verbose_fmt_string, dirpath);
if (newly_created_dir
&& (owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
#if defined(AFS) && defined (EPERM)
&& errno != EPERM
&& errno != EPERM
#endif
)
{
error (0, errno, "%s", dirpath);
CLEANUP;
return 1;
}
)
{
error (0, errno, "%s", dirpath);
CLEANUP;
return 1;
}
if (re_protect)
{
struct ptr_list *new = (struct ptr_list *)
alloca (sizeof (struct ptr_list));
new->dirname_end = slash;
new->next = leading_dirs;
leading_dirs = new;
if (re_protect)
{
struct ptr_list *new = (struct ptr_list *)
alloca (sizeof (struct ptr_list));
new->dirname_end = slash;
new->next = leading_dirs;
leading_dirs = new;
}
}
/* If we were able to save the initial working directory,

View File

@@ -1,3 +1,11 @@
1998-01-10 Jim Meyering <meyering@na-net.ornl.gov>
* Makefile.am (EXTRA_DIST): Add const.m4.
* const.m4: New file. Use an initializer in this declaration
typedef int charset[2]; const charset x;
Reported by Bob Glickstein.
1997-12-21 Jim Meyering <meyering@na-net.ornl.gov>
* chown.m4: Fix reversed types on -1 args to chown.

View File

@@ -4,8 +4,8 @@
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
check-decl.m4 chown.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 getline.m4 \
getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 lfs.m4 \
lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 realloc.m4 \
stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 \
getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 \
realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
mktime.m4

View File

@@ -64,6 +64,7 @@ CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -78,23 +79,24 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
EXTRA_DIST = README \
check-decl.m4 chown.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 getline.m4 \
getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 lfs.m4 \
lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 realloc.m4 \
stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 \
getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 \
realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
mktime.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h

66
m4/const.m4 Normal file
View File

@@ -0,0 +1,66 @@
#serial 1
dnl Just like AC_C_CONST from autoconf-2.12, but with an initializer
dnl for `charset x' and with
dnl AC_DEFINE(const, )
dnl changed to
dnl AC_DEFINE_UNQUOTED(const, [/* empty */])
dnl to avoid this warning:
dnl [...]/m4: Warning: Excess arguments to built-in `define' ignored
undefine([AC_C_CONST])
AC_DEFUN(AC_C_CONST,
[dnl This message is consistent in form with the other checking messages,
dnl and with the result message.
AC_CACHE_CHECK([for working const], ac_cv_c_const,
[AC_TRY_COMPILE(,
changequote(<<, >>)dnl
<<
/* Ultrix mips cc rejects this. */
typedef int charset[2]; const charset x = {0, 0};
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in an arm
of an if-expression whose if-part is not a constant expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
}
>>,
changequote([, ])dnl
ac_cv_c_const=yes, ac_cv_c_const=no)])
if test $ac_cv_c_const = no; then
AC_DEFINE_UNQUOTED(const, [/* empty */])
fi
])

View File

@@ -1,3 +1,54 @@
1998-01-10 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.16k.
* src/install.c (install_file_to_path): New function.
FIXME: update fileutils.texi.
(main): Handle new option, -D.
Based on a patch from Marty Leisner.
(usage): Describe -D.
* src/ls.c (decode_switches) [-u]: Fix bug whereby -u worked only
with -l or -t. Now, -u (like -c) implies --sort=time.
(usage): Correct descriptions of --sort, --time, and -t.
Suggestions from Andreas Schwab.
Add test for the above fix.
* configure.in (AC_OUTPUT): Add tests/ls/Makefile.
* tests/Makefile.am (SUBDIRS): Add ls.
* tests/ls: New directory.
* tests/ls/Makefile.am: New file.
* tests/ls/time-1: New file.
* lib/makepath.c (make_path): Reformat 3 if-stmts to test
`if (newly_created_dir)' only once. Suggestion from Andreas Schwab.
1998-01-06 Jim Meyering <meyering@na-net.ornl.gov>
* lib/getdate.y: Move inclusion of getdate.h and dependent extern
declarations down so getdate.h's prototype follows the sometimes-
enabled definition of `const' to nothing. Otherwise, the prototype
wouldn't match the definition because of the defined-away `const'.
From Kaveh Ghazi.
(get_date): ANSI-fy definition.
Add %expect directive.
1998-01-05 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* lib/makepath.c (make_path): Put only newly created directories
on the LEADING_DIRS list.
1998-01-05 Paul Eggert <eggert@twinsun.com>
* lib/fsusage.c (PROPAGATE_ALL_ONES): New macro.
(get_fs_usage): If a value consists entirely of 1 bits,
propagate this info to the output by setting it to (uintmax_t) -1.
* src/df.c (df_readable): New function.
(show_dev): If a value consists entirely of 1 bits, or is derived
from some other value that consists entirely of 1 bits, report "-".
Check inode and block counts more carefully for plausibility,
to avoid arithmetic overflow when computing percentages.
1998-01-04 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.16j.

View File

@@ -1,4 +1,6 @@
Changes in release 3.17:
[3.16k]
* install accepts new option, -D
[3.16j]
* du accepts new options, --exclude=PAT and --exclude-from=FILE (-X FILE)
* ls now quotes file names for the shell by default, if they contain

View File

@@ -1,3 +1,44 @@
1998-01-10 Jim Meyering <meyering@na-net.ornl.gov>
* src/system.h [HAVE_LIMITS_H]: Include limits.h
(TYPE_SIGNED): Define.
(TYPE_MINIMUM): Define.
(TYPE_MAXIMUM): Define.
(CHAR_BIT): Define.
(SCHAR_MAX): Define.
(UCHAR_MAX): Define.
(SHRT_MAX): Define.
(INT_MAX): Define.
(UINT_MAX): Define.
(LONG_MAX): Define.
(ULONG_MAX): Define.
* src/*.c: Remove definitions of those symbols.
* src/csplit.c: Move inclusion of regex.h/rx.h to follow system.h
since it now includes limit.h which defines RE_DUP_MAX.
* src/nl.c: Likewise.
* src/tac.c: Likewise.
* lib/xstrtol.c (bkm_scale): Renamed from BKM_SCALE.
Rewrite macro as function. Return a value. Update caller.
Cast __ZLONG_MAX `__unsigned long int' before casting to double to
avoid SunOS /bin/cc compiler bug.
1998-01-08 Jim Meyering <meyering@na-net.ornl.gov>
* src/tac-pipe.c: New file. But not yet used.
* src/Makefile.am (EXTRA_DIST): Add tac-pipe.c.
* src/tac.c (tac_stream): Don't perform arithmetic on now-void* pointer
result of xrealloc (until recently it was char*).
* configure.in (AC_CHECK_FUNCS): Add nl_langinfo.
* src/sort.c (inittables): Add && HAVE_NL_LANGINFO to the #if-test
guarding the nls month-checking code.
(nls_numeric_format): Remove unnecessary (and error-evoking w/SunOS' cc)
`unsigned' from dcls of text and lim.
(main): Cast lconvp->grouping to `unsigned char*' to appease SunOS's cc.
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
* lib/Makefile.am (AUTOMAKE_OPTIONS): Define to ../src/ansi2knr.

View File

@@ -1,5 +1,5 @@
/* csplit - split a file into sections determined by context lines
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,24 +29,15 @@
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif /* HAVE_LIMITS_H */
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#if WITH_REGEX
# include <regex.h>
#else
# include <rx.h>
#endif
#include "system.h"
#include "error.h"
#include "xstrtoul.h"
#include "xalloc.h"

View File

@@ -142,7 +142,7 @@ batch_convert (const char *input_filename, const char *format)
{
size_t tz_len = strlen (initial_TZ);
char *buf = xmalloc (3 + tz_len + 1);
mempcpy (mempcpy (buf, "TZ=", 3), initial_TZ, tz_len + 1);
memcpy (mempcpy (buf, "TZ=", 3), initial_TZ, tz_len + 1);
initial_TZ = buf;
}
}

View File

@@ -185,6 +185,13 @@ excluded_fstype (const char *fstype)
return 0;
}
/* Like human_readable, except return "-" if the argument is -1. */
static char *
df_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
{
return n == -1 ? "-" : human_readable (n, buf, from_units, to_units, base);
}
/* Display a space listing for the disk device with absolute path DISK.
If MOUNT_POINT is non-NULL, it is the path of the root of the
filesystem on DISK.
@@ -235,23 +242,28 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
double inodes_percent_used;
uintmax_t inodes_used;
if (fsu.fsu_files == 0)
if (fsu.fsu_files == -1 || fsu.fsu_files < fsu.fsu_ffree)
{
inodes_used = 0;
fsu.fsu_ffree = 0;
inodes_percent_used = 0;
inodes_used = -1;
inodes_percent_used = -1;
}
else
{
inodes_used = fsu.fsu_files - fsu.fsu_ffree;
inodes_percent_used = inodes_used * 100.0 / fsu.fsu_files;
inodes_percent_used =
(fsu.fsu_files == 0 ? 0
: inodes_used * 100.0 / fsu.fsu_files);
}
printf (" %7s %7s %7s %5.0f%%",
human_readable (fsu.fsu_files, buf[0], 1, 1, human_readable_base),
human_readable (inodes_used, buf[1], 1, 1, human_readable_base),
human_readable (fsu.fsu_ffree, buf[2], 1, 1, human_readable_base),
inodes_percent_used);
printf (" %7s %7s %7s ",
df_readable (fsu.fsu_files, buf[0], 1, 1, human_readable_base),
df_readable (inodes_used, buf[1], 1, 1, human_readable_base),
df_readable (fsu.fsu_ffree, buf[2], 1, 1, human_readable_base));
if (inodes_percent_used < 0)
printf (" - ");
else
printf (" %5.0f%%", inodes_percent_used);
}
else
{
@@ -260,27 +272,31 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
double blocks_percent_used;
uintmax_t blocks_used;
if (fsu.fsu_blocks == 0 || fsu.fsu_bavail == (unsigned long) -1)
if (fsu.fsu_blocks == -1 || fsu.fsu_blocks < fsu.fsu_bfree)
{
blocks_used = 0;
fsu.fsu_bavail = 0;
blocks_percent_used = 0;
blocks_used = -1;
blocks_percent_used = -1;
}
else
{
blocks_used = fsu.fsu_blocks - fsu.fsu_bfree;
blocks_percent_used =
blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail);
(fsu.fsu_bfree < fsu.fsu_bavail ? -1
: (blocks_used + fsu.fsu_bavail) == 0 ? 0
: blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail));
}
printf (" %*s %*s %*s %5.0f%% ",
w, human_readable (fsu.fsu_blocks, buf[0], fsu.fsu_blocksize,
output_units, human_readable_base),
w, human_readable (blocks_used, buf[1], fsu.fsu_blocksize,
output_units, human_readable_base),
w, human_readable (fsu.fsu_bavail, buf[2], fsu.fsu_blocksize,
output_units, human_readable_base),
blocks_percent_used);
printf (" %*s %*s %*s ",
w, df_readable (fsu.fsu_blocks, buf[0], fsu.fsu_blocksize,
output_units, human_readable_base),
w, df_readable (blocks_used, buf[1], fsu.fsu_blocksize,
output_units, human_readable_base),
w, df_readable (fsu.fsu_bavail, buf[2], fsu.fsu_blocksize,
output_units, human_readable_base));
if (blocks_percent_used < 0)
printf (" - ");
else
printf (" %5.0f%% ", blocks_percent_used);
}
if (mount_point)

View File

@@ -1,5 +1,5 @@
/* GNU fmt -- simple text formatter.
Copyright (C) 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 94, 95, 96, 1997, 1998 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
@@ -22,18 +22,6 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
/* Redefine. Otherwise, systems (Unicos for one) with headers that define
it to be a type get syntax errors for the variable declaration below. */
#define word unused_word_type

View File

@@ -1,5 +1,5 @@
/* fold -- wrap each input line to fit in specified width.
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 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
@@ -26,18 +26,6 @@
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "xstrtol.h"
#include "error.h"

View File

@@ -53,6 +53,11 @@
This is different from the SunOS 4.0 install, which gives
directories that it creates the default attributes.
-D
Like the -d option, but a file is installed, along with the directory.
Useful when installing into a new directory, and the install
process doesn't properly comprehend making directories.
David MacKenzie <djm@gnu.ai.mit.edu> */
#ifdef _AIX
@@ -113,6 +118,7 @@ gid_t getgid ();
#endif
char *base_name ();
char *dirname ();
int safe_read ();
int full_write ();
int isdir ();
@@ -122,6 +128,7 @@ static int change_timestamps PARAMS ((const char *from, const char *to));
static int change_attributes PARAMS ((const char *path, int no_need_to_chown));
static int copy_file PARAMS ((const char *from, const char *to,
int *to_created));
static int install_file_to_path PARAMS ((const char *from, const char *to));
static int install_file_in_dir PARAMS ((const char *from, const char *to_dir));
static int install_file_in_file PARAMS ((const char *from, const char *to));
static void get_ids PARAMS ((void));
@@ -191,6 +198,7 @@ main (int argc, char **argv)
char *symbolic_mode = NULL;
int make_backups = 0;
char *version;
int mkdir_and_install = 0;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -206,12 +214,12 @@ main (int argc, char **argv)
verbose = 0;
umask (0);
version = getenv ("SIMPLE_BACKUP_SUFFIX");
if (version)
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
version = getenv ("SIMPLE_BACKUP_SUFFIX");
if (version)
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
while ((optc = getopt_long (argc, argv, "bcsdg:m:o:pvV:S:", long_options,
while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pvV:S:", long_options,
NULL)) != -1)
{
switch (optc)
@@ -229,6 +237,9 @@ main (int argc, char **argv)
case 'd':
dir_arg = 1;
break;
case 'D':
mkdir_and_install = 1;
break;
case 'v':
verbose = 1;
break;
@@ -303,8 +314,10 @@ main (int argc, char **argv)
else
{
if (optind == argc - 2)
{
if (!isdir (argv[argc - 1]))
{
if (mkdir_and_install)
errors = install_file_to_path (argv[argc - 2], argv[argc - 1]);
else if (!isdir (argv[argc - 1]))
errors = install_file_in_file (argv[argc - 2], argv[argc - 1]);
else
errors = install_file_in_dir (argv[argc - 2], argv[argc - 1]);
@@ -325,6 +338,41 @@ main (int argc, char **argv)
exit (errors);
}
/* Copy file FROM onto file TO, creating any missing parent directories of TO.
Return 0 if successful, 1 if an error occurs */
static int
install_file_to_path (const char *from, const char *to)
{
char *dest_dir;
int fail;
dest_dir = dirname (to);
/* check to make sure this is a path (not install a b ) */
if (!STREQ (dest_dir, ".")
&& !isdir (dest_dir))
{
/* FIXME: Note that it's a little kludgey (even dangerous) that we
derive the permissions for parent directories from the permissions
specfied for the file, but since this option is intended mainly to
help installers when the distribution doesn't provide proper install
rules, it's not so bad. Maybe use something like this instead:
int parent_dir_mode = (mode | (S_IRUGO | S_IXUGO)) & (~SPECIAL_BITS);
*/
fail = make_path (dest_dir, mode, mode, owner_id, group_id, 0,
(verbose ? _("creating directory `%s'") : NULL));
}
else
{
fail = install_file_in_file (from, to);
}
free (dest_dir);
return fail;
}
/* Copy file FROM onto file TO and give TO the appropriate
attributes.
Return 0 if successful, 1 if an error occurs. */
@@ -647,13 +695,16 @@ Usage: %s [OPTION]... SOURCE DEST (1st format)\n\
"),
program_name, program_name, program_name);
printf (_("\
In first two formats, copy SOURCE to DEST or multiple SOURCE(s) to\n\
DIRECTORY, while setting permission modes and owner/group. In third\n\
format, make all components of the given DIRECTORY(ies).\n\
In the first two formats, copy SOURCE to DEST or multiple SOURCE(s) to\n\
the existing DIRECTORY, while setting permission modes and owner/group.\n\
In the third format, create all components of the given DIRECTORY(ies).\n\
\n\
-b, --backup make backup before removal\n\
-c (ignored)\n\
-d, --directory create [leading] directories, mandatory for 3rd format\n\
-d, --directory treat all arguments as directory names; create all\n\
components of the specified directories\n\
-D create all leading components of DEST except the last,\n\
then copy SOURCE to DEST; useful in the 1st format\n\
-g, --group=GROUP set group ownership, instead of process' current group\n\
-m, --mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x\n\
-o, --owner=OWNER set ownership (super-user only)\n\

View File

@@ -1,5 +1,5 @@
/* join - join lines of two files on a common field
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 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
@@ -28,18 +28,6 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#if _LIBC || STDC_HEADERS
# define TOLOWER(c) tolower (c)
#else

View File

@@ -1020,6 +1020,7 @@ decode_switches (int argc, char **argv)
break;
case 'u':
sort_type = sort_time;
time_type = time_atime;
break;
@@ -2966,12 +2967,13 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
printf (_("\
-S sort by file size\n\
--sort=WORD ctime -c, extension -X, none -U, size -S,\n\
--sort=WORD extension -X, none -U, size -S, time -t,\n\
version -v\n\
status -c, time -t, atime -u, access -u, use -u\n\
--time=WORD show time as WORD instead of modification time:\n\
atime, access, use, ctime or status\n\
-t sort by modification time; with -l: show mtime\n\
atime, access, use, ctime or status; use\n\
specified time as sort key if --sort=time\n\
-t sort by modification time\n\
-T, --tabsize=COLS assume tab stops at each COLS instead of 8\n\
-u sort by last access time; with -l: show atime\n\
-U do not sort; list entries in directory order\n\

View File

@@ -1,5 +1,5 @@
/* nl -- number lines of files
Copyright (C) 89, 92, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 92, 95, 96, 1997, 1998 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
@@ -24,9 +24,8 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#include "linebuffer.h"
#include "system.h"
#if WITH_REGEX
# include <regex.h>
@@ -34,16 +33,6 @@
# include <rx.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "linebuffer.h"
#include "system.h"
#include "error.h"
#include "xstrtol.h"

View File

@@ -1,5 +1,5 @@
/* od -- dump files in octal and other formats
Copyright (C) 92, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 92, 95, 96, 1997, 1998 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
@@ -37,36 +37,11 @@ typedef long double LONG_DOUBLE;
typedef double LONG_DOUBLE;
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef SCHAR_MAX
# define SCHAR_MAX 127
#endif
#ifndef SCHAR_MIN
# define SCHAR_MIN (-128)
#endif
#ifndef SHRT_MAX
# define SHRT_MAX 32767
#endif
#ifndef SHRT_MIN
# define SHRT_MIN (-32768)
#endif
#ifndef ULONG_MAX
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
#endif
#ifndef LONG_MAX
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
#endif
#if HAVE_VALUES_H
# include <values.h>
#endif
#ifndef BITSPERBYTE
# define BITSPERBYTE 8
#endif
#ifndef MAX
# define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif

View File

@@ -1,5 +1,5 @@
/* pr -- convert text files for printing.
Copyright (C) 88, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -178,18 +178,6 @@
#include "error.h"
#include "xstrtol.h"
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#ifndef TRUE
# define TRUE 1
# define FALSE 0

View File

@@ -1,5 +1,5 @@
/* sort - sort lines of text (with all kinds of options).
Copyright (C) 88, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
Copyright (C) 88, 91-97, 98 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
@@ -43,14 +43,6 @@
# include <langinfo.h>
#endif
#ifdef HAVE_LIMITS_H
# include <limits.h>
#else
# ifndef UCHAR_MAX
# define UCHAR_MAX 255
# endif
#endif
char *xstrdup ();
/* Undefine, to avoid warning about redefinition on some systems. */
@@ -567,7 +559,7 @@ inittables (void)
fold_toupper[i] = i;
}
#ifdef ENABLE_NLS
#if defined ENABLE_NLS && HAVE_NL_LANGINFO
/* If We're not in the "C" locale, read in different names for months. */
if (need_locale)
{
@@ -578,12 +570,12 @@ inittables (void)
size_t s_len;
int j;
s = nl_langinfo (ABMON_1 + us_monthtab[i].val - 1);
s = (unsigned char *) nl_langinfo (ABMON_1 + us_monthtab[i].val - 1);
s_len = strlen (s);
nls_monthtab[i].name = (char *) xmalloc (s_len + 1);
nls_monthtab[i].val = us_monthtab[i].val;
/* It has been pointed out, that abreviated month names
/* Be careful: abreviated month names
may be longer than the usual 3 characters. */
for (j = 0; j < s_len; j++)
nls_monthtab[i].name[j] = fold_toupper[s[j]];
@@ -2100,8 +2092,8 @@ nls_numeric_format (const struct line *line, int nlines)
int iter;
for (iter = 0; !nls_fraction_found; iter++)
{
unsigned char *text;
unsigned char *lim;
char *text;
char *lim;
struct keyfield *key = n_key->key;
/* text = {}, lim = {}, key = first key */
@@ -2492,7 +2484,7 @@ main (int argc, char **argv)
decimal_point = *lconvp->decimal_point;
th_sep = *lconvp->thousands_sep;
nls_grouping = lconvp->grouping;
nls_grouping = (unsigned char *) (lconvp->grouping);
}
/* if locale doesn't define a decimal point, we'll use the

View File

@@ -1,5 +1,5 @@
/* split.c -- split a file into pieces.
Copyright (C) 88, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 91, 95, 96, 1997, 1998 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
@@ -27,18 +27,6 @@
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "error.h"
#include "xstrtol.h"

View File

@@ -1,5 +1,5 @@
/* tac - concatenate and print files in reverse
Copyright (C) 88, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 89, 90, 91, 95, 96, 1997, 1998 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
@@ -40,12 +40,14 @@ tac -r -s '.\|
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
#if WITH_REGEX
# include <regex.h>
#else
# include <rx.h>
#endif
#include "system.h"
#include "error.h"
#ifndef DEFAULT_TMPDIR
@@ -312,7 +314,8 @@ tac_stream (FILE *in, const char *file)
read_size *= 2;
G_buffer_size = read_size * 2 + sentinel_length + 2;
newbuffer = xrealloc (G_buffer - offset, G_buffer_size) + offset;
newbuffer = xrealloc (G_buffer - offset, G_buffer_size);
newbuffer += offset;
/* Adjust the pointers for the new buffer location. */
match_start += newbuffer - G_buffer;
past_end += newbuffer - G_buffer;

View File

@@ -1,5 +1,5 @@
/* tail -- output the last part of file(s)
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -49,25 +49,17 @@
#include <assert.h>
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#include "system.h"
#include "xstrtoul.h"
#include "error.h"
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
#ifndef OFF_T_MIN
# define OFF_T_MIN (0 < (off_t) -1 ? (off_t) 0 \
: ~ (off_t) 0 << (sizeof (off_t) * CHAR_BIT - 1))
# define OFF_T_MIN TYPE_MINIMUM (off_t)
#endif
#ifndef OFF_T_MAX
# define OFF_T_MAX (~ (off_t) 0 - OFF_T_MIN)
# define OFF_T_MAX TYPE_MAXIMUM (off_t)
#endif
/* Disable assertions. Some systems have broken assert macros. */

View File

@@ -1,5 +1,5 @@
/* tr -- a filter to translate characters
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,33 +29,9 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#include "system.h"
#include "error.h"
#ifndef ULONG_MAX
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
#endif
#ifndef LONG_MAX
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#ifndef UCHAR_MAX
# define UCHAR_MAX 0xFF
#endif
#define N_CHARS (UCHAR_MAX + 1)
/* A pointer to a function that returns an int. */

View File

@@ -1,5 +1,5 @@
/* unexpand - convert spaces to tabs
Copyright (C) 89, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,18 +45,6 @@
#include <sys/types.h>
#include "system.h"
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "error.h"
/* The number of bytes added at a time to the amount of memory

View File

@@ -1,5 +1,5 @@
/* uniq -- remove duplicate lines from a sorted file
Copyright (C) 86, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 86, 91, 95, 96, 1997, 1998 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
@@ -26,18 +26,6 @@
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "linebuffer.h"
#include "error.h"

View File

@@ -36,6 +36,7 @@ export LC_ALL
LANG=C
export LANG
fail=0
$LN -sf a b > err 2>&1 && fail=1
case `cat err` in
*'are the same file') ;;

View File

@@ -1,42 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = ls
explicit = '""""" "' b
maint_gen = q1.X q2.X
run_gen = q1.O q1.E q2.O q2.E
##test-files-end
AUTOMAKE_OPTIONS = 1.2 gnits
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
TESTS = time-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = LS=../../src/ls

View File

@@ -1,8 +1,14 @@
# Makefile.in generated automatically by automake 1.2 from Makefile.am
# Makefile.in generated automatically by automake 1.2d from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
@@ -43,12 +49,12 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = true
PRE_INSTALL = true
POST_INSTALL = true
NORMAL_UNINSTALL = true
PRE_UNINSTALL = true
POST_UNINSTALL = true
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
@@ -71,6 +77,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
@@ -81,42 +88,14 @@ VERSION = @VERSION@
YACC = @YACC@
l = @l@
x = ls
explicit =
maint_gen = obs-c1.I obs-c1.X obs-c2.I obs-c2.X obs-c3.I obs-c3.X obs-c4.I \
obs-c4.X obs-c5.I obs-c5.X obs-l1.I obs-l1.X obs-l2.I obs-l2.X obs-l3.I \
obs-l3.X obs-l4.I obs-l4.X obs-l5.I obs-l5.X obs-1.I obs-1.X obs-2.I obs-2.X \
obs-3.I obs-3.X obs-4.I obs-4.X obs-5.I obs-5.X obsx-1.I obsx-1.X obsx-2.I \
obsx-2.X obs-l.I obs-l.X err-1.I err-1.X err-2.I err-2.X err-3.I err-3.X \
err-4.I err-4.X err-5.I err-5.X err-6.I err-6.X minus-1.I minus-1.X minus-2.I \
minus-2.X n-1.I n-1.X n-2.I n-2.X n-3.I n-3.X n-4.I n-4.X n-4a.I n-4a.X n-5.I \
n-5.X n-5a.I n-5a.X n-5b.I n-5b.X
run_gen = obs-c1.O obs-c1.E obs-c2.O obs-c2.E obs-c3.O obs-c3.E obs-c4.O \
obs-c4.E obs-c5.O obs-c5.E obs-l1.O obs-l1.E obs-l2.O obs-l2.E obs-l3.O \
obs-l3.E obs-l4.O obs-l4.E obs-l5.O obs-l5.E obs-1.O obs-1.E obs-2.O obs-2.E \
obs-3.O obs-3.E obs-4.O obs-4.E obs-5.O obs-5.E obsx-1.O obsx-1.E obsx-2.O \
obsx-2.E obs-l.O obs-l.E err-1.O err-1.E err-2.O err-2.E err-3.O err-3.E \
err-4.O err-4.E err-5.O err-5.E err-6.O err-6.E minus-1.O minus-1.E minus-2.O \
minus-2.E n-1.O n-1.E n-2.O n-2.E n-3.O n-3.E n-4.O n-4.E n-4a.O n-4a.E n-5.O \
n-5.E n-5a.O n-5a.E n-5b.O n-5b.E
AUTOMAKE_OPTIONS = 1.2 gnits
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
TESTS = time-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = LS=../../src/ls
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
SCRIPTS = $(noinst_SCRIPTS)
DIST_COMMON = Makefile.am Makefile.in
@@ -127,7 +106,6 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/ls/Makefile
@@ -146,6 +124,7 @@ subdir = tests/ls
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/ls/Makefile
@for file in $(DISTFILES); do \
@@ -195,7 +174,7 @@ install: install-exec install-data all
uninstall:
all: Makefile $(SCRIPTS)
all: Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
@@ -203,25 +182,25 @@ installdirs:
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
rm -f Makefile $(DISTCLEANFILES)
rm -f config.cache config.log stamp-h stamp-h[0-9]*
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean
distclean: distclean-generic clean
rm -f config.status
-rm -f config.status
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@@ -233,27 +212,6 @@ mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

56
tests/ls/time-1 Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/sh
# Test some of ls's sorting options.
: ${LS=ls}
test=time-1
if test "$VERBOSE" = yes; then
set -x
$LS --version
fi
tmp=t-ls.$$
# We're going to LS from a subdir. Prepend ../ if $LS is not an
# absolute file name.
case $LS in
/*) ;;
*) LS=../$LS
esac
test_failure=0
mkdir $tmp || test_failure=1
cd $tmp || test_failure=1
: > a || test_failure=1
sleep 1
: > b || test_failure=1
: > c || test_failure=1
sleep 1
cat a || test_failure=1
mv c d || test_failure=1
if test $test_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
fail=0
# A was accessed more recently.
set `$LS -u a b`
test "$*" = 'a b' && : || fail=1
# B was modified more recently.
set `$LS -t a b`
test "$*" = 'b a' && : || fail=1
# D has newer ctime.
set `$LS -c a d`
test "$*" = 'd a' && : || fail=1
cd ..
rm -rf $tmp
exit $fail