Compare commits

...

25 Commits

Author SHA1 Message Date
Jim Meyering
72e1d14aec . 1998-09-07 18:08:31 +00:00
Jim Meyering
584f4d85cf (show_dev) [!posix_format]: When using --print-type,
let the device path and the file system type share a single (wider)
field if their combined lengths allow it.  From Andries Brouwer.
1998-09-07 18:08:09 +00:00
Jim Meyering
9096ee8e42 . 1998-09-07 17:03:50 +00:00
Jim Meyering
f7c0efdba2 *** empty log message *** 1998-09-07 15:13:59 +00:00
Jim Meyering
a3c0837bc3 Upon failure, suggest how to rerun the test
with longer delay, in case NFS clock skew was the cause of the failure.
Reported by Kaveh Ghazi.
1998-09-07 15:13:48 +00:00
Jim Meyering
834b042b93 *** empty log message *** 1998-09-07 14:13:26 +00:00
Jim Meyering
f0e77e8722 . 1998-09-07 14:11:00 +00:00
Jim Meyering
5c094d2ab2 *** empty log message *** 1998-09-07 14:10:53 +00:00
Jim Meyering
1eb146483f (_create_file): Don't include $$ in temp file name.
(run_tests): Use shorter suffixes for temp file names.
1998-09-07 14:07:23 +00:00
Jim Meyering
1b3c2bbb06 *** empty log message *** 1998-09-07 14:03:09 +00:00
Jim Meyering
edbbc8335c (run_tests): Add simple PRE/POST hooks. 1998-09-07 13:59:43 +00:00
Jim Meyering
48405e4b9c *** empty log message *** 1998-09-07 13:58:26 +00:00
Jim Meyering
f9ae8064f2 (print_dir_name): Put back.
(print_dir): Also print directory name header if print_dir_name is true.
1998-09-07 13:02:46 +00:00
Jim Meyering
9ce9d75ddb add test harness 1998-09-07 03:23:30 +00:00
Jim Meyering
d59ce5651c *** empty log message *** 1998-09-07 02:38:28 +00:00
Jim Meyering
981c203fab *** empty log message *** 1998-09-07 02:36:36 +00:00
Jim Meyering
c0385fb129 Include posixtm.h.
(usage): Correct the description of the format of the
date string argument to -t option.
(main): Update to use rewritten posixtime function.
Reported by Andries Brouwer.
1998-09-07 02:35:31 +00:00
Jim Meyering
ac88b78ef3 *** empty log message *** 1998-09-07 02:24:39 +00:00
Jim Meyering
e01fce9e16 (libfu_a_SOURCES): Change posixtm.y to posixtm.c.
(noinst_HEADERS): Add posixtm.h.
1998-09-07 02:21:19 +00:00
Jim Meyering
164bff8dc0 *** empty log message *** 1998-09-07 02:18:43 +00:00
Jim Meyering
7b7b9007db . 1998-09-07 02:17:55 +00:00
Jim Meyering
c0ad97a781 rewrite from yacc-based version 1998-09-06 22:57:00 +00:00
Jim Meyering
c5a9a5f563 . 1998-09-06 22:55:47 +00:00
Jim Meyering
b363124be4 *** empty log message *** 1998-09-06 22:53:59 +00:00
Jim Meyering
d06d2de67c remove --help-style comment near top 1998-09-06 04:54:39 +00:00
14 changed files with 380 additions and 979 deletions

1
THANKS
View File

@@ -3,6 +3,7 @@ The rest of the addresses are still in the ChangeLog.
Achim Blumensath: blume@corona.oche.de
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
Andries Brouwer: Andries.Brouwer@cwi.nl
Arne Henrik Juul: arnej@imf.unit.no
Bauke Jan Douma: bjdouma@xs4all.nl
Bengt Martensson: bengt@mathematik.uni-Bremen.de

View File

@@ -1,6 +1,5 @@
Makefile
getdate.c
posixtm.c
safe-stat.h
safe-stat.c
safe-lstat.c

View File

@@ -6,7 +6,7 @@ noinst_LIBRARIES = libfu.a
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
@@ -21,7 +21,7 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
BUILT_SOURCES = getdate.c

View File

@@ -95,7 +95,7 @@ noinst_LIBRARIES = libfu.a
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
@@ -110,10 +110,10 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
BUILT_SOURCES = getdate.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -133,7 +133,6 @@ hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o save-cwd$U.o \
savedir$U.o stripslash$U.o userspec$U.o xgetcwd$U.o xmalloc$U.o \
xstrdup$U.o xstrtol$U.o xstrtoul$U.o yesno$U.o
AR = ar
YLWRAP = $(srcdir)/ylwrap
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
@@ -143,9 +142,9 @@ DIST_COMMON = Makefile.am Makefile.in TODO alloca.c chown.c error.c \
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getgroups.c getline.c group-member.c lchown.c lstat.c \
malloc.c memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
obstack.c obstack.h posixtm.c realloc.c regex.c rename.c rmdir.c \
rpmatch.c stat.c stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c \
strstr.c strtol.c strtoul.c strverscmp.c utime.c ylwrap
obstack.c obstack.h realloc.c regex.c rename.c rmdir.c rpmatch.c stat.c \
stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c \
strtoul.c strverscmp.c utime.c ylwrap
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -162,15 +161,14 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm \
.deps/posixtm.P .deps/quotearg.P .deps/realloc.P .deps/regex.P \
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P \
.deps/save-cwd.P .deps/savedir.P .deps/stat.P .deps/stpcpy.P \
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
.deps/strverscmp.P .deps/userspec.P .deps/utime.P .deps/xgetcwd.P \
.deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P \
.deps/yesno.P
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
.deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P .deps/save-cwd.P \
.deps/savedir.P .deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P \
.deps/strdup.P .deps/strftime.P .deps/stripslash.P .deps/strndup.P \
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/strverscmp.P \
.deps/userspec.P .deps/utime.P .deps/xgetcwd.P .deps/xmalloc.P \
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(libfu_a_OBJECTS)
@@ -231,8 +229,10 @@ libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(RANLIB) libfu.a
.y.c:
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
posixtm.h: posixtm.c
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
getdate.h: getdate.c
addext_.c: addext.c $(ANSI2KNR)

File diff suppressed because it is too large Load Diff

16
lib/posixtm.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef POSIXTM_H_
# define POSIXTM_H_
/* POSIX Date Syntax flags. */
# define PDS_LEADING_YEAR 1
# define PDS_TRAILING_YEAR 2
# define PDS_CENTURY 4
# define PDS_SECONDS 8
time_t
posixtime (const char *s, unsigned int syntax_bits);
struct tm *
posixtm (const char *s, unsigned int syntax_bits);
#endif

View File

@@ -1,3 +1,41 @@
1998-09-07 Jim Meyering <meyering@ascend.com>
* Version 3.16w.
* src/df.c (show_dev) [!posix_format]: When using --print-type,
let the device path and the file system type share a single (wider)
field if their combined lengths allow it. From Andries Brouwer.
* tests/touch/empty-file: Upon failure, suggest how to rerun the test
with longer delay, in case NFS clock skew was the cause of the failure.
Reported by Kaveh Ghazi.
* tests/ls-2/quoting: Add tests.
* tests/Fetish.pm (run_tests): Add simple PRE/POST hooks.
(_create_file): Don't include $$ in temp file name.
(run_tests): Use shorter suffixes for temp file names.
1998-09-06 Jim Meyering <meyering@ascend.com>
* src/touch.c: Include posixtm.h.
(usage): Correct the description of the format of the
date string argument to -t option.
(main): Update to use rewritten posixtime function.
Reported by Andries Brouwer.
* lib/Makefile.am (libfu_a_SOURCES): Change posixtm.y to posixtm.c.
(noinst_HEADERS): Add posixtm.h.
* lib/posixtm.h: New file.
* lib/posixtm.c: New file. Rewritten based on posixtm.y.
* lib/posixtm.y: Remove file.
1998-09-05 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* src/ls.c (print_dir_name): Put back.
(print_dir): Also print directory name header if print_dir_name is
true.
1998-08-29 Jim Meyering <meyering@ascend.com>
* Version 3.16v.

View File

@@ -1,4 +1,7 @@
Changes in release 3.17:
[3.16w]
* touch now interprets `-t TIME-DATE' as POSIX specifies
* `ls EMPTY-DIR EMPTY-DIR' once again outputs the directory names
[3.16v]
* portability fixes
* `ls -R EMPTY-DIR' now outputs the name of the directory

View File

@@ -246,15 +246,29 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
if (! disk)
disk = "-"; /* unknown */
printf ((print_type ? "%-13s" : "%-20s"), disk);
if ((int) strlen (disk) > (print_type ? 13 : 20) && !posix_format)
printf ((print_type ? "\n%13s" : "\n%20s"), "");
if (! fstype)
fstype = "-"; /* unknown */
/* df.c reserved 5 positions for fstype,
but that does not suffice for type iso9660 */
if (print_type)
printf (" %-5s ", fstype);
{
int disk_name_len = (int) strlen (disk);
int fstype_len = (int) strlen (fstype);
if (disk_name_len + fstype_len + 2 < 20)
printf ("%s%*s ", disk, 18 - disk_name_len, fstype);
else if (!posix_format)
printf ("%s\n%18s ", disk, fstype);
else
printf ("%s %s", disk, fstype);
}
else
{
if ((int) strlen (disk) > 20 && !posix_format)
printf ("%s\n%20s", disk, "");
else
printf ("%-20s", disk);
}
if (inode_format)
{

View File

@@ -474,6 +474,10 @@ static int tabsize;
static int dir_defaulted;
/* Nonzero means print each directory name before listing it. */
static int print_dir_name;
/* The line length to use for breaking lines in many-per-line format.
Can be set with -w. */
@@ -683,6 +687,7 @@ main (int argc, char **argv)
exit_status = 0;
dir_defaulted = 1;
print_dir_name = 1;
pending_dirs = 0;
current_time = time ((time_t *) 0);
@@ -753,6 +758,8 @@ main (int argc, char **argv)
if (pending_dirs)
DIRED_PUTCHAR ('\n');
}
else if (pending_dirs && pending_dirs->next == 0)
print_dir_name = 0;
while (pending_dirs)
{
@@ -763,6 +770,7 @@ main (int argc, char **argv)
if (thispend->realname)
free (thispend->realname);
free (thispend);
print_dir_name = 1;
}
if (dired && format == long_format)
@@ -1581,8 +1589,10 @@ print_dir (const char *name, const char *realname)
contents listed rather than being mentioned here as files. */
if (trace_dirs)
extract_dirs_from_files (name, 1);
if (trace_dirs || print_dir_name)
{
extract_dirs_from_files (name, 1);
DIRED_INDENT ();
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
dired_pos += quote_name (stdout, realname ? realname : name,

View File

@@ -15,21 +15,7 @@
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.
-c, --no-create Do not create files that do not exist.
-d, --date=TIME Specify time and date in various formats.
-f Ignored.
-m, --time={mtime,modify} Change modification time only.
-r, --reference=FILE Use the time and date of reference file FILE.
-t TIME Specify time and date in the form
`MMDDhhmm[[CC]YY][.ss]'.
If no options are given, -am is the default, using the current time.
The -r, -t, and -d options are mutually exclusive. If a file does not
exist, create it unless -c is given.
Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
/* Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
and Randy Smith. */
#include <config.h>
@@ -43,12 +29,12 @@
#include "argmatch.h"
#include "getdate.h"
#include "safe-read.h"
#include "posixtm.h"
#ifndef STDC_HEADERS
time_t time ();
#endif
time_t posixtime ();
int full_write ();
void invalid_arg ();
@@ -214,6 +200,8 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);
printf (_(" or : %s [-acm] MMDDhhmm[YY] FILE... (obsolescent)\n"),
program_name);
printf (_("\
Update the access and modification times of each FILE to the current time.\n\
\n\
@@ -223,12 +211,14 @@ Update the access and modification times of each FILE to the current time.\n\
-f (ignored)\n\
-m change only the modification time\n\
-r, --reference=FILE use this file's times instead of current time\n\
-t STAMP use MMDDhhmm[[CC]YY][.ss] instead of current time\n\
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time\n\
--time=WORD access -a, atime -a, mtime -m, modify -m, use -a\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
STAMP may be used without -t if none of -drt, nor --, are used.\n\
Note that the three time-date formats recognized for the -d and -t options\n\
and for the obsolescent argument are all different.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
@@ -288,7 +278,8 @@ main (int argc, char **argv)
case 't':
posix_date++;
newtime = posixtime (optarg);
newtime = posixtime (optarg,
PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS);
if (newtime == (time_t) -1)
error (1, 0, _("invalid date format `%s'"), optarg);
date_set++;
@@ -338,7 +329,7 @@ main (int argc, char **argv)
if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--"))
{
newtime = posixtime (argv[optind]);
newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
if (newtime != (time_t) -1)
{
optind++;

View File

@@ -12,12 +12,12 @@ use FileHandle;
use File::Compare qw(compare);
@ISA = qw(Exporter);
($VERSION = '$Revision: 1.1 $ ') =~ tr/[0-9].//cd;
($VERSION = '$Revision: 1.3 $ ') =~ tr/[0-9].//cd;
@EXPORT = qw (run_tests);
my @Types = qw (IN OUT ERR EXIT);
my @Types = qw (IN OUT ERR EXIT PRE POST);
my %Types = map {$_ => 1} @Types;
my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT);
my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT PRE POST);
my $srcdir = $ENV{srcdir};
my $Global_count = 1;
@@ -73,7 +73,7 @@ sub _create_file ($$$$)
}
else
{
$file = "$test_name-$$.$Global_count";
$file = "$test_name.$Global_count";
++$Global_count;
}
@@ -127,6 +127,7 @@ sub run_tests ($$$$$)
{
my $test_name = shift @$t;
my $expect = {};
my ($pre, $post);
# FIXME: maybe don't reset this.
$Global_count = 1;
@@ -156,6 +157,12 @@ sub run_tests ($$$$$)
die "$program_name: $test_name: more than one $type spec\n"
if $Zero_one_type{$type} and $seen_type{$type}++;
if ($type eq 'PRE' or $type eq 'POST')
{
$expect->{$type} = $val;
next;
}
if ($type eq 'EXIT')
{
die "$program_name: $test_name: invalid EXIT code\n"
@@ -229,9 +236,10 @@ sub run_tests ($$$$$)
# in OUT or ERR spec?
warn "$test_name...\n" if $verbose;
&{$expect->{PRE}} if $expect->{PRE};
my %tmp;
$tmp{OUT} = "$test_name-out";
$tmp{ERR} = "$test_name-err";
$tmp{OUT} = "$test_name.O";
$tmp{ERR} = "$test_name.E";
push @junk_files, $tmp{OUT}, $tmp{ERR};
my @cmd = ($prog, @args, "> $tmp{OUT}", "2> $tmp{ERR}");
my $cmd_str = join ' ', @cmd;
@@ -242,7 +250,7 @@ sub run_tests ($$$$$)
warn "$program_name: test $test_name failed: command failed:\n"
. " `$cmd_str': $!\n";
$fail = 1;
next;
goto cleanup;
}
$rc >>= 8 if $rc > 0x80;
if ($expect->{EXIT} != $rc)
@@ -250,7 +258,7 @@ sub run_tests ($$$$$)
warn "$program_name: test $test_name failed: exit status mismatch:"
. " expected $expect->{EXIT}, got $rc\n";
$fail = 1;
next;
goto cleanup;
}
foreach $eo (qw (OUT ERR))
@@ -263,6 +271,10 @@ sub run_tests ($$$$$)
$fail = 1;
}
}
cleanup:
&{$expect->{POST}} if $expect->{POST};
}
# FIXME: maybe unlink files inside the big foreach loop?

View File

@@ -7,6 +7,9 @@ use strict;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $mkdir = {PRE => sub {mkdir 'd',0755 or die "d: $!\n"}};
my $rmdir = {POST => sub {rmdir 'd' or die "d: $!\n"}};
my $q_bell = {IN => {"q\a" => ''}};
my @Tests =
(
@@ -23,9 +26,13 @@ my @Tests =
['q-qs-sh-a', '--quoting=shell-always', $q_bell, {OUT => "'q\a'\n"}],
['q-qs-c', '--quoting=c', $q_bell, {OUT => "\"q\\a\"\n"}],
['q-qs-esc', '--quoting=escape', $q_bell, {OUT => "q\\a\n"}],
['emptydir', 'd', {OUT => ''}, $mkdir, $rmdir],
['emptydir-x2', 'd d', {OUT => "d:\n\nd:\n"}, $mkdir, $rmdir],
['emptydir-R', '-R d', {OUT => "d:\n"}, $mkdir, $rmdir],
);
my $save_temps = 0;
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";

View File

@@ -12,6 +12,11 @@ if test "$VERBOSE" = yes; then
$TOUCH --version
fi
DEFAULT_SLEEP_SECONDS=2
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}
fail=0
# FIXME: find writable directories on other partitions
# and run the test in those directories, too.
@@ -32,14 +37,14 @@ if test $framework_failure = 1; then
exit 1
fi
sleep 2
sleep $SLEEP_SECONDS
for d in $TOUCH_DIR_LIST; do
$TOUCH $d/a || fail=1
set x `$LS -t $d/a $d/b`
test "$*" = "x $d/a $d/b" || fail=1
done
sleep 2
sleep $SLEEP_SECONDS
for d in $TOUCH_DIR_LIST; do
$TOUCH $d/b
set x `$LS -t $d/a $d/b`
@@ -48,4 +53,14 @@ for d in $TOUCH_DIR_LIST; do
$RM -rf $d/a $d/b
done
if test $fail != 0; then
cat 1>&2 <<EOF
*** This test has just failed. That can happen when the test is run in an
*** NFS-mounted directory on a system whose clock is not well synchronized
*** with that of the NFS server. If you think that is the reason, set the
*** environment variable SLEEP_SECONDS to some number of seconds larger than
*** the default of $DEFAULT_SLEEP_SECONDS and rerun the test.
EOF
fi
exit $fail