Compare commits

..

55 Commits

Author SHA1 Message Date
Jim Meyering
11135e1307 *** empty log message *** 1998-11-14 15:33:42 +00:00
Jim Meyering
d8a0eef528 (cvs-dist): Search for `$tag:' rather than just $tag
to avoid matching a prefix of another tag.
1998-11-14 15:33:34 +00:00
Jim Meyering
b7657496c3 update from master copy 1998-11-14 15:00:39 +00:00
Jim Meyering
01c7f17f33 Correct comment. POSIX does not permit it to succeed. 1998-11-14 13:23:22 +00:00
Jim Meyering
a211252152 *** empty log message *** 1998-11-14 13:23:08 +00:00
Jim Meyering
24c0a0a99d Correct comment. POSIX does not permit it to succeed. 1998-11-14 13:22:58 +00:00
Jim Meyering
df521a1b29 revert-to-4.0-b7 1998-11-14 13:17:34 +00:00
Jim Meyering
686a7e9ff3 *** empty log message *** 1998-11-14 13:15:22 +00:00
Jim Meyering
1d738b51d1 revert backupfile change 1998-11-14 13:13:50 +00:00
Jim Meyering
84c2d0e52e revert-last-change 1998-11-14 13:13:10 +00:00
Jim Meyering
6c0c08eb29 back out last change: there is a better way 1998-11-11 05:16:09 +00:00
Jim Meyering
7de9edecfc (BACKUPFILE_EXIT_FAILURE): Define.
(get_version): Use it in place of EXIT_FAILURE.
1998-11-11 05:01:26 +00:00
Jim Meyering
9e3f43b368 [EXIT_FAILURE]: Define.
(get_version): Use EXIT_FAILURE as exit status rather than
hard-coding `2'.  From Franois Pinard.
1998-11-10 05:57:56 +00:00
Jim Meyering
d7b702d0d0 avoid new warnings from texinfo-1.12b 1998-11-08 16:20:00 +00:00
Jim Meyering
ed5b1cad23 . 1998-11-08 16:13:13 +00:00
Jim Meyering
532074e1c7 . 1998-11-08 03:49:22 +00:00
Jim Meyering
deef42170f *** empty log message *** 1998-11-08 03:44:44 +00:00
Jim Meyering
b808de586b *** empty log message *** 1998-11-08 03:42:44 +00:00
Jim Meyering
ac7f057d98 Rewrite to set HAVE_LSTAT_EMPTY_STRING_BUG. 1998-11-08 03:42:35 +00:00
Jim Meyering
2daa912c53 Rewrite to set HAVE_STAT_EMPTY_STRING_BUG. 1998-11-08 03:42:20 +00:00
Jim Meyering
7bf8c634eb . 1998-11-08 03:42:04 +00:00
Jim Meyering
c091e6fe83 [lstat]: Remove #undef.
(rpl_lstat): Protoize.  Use ENOENT, not EINVAL, to be consistent
with lib/stat.c.
1998-11-08 03:40:04 +00:00
Jim Meyering
dc61111cc6 (rpl_stat): Protoize.
(stat): Remove #undef.
1998-11-08 03:39:42 +00:00
Jim Meyering
920680fe4f [HAVE_LSTAT_EMPTY_STRING_BUG]: Define lstat to rpl_lstat and declare the latter. 1998-11-08 03:38:06 +00:00
Jim Meyering
c9f0e3d343 *** empty log message *** 1998-11-02 17:08:44 +00:00
Jim Meyering
b4c9bd2b7e . 1998-11-01 17:17:52 +00:00
Jim Meyering
453be366da latest from ftp.gnu.org 1998-11-01 16:41:46 +00:00
Jim Meyering
f51e80f564 *** empty log message *** 1998-11-01 05:26:06 +00:00
Jim Meyering
993a56e8e0 . 1998-11-01 01:04:11 +00:00
Jim Meyering
d8e4dccdca . 1998-11-01 01:02:24 +00:00
Jim Meyering
427e67b196 Rewrite to use new testing framework. 1998-11-01 00:52:32 +00:00
Jim Meyering
90ffddc87e . 1998-11-01 00:52:16 +00:00
Jim Meyering
8458f55338 *** empty log message *** 1998-11-01 00:52:06 +00:00
Jim Meyering
bf5ef10371 . 1998-11-01 00:51:26 +00:00
Jim Meyering
d087967041 . 1998-11-01 00:50:23 +00:00
Jim Meyering
cfb54dec88 *** empty log message *** 1998-11-01 00:49:44 +00:00
Jim Meyering
e1958a7253 *** empty log message *** 1998-11-01 00:12:41 +00:00
Jim Meyering
cf50a06294 (TESTS): Add new test `empty-name', but comment it out. 1998-11-01 00:12:07 +00:00
Jim Meyering
c96d9a880f *** empty log message *** 1998-11-01 00:09:44 +00:00
Jim Meyering
25bf05e45e update from master copy 1998-10-31 15:19:09 +00:00
Jim Meyering
99b35637c4 . 1998-10-25 14:30:46 +00:00
Jim Meyering
09b8756e33 . 1998-10-25 14:30:15 +00:00
Jim Meyering
9c5d11d5c5 . 1998-10-25 14:28:04 +00:00
Jim Meyering
bf6c2a07af *** empty log message *** 1998-10-25 14:12:47 +00:00
Jim Meyering
c729fe037e (TESTS): Add new test `unreadable'. But comment
it out since we're so close to release and since the test compares the
text of diagnostics that are likely to vary between systems.
(TEST_ENVIRONMENT): Add required framework.
1998-10-25 14:08:38 +00:00
Jim Meyering
02cde32c0a *** empty log message *** 1998-10-25 14:03:09 +00:00
Jim Meyering
7741f87086 *** empty log message *** 1998-10-25 13:58:56 +00:00
Jim Meyering
9e630b86cb (remove_cwd_entries): Don't apply CLOSEDIR to a NULL
pointer. (provoke with `mkdir -m 0100 x; rm -rf x')
Upon CLOSEDIR failure, set `status' to RM_ERROR, not RM_OK.
(remove_dir): Return `status', rather than always RM_OK.
1998-10-25 13:58:50 +00:00
Jim Meyering
2e19f14a91 *** empty log message *** 1998-10-23 02:08:48 +00:00
Jim Meyering
65b1a6ec82 (usage): Add mention of --version and --help. 1998-10-23 02:08:35 +00:00
Jim Meyering
06d1a87e3b *** empty log message *** 1998-10-18 14:18:22 +00:00
Jim Meyering
f417e8b9d4 . 1998-10-18 14:14:09 +00:00
Jim Meyering
4fb556ee0e Don't invoke localtime_r or gmtime_r unless it's the GNU C
library's localtime_r and gmtime_r; there are too many buggy
	implementations of localtime_r and gmtime_r out there, and
	it's not worth keeping track of all the different bugs.

	* strftime.c (__EXTENSIONS__): Remove.
	(my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed.
	(my_strftime_localtime_r): Renamed from localtime_r; all uses changed.
	Base them on localtime/gmtime if not _LIBC.
1998-10-18 14:09:48 +00:00
Jim Meyering
c850393032 Don't invoke localtime_r or gmtime_r unless it's the GNU C
library's localtime_r and gmtime_r; there are too many buggy
	implementations of localtime_r and gmtime_r out there, and
	it's not worth keeping track of all the different bugs.

	* mktime.c (__EXTENSIONS__, HAVE_LOCALTIME_R): Remove.
	(my_mktime_localtime_r): Renamed from localtime_r; all uses changed.
	Base it on localtime unless _LIBC.
1998-10-18 14:08:35 +00:00
Jim Meyering
61ece919c6 (jm_CHECK_DECL_LOCALTIME_R): Remove macro. 1998-10-18 14:08:09 +00:00
29 changed files with 616 additions and 972 deletions

View File

@@ -18,7 +18,7 @@ cvs-dist: maintainer-check
ver=`echo "$(VERSION)" | sed 's/\./_/g'`; \
tag="$$pkg-$$ver"; \
echo tag=$$tag; \
if cvs -n log -h README| grep -e $$tag > /dev/null; then \
if cvs -n log -h README| grep -e $$tag: > /dev/null; then \
echo "VERSION not new; not tagging" 1>&2; \
exit 1; \
fi; \

View File

@@ -1,5 +1,9 @@
% texinfo.tex -- TeX macros to handle Texinfo files.
\def\texinfoversion{1998-09-30}%
%
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{1998-11-13}%
%
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
% Free Software Foundation, Inc.
@@ -50,12 +54,6 @@
% Sometimes one run after texindex suffices, and sometimes you need more
% than two; texi2dvi does it as many times as necessary.
% Make it possible to create a .fmt file just by loading this file:
% if the underlying format is not loaded, start by loading it now.
% Added by gildea November 1993.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
\message{Loading texinfo [version \texinfoversion]:}
% If in a .fmt file, print the version number
@@ -189,13 +187,16 @@
\shipout\vbox{%
\ifcropmarks \vbox to \outervsize\bgroup
\hsize = \outerhsize
\line{\ewtop\hfil\ewtop}%
\nointerlineskip
\line{%
\vbox{\moveleft\cornerthick\nstop}%
\hfill
\vbox{\moveright\cornerthick\nstop}%
}%
\vskip-\topandbottommargin
\vtop to0pt{%
\line{\ewtop\hfil\ewtop}%
\nointerlineskip
\line{%
\vbox{\moveleft\cornerthick\nstop}%
\hfill
\vbox{\moveright\cornerthick\nstop}%
}%
\vss}%
\vskip\topandbottommargin
\line\bgroup
\hfil % center the page within the outer (page) hsize.
@@ -218,13 +219,15 @@
\hfil\egroup % end of (centering) \line\bgroup
\vskip\topandbottommargin plus1fill minus1fill
\boxmaxdepth = \cornerthick
\line{%
\vbox{\moveleft\cornerthick\nsbot}%
\hfill
\vbox{\moveright\cornerthick\nsbot}%
\vbox to0pt{\vss
\line{%
\vbox{\moveleft\cornerthick\nsbot}%
\hfill
\vbox{\moveright\cornerthick\nsbot}%
}%
\nointerlineskip
\line{\ewbot\hfil\ewbot}%
}%
\nointerlineskip
\line{\ewbot\hfil\ewbot}%
\egroup % \vbox from first cropmarks clause
\fi
}% end of \shipout\vbox
@@ -846,7 +849,7 @@ where each line of input produces a line of output.}
\immediate\write16{If you are running another version of TeX, relax.}
\immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
\immediate\write16{ Then upgrade your TeX installation if you can.}
\immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
\immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
\immediate\write16{If you are stuck with version 3.0, run the}
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
\immediate\write16{ to use a workaround.}
@@ -980,7 +983,7 @@ where each line of input produces a line of output.}
%
\def\expandablevalue#1{%
\expandafter\ifx\csname SET#1\endcsname\relax
{[No value for ``#1'']v}%
{[No value for ``#1'']}%
\else
\csname SET#1\endcsname
\fi
@@ -2408,6 +2411,11 @@ width0pt\relax} \fi
\def\copyright{\realbackslash copyright}%
\def\tclose##1{\realbackslash tclose {##1}}%
\def\code##1{\realbackslash code {##1}}%
\def\uref##1{\realbackslash uref {##1}}%
\def\url##1{\realbackslash url {##1}}%
\def\env##1{\realbackslash env {##1}}%
\def\command##1{\realbackslash command {##1}}%
\def\option##1{\realbackslash option {##1}}%
\def\dotless##1{\realbackslash dotless {##1}}%
\def\samp##1{\realbackslash samp {##1}}%
\def\,##1{\realbackslash ,{##1}}%
@@ -2423,6 +2431,7 @@ width0pt\relax} \fi
\def\kbd##1{\realbackslash kbd {##1}}%
\def\dfn##1{\realbackslash dfn {##1}}%
\def\emph##1{\realbackslash emph {##1}}%
\def\acronym##1{\realbackslash acronym {##1}}%
%
% Handle some cases of @value -- where the variable name does not
% contain - or _, and the value does not contain any
@@ -2486,6 +2495,11 @@ width0pt\relax} \fi
%\let\tt=\indexdummyfont
\let\tclose=\indexdummyfont
\let\code=\indexdummyfont
\let\url=\indexdummyfont
\let\uref=\indexdummyfont
\let\env=\indexdummyfont
\let\command=\indexdummyfont
\let\option=\indexdummyfont
\let\file=\indexdummyfont
\let\samp=\indexdummyfont
\let\kbd=\indexdummyfont
@@ -5205,7 +5219,7 @@ width0pt\relax} \fi
\vsize = #1\relax
\advance\vsize by \topskip
\outervsize = \vsize
\advance\outervsize by 0.6in
\advance\outervsize by 2\topandbottommargin
\pageheight = \vsize
%
\hsize = #2\relax
@@ -5445,10 +5459,9 @@ width0pt\relax} \fi
@rm
@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
@c page-delimiter: "^\\\\message"
@c update-date-leading-regexp: "def\\texinfoversion{"
@c update-date-date-regexp: "[-0-9.]+"
@c update-date-format-string: "%Y-%m-%d"
@c update-date-trailing-regexp: "}"
@c eval: (and(load "update-date" t t)(add-hook 'write-file-hooks 'update-date))
@c time-stamp-start: "def\\\\texinfoversion{"
@c time-stamp-format: "%:y-%02m-%02d"
@c time-stamp-end: "}"
@c End:

View File

@@ -2327,7 +2327,7 @@ all GNU extensions and revert to traditional mode, thus introducing some
limitations, and changes several of the program's default option values.
When @samp{-G} is not specified, GNU extensions are always enabled. GNU
extensions to @code{ptx} are documented wherever appropriate in this
document. See @xref{Compatibility in ptx} for an explicit list of them.
document. For the full list, see @xref{Compatibility in ptx}.
Individual options are explained in incoming sections.
@@ -2471,9 +2471,9 @@ only if it is given in the Only file and not given in the Ignore file.
On each input line, the leading sequence of non white characters will be
taken to be a reference that has the purpose of identifying this input
line on the produced permuted index. See @xref{Output formatting in ptx} for
more information about reference production. Using this option change
the default value for option @code{-S}.
line on the produced permuted index. For more information about reference
production, see @xref{Output formatting in ptx}.
Using this option changes the default value for option @code{-S}.
Using this option, the program does not try very hard to remove
references from contexts in output, but it succeeds in doing so

View File

@@ -1,7 +1,7 @@
/* Work around the bug in some systems whereby lstat succeeds when
given the zero-length file name argument. The lstat from SunOS4.1.4
has this bug.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 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
@@ -21,11 +21,6 @@
#include <config.h>
/* Disable the definition of lstat to rpl_lstat (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_lstat on
most systems. */
#undef lstat
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@ -33,16 +28,20 @@
extern int errno;
#endif
/* FIXME: describe. */
/* This is a wrapper for lstat(2).
If FILE is the empty string, fail with errno == ENOENT.
Otherwise, return the result of calling the real lstat.
This works around the bug in some systems whereby lstat succeeds when
given the zero-length file name argument. The lstat from SunOS4.1.4
has this bug. */
int
rpl_lstat (file, sbuf)
const char *file;
struct stat *sbuf;
rpl_lstat (const char *file, struct stat *sbuf)
{
if (file && *file == 0)
{
errno = EINVAL;
errno = ENOENT;
return -1;
}

View File

@@ -1,4 +1,4 @@
/* mktime: convert a `struct tm' to a time_t value zzzzzz
/* mktime: convert a `struct tm' to a time_t value
Copyright (C) 1993-1997, 1998 Free Software Foundation, Inc.
Contributed by Paul Eggert (eggert@twinsun.com).
@@ -28,14 +28,8 @@
# include <config.h>
#endif
/* Some systems need this in order to declare localtime_r properly. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_LOCALTIME_R 1
# define STDC_HEADERS 1
#endif
@@ -49,11 +43,6 @@
#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
/* Provide a declaration of localtime_r on systems that lack it. */
#if ! defined HAVE_DECL_LOCALTIME_R
extern struct tm* localtime_r ();
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#endif
@@ -130,35 +119,23 @@ time_t __mktime_internal __P ((struct tm *,
#ifdef _LIBC
# define localtime_r __localtime_r
# define my_mktime_localtime_r __localtime_r
#else
# if HAVE_LOCALTIME_R == defined localtime_r
/* Provide our own substitute for a missing or possibly broken localtime_r. */
/* If we're a mktime substitute in a GNU program, then prefer
localtime to localtime_r, since many localtime_r implementations
are buggy. */
static struct tm *my_mktime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
my_mktime_localtime_r (t, tp)
const time_t *t;
struct tm *tp;
{
# ifdef localtime_r
/* Digital Unix 4.0A and 4.0D have a macro localtime_r with the
standard meaning, along with an unwanted, nonstandard function
localtime_r. The placeholder function my_mktime_localtime_r
invokes the macro; use that instead of the system's bogus
localtime_r. */
return localtime_r (t, tp);
# undef localtime_r
# else /* ! defined (localtime_r) */
/* Approximate localtime_r as best we can in its absence. */
struct tm *l = localtime (t);
if (! l)
return 0;
*tp = *l;
return tp;
# endif /* ! defined localtime_r */
}
# define localtime_r my_mktime_localtime_r
# endif /* HAVE_LOCALTIME_R == defined localtime_r */
#endif /* ! _LIBC */
@@ -213,7 +190,7 @@ mktime (tp)
__tzset ();
#endif
return __mktime_internal (tp, localtime_r, &localtime_offset);
return __mktime_internal (tp, my_mktime_localtime_r, &localtime_offset);
}
/* Use CONVERT to convert *T to a broken down time in *TP.
@@ -559,6 +536,6 @@ main (argc, argv)
/*
Local Variables:
compile-command: "gcc -DDEBUG -D__EXTENSIONS__ -DHAVE_LIMITS_H -DHAVE_LOCALTIME_R -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
End:
*/

View File

@@ -21,11 +21,6 @@
#include <config.h>
/* Disable the definition of stat to rpl_stat (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_stat on
most systems. */
#undef stat
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@ -42,9 +37,7 @@ extern int errno;
has this bug. */
int
rpl_stat (file, sbuf)
const char *file;
struct stat *sbuf;
rpl_stat (const char *file, struct stat *sbuf)
{
if (file && *file == 0)
{

View File

@@ -22,11 +22,6 @@
# include <config.h>
#endif
/* Some systems need this in order to declare localtime_r properly. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_MBLEN 1
@@ -48,11 +43,6 @@
#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
/* Provide a declaration of localtime_r on systems that lack it. */
#if ! defined HAVE_DECL_LOCALTIME_R
extern struct tm* localtime_r ();
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@@ -141,7 +131,7 @@ extern char *tzname[];
add one for integer division truncation;
add one more for a minus sign if t is signed. */
#define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 100 + 1 + TYPE_SIGNED (t))
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t))
#define TM_YEAR_BASE 1900
@@ -154,19 +144,20 @@ extern char *tzname[];
#ifdef _LIBC
# define gmtime_r __gmtime_r
# define localtime_r __localtime_r
# define my_strftime_gmtime_r __gmtime_r
# define my_strftime_localtime_r __localtime_r
# define tzname __tzname
# define tzset __tzset
#else
# if ! HAVE_LOCALTIME_R
# if ! HAVE_TM_GMTOFF
/* Approximate gmtime_r as best we can in its absence. */
# undef gmtime_r
# define gmtime_r my_gmtime_r
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
/* If we're a strftime substitute in a GNU program, then prefer gmtime
to gmtime_r, since many gmtime_r implementations are buggy.
Similarly for localtime_r. */
# if ! HAVE_TM_GMTOFF
static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
static struct tm *
gmtime_r (t, tp)
my_strftime_gmtime_r (t, tp)
const time_t *t;
struct tm *tp;
{
@@ -176,14 +167,11 @@ gmtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_TM_GMTOFF */
# endif /* ! HAVE_TM_GMTOFF */
/* Approximate localtime_r as best we can in its absence. */
# undef localtime_r
# define localtime_r my_ftime_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
my_strftime_localtime_r (t, tp)
const time_t *t;
struct tm *tp;
{
@@ -193,7 +181,6 @@ localtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_LOCALTIME_R */
#endif /* ! defined _LIBC */
@@ -381,34 +368,35 @@ static char const month_name[][10] =
#ifdef emacs
# define my_strftime emacs_strftime
/* Emacs 20.2 uses `-Dstrftime=emacs_strftime' when compiling,
because that's how strftime used to be configured.
Undo this, since it gets in the way of accessing the underlying strftime,
which is needed for things like %Ec in Solaris.
The following two lines can be removed once Emacs stops compiling with
`-Dstrftime=emacs_strftime'. */
# undef strftime
size_t strftime __P ((char *, size_t, const char *, const struct tm *));
# define my_strftime emacs_strftimeu
# define ut_argument , ut
# define ut_argument_spec int ut;
# define ut_argument_spec_iso , int ut
#else
# define my_strftime strftime
# define ut_argument
# define ut_argument_spec
# define ut_argument_spec_iso
/* We don't have this information in general. */
# define ut 0
#endif
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
Work around this bug by copying *tp before it might be munged. */
size_t _strftime_copytm __P ((char *, size_t, const char *,
const struct tm *));
const struct tm * ut_argument_spec_iso));
size_t
my_strftime (s, maxsize, format, tp)
my_strftime (s, maxsize, format, tp ut_argument)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
ut_argument_spec
{
struct tm tmcopy;
tmcopy = *tp;
return _strftime_copytm (s, maxsize, format, &tmcopy);
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
}
# undef my_strftime
# define my_strftime(S, Maxsize, Format, Tp) \
@@ -423,41 +411,44 @@ size_t strftime __P ((char *, size_t, const char *, const struct tm *));
anywhere, so to determine how many characters would be
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
size_t
my_strftime (s, maxsize, format, tp)
my_strftime (s, maxsize, format, tp ut_argument)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
ut_argument_spec
{
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT
const char *const a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
const char *const f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
const char *const a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
const char *const f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
const char *const ampm = _NL_CURRENT (LC_TIME,
hour12 > 11 ? PM_STR : AM_STR);
size_t aw_len = strlen (a_wkday);
size_t am_len = strlen (a_month);
size_t ap_len = strlen (ampm);
/* We cannot make the following values variables since we must delay
the evaluation of these values until really needed since some
expressions might not be valid in every situation. The `struct tm'
might be generated by a strptime() call that initialized
only a few elements. Dereference the pointers only if the format
requires this. Then it is ok to fail if the pointers are invalid. */
# define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
# define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)
# define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon)
# define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR)
# define aw_len strlen (a_wkday)
# define am_len strlen (a_month)
# define ap_len strlen (ampm)
#else
# if !HAVE_STRFTIME
const char *const f_wkday = weekday_name[tp->tm_wday];
const char *const f_month = month_name[tp->tm_mon];
const char *const a_wkday = f_wkday;
const char *const a_month = f_month;
const char *const ampm = "AMPM" + 2 * (hour12 > 11);
# define f_wkday (weekday_name[tp->tm_wday])
# define f_month (month_name[tp->tm_mon])
# define a_wkday f_wkday
# define a_month f_month
# define ampm ("AMPM" + 2 * (tp->tm_hour > 11))
size_t aw_len = 3;
size_t am_len = 3;
size_t ap_len = 2;
# endif
#endif
#if defined _NL_CURRENT || !HAVE_STRFTIME
size_t wkday_len = strlen (f_wkday);
size_t month_len = strlen (f_month);
#endif
const char *zone;
size_t zonelen;
size_t i = 0;
char *p = s;
const char *f;
@@ -473,25 +464,27 @@ my_strftime (s, maxsize, format, tp)
zone = (const char *) tp->tm_zone;
#endif
#if HAVE_TZNAME
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
if (ut)
{
if (! (zone && *zone))
zone = "GMT";
}
else
{
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
# if HAVE_TZSET
tzset ();
tzset ();
# endif
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
}
#endif
if (! zone)
zone = ""; /* POSIX.2 requires the empty string here. */
zonelen = strlen (zone);
if (hour12 > 12)
hour12 -= 12;
else
if (hour12 == 0) hour12 = 12;
if (hour12 == 0)
hour12 = 12;
for (f = format; *f != '\0'; ++f)
{
@@ -557,7 +550,13 @@ my_strftime (s, maxsize, format, tp)
if (bytes == 0)
break;
if (bytes == (size_t) -2 || bytes == (size_t) -1)
if (bytes == (size_t) -2)
{
len += strlen (f + len);
break;
}
if (bytes == (size_t) -1)
{
len++;
break;
@@ -568,6 +567,7 @@ my_strftime (s, maxsize, format, tp)
while (! mbsinit (&mbstate));
cpy (len, f);
f += len - 1;
continue;
}
}
@@ -677,7 +677,7 @@ my_strftime (s, maxsize, format, tp)
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (wkday_len, f_wkday);
cpy (strlen (f_wkday), f_wkday);
break;
#else
goto underlying_strftime;
@@ -703,7 +703,7 @@ my_strftime (s, maxsize, format, tp)
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (month_len, f_month);
cpy (strlen (f_month), f_month);
break;
#else
goto underlying_strftime;
@@ -727,9 +727,7 @@ my_strftime (s, maxsize, format, tp)
subformat:
{
char *old_start = p;
size_t len = my_strftime (NULL, maxsize - i, subfmt, tp);
if (len == 0 && *subfmt)
return 0;
size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp);
add (len, my_strftime (p, maxsize - i, subfmt, tp));
if (to_uppcase)
@@ -755,7 +753,6 @@ my_strftime (s, maxsize, format, tp)
*u++ = modifier;
*u++ = format_char;
*u = '\0';
ubuf[0] = '\1';
len = strftime (ubuf, sizeof ubuf, ufmt, tp);
if (len == 0 && ubuf[0] != '\0')
return 0;
@@ -1155,7 +1152,16 @@ my_strftime (s, maxsize, format, tp)
to_uppcase = 0;
to_lowcase = 1;
}
cpy (zonelen, zone);
#if HAVE_TZNAME
/* The tzset() call might have changed the value. */
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
#endif
if (! zone)
zone = ""; /* POSIX.2 requires the empty string here. */
cpy (strlen (zone), zone);
break;
case 'z': /* GNU extension. */
@@ -1167,34 +1173,39 @@ my_strftime (s, maxsize, format, tp)
#if HAVE_TM_GMTOFF
diff = tp->tm_gmtoff;
#else
struct tm gtm;
struct tm ltm;
time_t lt;
ltm = *tp;
lt = mktime (&ltm);
if (lt == (time_t) -1)
if (ut)
diff = 0;
else
{
/* mktime returns -1 for errors, but -1 is also a
valid time_t value. Check whether an error really
occurred. */
struct tm tm;
localtime_r (&lt, &tm);
struct tm gtm;
struct tm ltm;
time_t lt;
if ((ltm.tm_sec ^ tm.tm_sec)
| (ltm.tm_min ^ tm.tm_min)
| (ltm.tm_hour ^ tm.tm_hour)
| (ltm.tm_mday ^ tm.tm_mday)
| (ltm.tm_mon ^ tm.tm_mon)
| (ltm.tm_year ^ tm.tm_year))
ltm = *tp;
lt = mktime (&ltm);
if (lt == (time_t) -1)
{
/* mktime returns -1 for errors, but -1 is also a
valid time_t value. Check whether an error really
occurred. */
struct tm tm;
if (! my_strftime_localtime_r (&lt, &tm)
|| ((ltm.tm_sec ^ tm.tm_sec)
| (ltm.tm_min ^ tm.tm_min)
| (ltm.tm_hour ^ tm.tm_hour)
| (ltm.tm_mday ^ tm.tm_mday)
| (ltm.tm_mon ^ tm.tm_mon)
| (ltm.tm_year ^ tm.tm_year)))
break;
}
if (! my_strftime_gmtime_r (&lt, &gtm))
break;
diff = tm_diff (&ltm, &gtm);
}
if (! gmtime_r (&lt, &gtm))
break;
diff = tm_diff (&ltm, &gtm);
#endif
if (diff < 0)
@@ -1227,7 +1238,23 @@ my_strftime (s, maxsize, format, tp)
}
}
if (p)
if (p && i < maxsize)
*p = '\0';
return i;
}
#ifdef emacs
/* For Emacs we have a separate interface which corresponds to the normal
strftime function and does not have the extra information whether the
TP arguments comes from a `gmtime' call or not. */
size_t
emacs_strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
{
return my_strftime (s, maxsize, format, tp, 0);
}
#endif

View File

@@ -1,3 +1,17 @@
1998-11-14 Jim Meyering <meyering@ascend.com>
* lstat.m4: Correct comment. POSIX does not permit it to succeed.
* stat.m4: Likewise.
1998-11-03 Jim Meyering <meyering@ascend.com>
* stat.m4: Rewrite to set HAVE_STAT_EMPTY_STRING_BUG.
* lstat.m4: Rewrite to set HAVE_LSTAT_EMPTY_STRING_BUG.
1998-10-18 Jim Meyering <meyering@ascend.com>
* check-decl.m4 (jm_CHECK_DECL_LOCALTIME_R): Remove macro.
1998-10-17 Jim Meyering <meyering@ascend.com>
* decl.m4 (jm_CHECK_DECLARATION): Don't hard-code which headers to

View File

@@ -1,4 +1,4 @@
#serial 3
#serial 4
dnl This is just a wrapper function to encapsulate this kludge.
dnl Putting it in a separate file like this helps share it between
@@ -35,42 +35,4 @@ AC_DEFUN(jm_CHECK_DECLS,
fi
jm_CHECK_DECLARATIONS($headers, free lseek malloc \
memchr realloc stpcpy strstr)
# Check for a declaration of localtime_r.
jm_CHECK_DECL_LOCALTIME_R
])
dnl localtime_r is a special case...
dnl Code that uses the result of this test must use the same cpp
dnl directives as are used below. Also include the following declaration
dnl after the inclusion of time.h.
dnl
dnl #if ! defined HAVE_DECL_LOCALTIME_R
dnl extern struct tm* localtime_r ();
dnl #endif
AC_DEFUN(jm_CHECK_DECL_LOCALTIME_R,
[
if test x = y; then
dnl This code is deliberately never run via ./configure.
dnl FIXME: this is a gross hack to make autoheader put entries
dnl for each of these symbols in the config.h.in.
dnl Otherwise, I'd have to update acconfig.h every time I change
dnl this list of functions.
AC_CHECK_FUNCS(DECL_LOCALTIME_R)
fi
headers='
/* Some systems need this in order to declare localtime_r properly. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <time.h>
'
jm_CHECK_DECLARATIONS($headers, localtime_r)
])

View File

@@ -1,20 +1,18 @@
#serial 1
#serial 2
dnl From Jim Meyering.
dnl Determine whether lstat has the bug that it succeeds when given the
dnl zero-length file name argument. The lstat from SunOS4.1.4 does this.
dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
dnl (as of 1998-11-01) do this.
dnl
dnl If it doesn't, arrange to use the replacement function.
dnl
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_lstat if the replacement function should be used. */
dnl #undef lstat
dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
dnl compile the wrapper function.
dnl
AC_DEFUN(jm_FUNC_LSTAT,
[
AC_CACHE_CHECK([for working lstat], jm_cv_func_working_lstat,
AC_CACHE_CHECK([whether lstat accepts an empty string],
jm_cv_func_lstat_empty_string_bug,
[AC_TRY_RUN([
# include <sys/types.h>
# include <sys/stat.h>
@@ -23,16 +21,31 @@ AC_DEFUN(jm_FUNC_LSTAT,
main ()
{
struct stat sbuf;
exit (lstat ("", &sbuf) == 0 ? 1 : 0);
exit (lstat ("", &sbuf) ? 1 : 0);
}
],
jm_cv_func_working_lstat=yes,
jm_cv_func_working_lstat=no,
jm_cv_func_lstat_empty_string_bug=yes,
jm_cv_func_lstat_empty_string_bug=no,
dnl When crosscompiling, assume lstat is broken.
jm_cv_func_working_lstat=no)
jm_cv_func_lstat_empty_string_bug=yes)
])
if test $jm_cv_func_working_lstat = no; then
if test $jm_cv_func_lstat_empty_string_bug = yes; then
LIBOBJS="$LIBOBJS lstat.o"
AC_DEFINE_UNQUOTED(lstat, rpl_lstat)
if test $jm_cv_func_lstat_empty_string_bug = yes; then
if test x = y; then
# This code is deliberately never run via ./configure.
# FIXME: this is a hack to make autoheader put the corresponding
# HAVE_* undef for this symbol in config.h.in. This saves me the
# trouble of having to maintain the #undef in acconfig.h manually.
AC_CHECK_FUNCS(LSTAT_EMPTY_STRING_BUG)
fi
# Defining it this way (rather than via AC_DEFINE) short-circuits the
# autoheader check -- autoheader doesn't know it's already been taken
# care of by the hack above.
ac_kludge=HAVE_LSTAT_EMPTY_STRING_BUG
AC_DEFINE_UNQUOTED($ac_kludge)
fi
fi
])

View File

@@ -1,20 +1,18 @@
#serial 1
#serial 2
dnl From Jim Meyering.
dnl Determine whether stat has the bug that it succeeds when given the
dnl zero-length file name argument. The stat from SunOS4.1.4 does this.
dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
dnl (as of 1998-11-01) do this.
dnl
dnl If it doesn't, arrange to use the replacement function.
dnl
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_stat if the replacement function should be used. */
dnl #undef stat
dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
dnl compile the wrapper function.
dnl
AC_DEFUN(jm_FUNC_STAT,
[
AC_CACHE_CHECK([for working stat], jm_cv_func_working_stat,
AC_CACHE_CHECK([whether stat accepts an empty string],
jm_cv_func_stat_empty_string_bug,
[AC_TRY_RUN([
# include <sys/types.h>
# include <sys/stat.h>
@@ -23,16 +21,31 @@ AC_DEFUN(jm_FUNC_STAT,
main ()
{
struct stat sbuf;
exit (stat ("", &sbuf) == 0 ? 1 : 0);
exit (stat ("", &sbuf) ? 1 : 0);
}
],
jm_cv_func_working_stat=yes,
jm_cv_func_working_stat=no,
jm_cv_func_stat_empty_string_bug=yes,
jm_cv_func_stat_empty_string_bug=no,
dnl When crosscompiling, assume stat is broken.
jm_cv_func_working_stat=no)
jm_cv_func_stat_empty_string_bug=yes)
])
if test $jm_cv_func_working_stat = no; then
if test $jm_cv_func_stat_empty_string_bug = yes; then
LIBOBJS="$LIBOBJS stat.o"
AC_DEFINE_UNQUOTED(stat, rpl_stat)
if test $jm_cv_func_stat_empty_string_bug = yes; then
if test x = y; then
# This code is deliberately never run via ./configure.
# FIXME: this is a hack to make autoheader put the corresponding
# HAVE_* undef for this symbol in config.h.in. This saves me the
# trouble of having to maintain the #undef in acconfig.h manually.
AC_CHECK_FUNCS(STAT_EMPTY_STRING_BUG)
fi
# Defining it this way (rather than via AC_DEFINE) short-circuits the
# autoheader check -- autoheader doesn't know it's already been taken
# care of by the hack above.
ac_kludge=HAVE_STAT_EMPTY_STRING_BUG
AC_DEFINE_UNQUOTED($ac_kludge)
fi
fi
])

View File

@@ -1,3 +1,84 @@
1998-11-14 Jim Meyering <meyering@ascend.com>
* Version 4.0.
* Makefile.maint (cvs-dist): Search for `$tag:' rather than just $tag
to avoid matching a prefix of another tag.
1998-11-10 Jim Meyering <meyering@ascend.com>
* configure.in (ALL_LINGUAS): Add greek (el).
1998-11-07 Jim Meyering <meyering@ascend.com>
* Version 4.0-b7.
Accommodate the Hurd (defining lstat to rpl_lstat via config.h didn't
work on Hurd systems because of an inline definition of lstat in a
system header file). This also makes it so that you may run `ls '' '
on systems that let l?stat operate on the empty string.
* src/remove.c [HAVE_LSTAT_EMPTY_STRING_BUG]: Define lstat to rpl_lstat
and declare the latter.
* lib/stat.c [stat]: Remove #undef.
(rpl_stat): Protoize.
* lib/lstat.c [lstat]: Remove #undef.
(rpl_lstat): Protoize. Use ENOENT, not EINVAL, to be consistent
with lib/stat.c.
* acconfig.h: Remove #undef's for lstat and stat.
1998-10-31 Jim Meyering <meyering@ascend.com>
* tests/rm/Makefile.am (TESTS): Add new test `empty-name',
but comment it out.
* tests/rm/empty-name: New file.
* acconfig.h (stat): New #undef.
This omission was uncovered when Mark Kettenis reported that
`rm -r ''' got a failed assertion on the Hurd. This change
doesn't fix *that* problem -- see above.
1998-10-25 Jim Meyering <meyering@ascend.com>
* Version 4.0-b6.
* README: Man pages will now be supported to the extent that
people send patches.
* tests/rm/unreadable: Two new tests.
* tests/rm/Makefile.am (TESTS): Add new test `unreadable'. But comment
it out since we're so close to release and since the test compares the
text of diagnostics that are likely to vary between systems.
(TEST_ENVIRONMENT): Add required framework.
* src/remove.c (remove_cwd_entries): Don't apply CLOSEDIR to a NULL
pointer. (provoke with `mkdir -m 0100 x; rm -rf x')
Upon CLOSEDIR failure, set `status' to RM_ERROR, not RM_OK.
(remove_dir): Return `status', rather than always RM_OK.
1998-10-18 Jim Meyering <meyering@ascend.com>
* Version 4.0-b5.
* lib/mktime.c: Update from libc with this additional change from Paul.
* lib/strftime.c: Likewise.
1998-10-17 Paul Eggert <eggert@twinsun.com>
Don't invoke localtime_r or gmtime_r unless it's the GNU C
library's localtime_r and gmtime_r; there are too many buggy
implementations of localtime_r and gmtime_r out there, and
it's not worth keeping track of all the different bugs.
* mktime.c (__EXTENSIONS__, HAVE_LOCALTIME_R): Remove.
(my_mktime_localtime_r): Renamed from localtime_r; all uses changed.
Base it on localtime unless _LIBC.
* strftime.c (__EXTENSIONS__): Remove.
(my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed.
(my_strftime_localtime_r): Renamed from localtime_r; all uses changed.
Base them on localtime/gmtime if not _LIBC.
1998-10-17 Jim Meyering <meyering@ascend.com>
* Version 4.0-b4.

View File

@@ -1,4 +1,11 @@
Changes in release 4.0:
[4.0-b7]
* rm -rf '' no longer gets a failed assertion on the Hurd
[4.0-b6]
* rm simply fails as it should (rather than segfaulting) for
`mkdir -m 0100 x; rm -rf x'
[4.0-b5]
* still *more* mktime.c portability tweaks
[4.0-b4]
* mktime.c portability tweak for headers with GNU libc 5.4.44.
[4.0-b3]

View File

@@ -1,3 +1,15 @@
1998-10-31 Jim Meyering <meyering@ascend.com>
* tests/Makefile.am (EXTRA_DIST): Add Fetish.pm.
* tests/Fetish.pm: New file.
* tests/factor/Makefile.am: Rewrite to use new testing framework.
* tests/factor/Test.pm: Remove file.
* tests/factor/factor-tests: Remove file.
* tests/factor/basic: New file (rewrite of Test.pm).
* acconfig.h (stat): New #undef.
1998-10-03 Jim Meyering <meyering@ascend.com>
* man/Makefile.am: Switch to using help2man.

View File

@@ -1,7 +1,12 @@
1998-10-04 Jim Meyering <meyering@ascend.com>
1998-10-22 Jim Meyering <meyering@ascend.com>
* Version 1.22g.
* src/fold.c (usage): Add mention of --version and --help.
Reported by Matej Vela <mvela@public.srce.hr>.
1998-10-04 Jim Meyering <meyering@ascend.com>
* lib/fnmatch.h: New file. (unused)
* lib/fnmatch.c: New file. (unused)
* lib/Makefile.am (noinst_HEADERS): Add fnmatch.h.

View File

@@ -74,6 +74,8 @@ standard output.\n\
-b, --bytes count bytes rather than columns\n\
-s, --spaces break at spaces\n\
-w, --width=WIDTH use WIDTH columns instead of 80\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}

View File

@@ -51,6 +51,13 @@ typedef enum {false = 0, true = 1} bool;
# endif
#endif
/* On systems with an lstat function that accepts the empty string,
arrange to make lstat calls go through the wrapper function. */
#if HAVE_LSTAT_EMPTY_STRING_BUG
int rpl_lstat PARAMS((const char *, struct stat *));
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
#endif
#ifdef D_INO_IN_DIRENT
# define D_INO(dp) ((dp)->d_ino)
# define ENABLE_CYCLE_CHECK
@@ -575,12 +582,15 @@ remove_cwd_entries (const struct rm_options *x)
}
while (dirp == NULL);
if (CLOSEDIR (dirp))
if (dirp)
{
error (0, errno, "%s", full_filename ("."));
status = RM_OK;
if (CLOSEDIR (dirp))
{
error (0, errno, "%s", full_filename ("."));
status = RM_ERROR;
}
dirp = NULL;
}
dirp = NULL;
if (ht)
{
@@ -766,7 +776,7 @@ remove_dir (struct File_spec *fs, int need_save_cwd, const struct rm_options *x)
return RM_ERROR;
}
return RM_OK;
return status;
}
/* Remove the file or directory specified by FS after checking appropriate

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Makefile.in generated automatically by automake 1.3b from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -32,7 +32,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -202,7 +202,7 @@ check-TESTS: $(TESTS)
info:
dvi:
check: all
$(MAKE) check-TESTS
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
@@ -216,24 +216,21 @@ install: install-exec install-data all
uninstall:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-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)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean

View File

@@ -1,40 +1,11 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
AUTOMAKE_OPTIONS = 1.3b gnits
##test-files-begin
x = factor
explicit =
maint_gen = 1.X 1a.X 2.X 3.X 4.X a.X b.X c.X d.X e.X f.X g.X h.X i.X j.X k.X \
l.X m.X n.X o.X p.X q.X s.X t.X u.X v.X w.X x.X y.X z.X
run_gen = 1.O 1.E 1a.O 1a.E 2.O 2.E 3.O 3.E 4.O 4.E a.O a.E b.O b.E c.O c.E \
d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \
m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
x.O x.E y.O y.E z.O z.E
##test-files-end
EXTRA_DIST = 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
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -I. -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
check: $(maint_gen)
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -I. -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
TESTS = basic
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=factor

View File

@@ -1,9 +1,10 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Makefile.in generated automatically by automake 1.3b from Makefile.am
# 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.
# 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
@@ -31,7 +32,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -85,6 +86,7 @@ NEED_SETGID = @NEED_SETGID@
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
@@ -98,32 +100,19 @@ VERSION = @VERSION@
YACC = @YACC@
l = @l@
x = factor
explicit =
maint_gen = 1.X 1a.X 2.X 3.X 4.X a.X b.X c.X d.X e.X f.X g.X h.X i.X j.X k.X \
l.X m.X n.X o.X p.X q.X s.X t.X u.X v.X w.X x.X y.X z.X
run_gen = 1.O 1.E 1a.O 1a.E 2.O 2.E 3.O 3.E 4.O 4.E a.O a.E b.O b.E c.O c.E \
d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \
m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
x.O x.E y.O y.E z.O z.E
AUTOMAKE_OPTIONS = 1.3b gnits
EXTRA_DIST = 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
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
TESTS = basic
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=factor
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
SCRIPTS = $(noinst_SCRIPTS)
DIST_COMMON = Makefile.am Makefile.in
@@ -131,7 +120,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
all: Makefile $(SCRIPTS)
all: Makefile
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
@@ -189,7 +178,7 @@ check-TESTS: $(TESTS)
info:
dvi:
check: all
$(MAKE) check-TESTS
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
@@ -203,24 +192,19 @@ install: install-exec install-data all
uninstall:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-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)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean
@@ -237,21 +221,6 @@ install-data install uninstall all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -I. -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
check: $(maint_gen)
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -I. -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# 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.

View File

@@ -1,58 +0,0 @@
# -*-perl-*-
package Test;
require 5.002;
use strict;
sub test_vector
{
my @tvec =
(
# test-name options input expected-output expected-return-code
#
['1', '9', {}, '3 3', 0],
['1a', '7', {}, '7', 0],
['2', '4294967291', {}, '4294967291', 0],
['3', '4294967292', {}, '2 2 3 3 7 11 31 151 331', 0],
['4', '4294967293', {}, '9241 464773', 0],
['a', '4294966201', {}, '12197 352133', 0],
['b', '4294966339', {}, '13187 325697', 0],
['c', '4294966631', {}, '13729 312839', 0],
['d', '4294966457', {}, '14891 288427', 0],
['e', '4294966759', {}, '21649 198391', 0],
['f', '4294966573', {}, '23071 186163', 0],
['g', '4294967101', {}, '23603 181967', 0],
['h', '4294966519', {}, '34583 124193', 0],
['i', '4294966561', {}, '36067 119083', 0],
['j', '4294966901', {}, '37747 113783', 0],
['k', '4294966691', {}, '39241 109451', 0],
['l', '4294966969', {}, '44201 97169', 0],
['m', '4294967099', {}, '44483 96553', 0],
['n', '4294966271', {}, '44617 96263', 0],
['o', '4294966789', {}, '50411 85199', 0],
['p', '4294966189', {}, '53197 80737', 0],
['q', '4294967213', {}, '57139 75167', 0],
['s', '4294967071', {}, '65521 65551', 0],
['t', '4294966194', {}, '2 3 3 3 3 3 3 3 53 97 191', 0],
['u', '4294966272', {}, '2 2 2 2 2 2 2 2 2 2 3 23 89 683', 0],
['v', '4294966400', {}, '2 2 2 2 2 2 2 5 5 1342177', 0],
['w', '4294966464', {}, '2 2 2 2 2 2 3 3 3 2485513', 0],
['x', '4294966896', {}, '2 2 2 2 3 3 3 11 607 1489', 0],
['y', '4294966998', {}, '2 3 7 3917 26107', 0],
['z', '-1', {}, '', 1],
);
my @tv;
my $t;
foreach $t (@tvec)
{
my ($test_name, $arg, $in, $exp, $ret) = @$t;
# Append a newline to end of each expected string.
my $prefixed_result = ($ret == 0 ? "$arg: $exp\n" : $exp);
push (@tv, [$test_name, $arg, $in, $prefixed_result, $ret]);
}
return @tv;
}
1;

81
tests/factor/basic Executable file
View File

@@ -0,0 +1,81 @@
#!/bin/sh
: ${PERL=perl}
: ${srcdir=.}
case "$PERL" in
*'missing perl')
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
exit 77
;;
esac
exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF
require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
my @Tests =
(
['1', '9', {OUT => '3 3'}],
['1a', '7', {OUT => '7'}],
['2', '4294967291', {OUT => '4294967291'}],
['3', '4294967292', {OUT => '2 2 3 3 7 11 31 151 331'}],
['4', '4294967293', {OUT => '9241 464773'}],
['a', '4294966201', {OUT => '12197 352133'}],
['b', '4294966339', {OUT => '13187 325697'}],
['c', '4294966631', {OUT => '13729 312839'}],
['d', '4294966457', {OUT => '14891 288427'}],
['e', '4294966759', {OUT => '21649 198391'}],
['f', '4294966573', {OUT => '23071 186163'}],
['g', '4294967101', {OUT => '23603 181967'}],
['h', '4294966519', {OUT => '34583 124193'}],
['i', '4294966561', {OUT => '36067 119083'}],
['j', '4294966901', {OUT => '37747 113783'}],
['k', '4294966691', {OUT => '39241 109451'}],
['l', '4294966969', {OUT => '44201 97169'}],
['m', '4294967099', {OUT => '44483 96553'}],
['n', '4294966271', {OUT => '44617 96263'}],
['o', '4294966789', {OUT => '50411 85199'}],
['p', '4294966189', {OUT => '53197 80737'}],
['q', '4294967213', {OUT => '57139 75167'}],
['s', '4294967071', {OUT => '65521 65551'}],
['t', '4294966194', {OUT => '2 3 3 3 3 3 3 3 53 97 191'}],
['u', '4294966272', {OUT => '2 2 2 2 2 2 2 2 2 2 3 23 89 683'}],
['v', '4294966400', {OUT => '2 2 2 2 2 2 2 5 5 1342177'}],
['w', '4294966464', {OUT => '2 2 2 2 2 2 3 3 3 2485513'}],
['x', '4294966896', {OUT => '2 2 2 2 3 3 3 11 607 1489'}],
['y', '4294966998', {OUT => '2 3 7 3917 26107'}],
['z', '-1',
{ERR => "$prog: `-1' is not a valid positive integer\n"
. "Try `factor --help' for more information.\n"},
{EXIT => 1}],
);
# Prepend the command line argument and append a newline to end
# of each expected `OUT' string.
my $t;
foreach $t (@Tests)
{
my $arg1 = $t->[1];
my $e;
foreach $e (@$t)
{
$e->{OUT} = "$arg1: $e->{OUT}\n"
if ref $e eq 'HASH' and exists $e->{OUT};
}
}
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF

View File

@@ -1,537 +0,0 @@
#! /bin/sh
# This script was generated automatically by build-script.
case $# in
0) xx='../../src/factor';;
*) xx="$1";;
esac
test "$VERBOSE" && echo=echo || echo=:
$echo testing program: $xx
errors=0
test "$srcdir" || srcdir=.
test "$VERBOSE" && $xx --version 2> /dev/null
# Make sure we get English translations.
LANGUAGE=C
export LANGUAGE
LC_ALL=C
export LC_ALL
LANG=C
export LANG
$xx 9 > 1.O 2> 1.E
code=$?
if test $code != 0 ; then
$echo "Test 1 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp 1.O $srcdir/1.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed 1"; fi ;;
1) $echo "Test 1 failed: files 1.O and $srcdir/1.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test 1 may have failed." 1>&2;
$echo The command "cmp 1.O $srcdir/1.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s 1.E || rm -f 1.E
$xx 7 > 1a.O 2> 1a.E
code=$?
if test $code != 0 ; then
$echo "Test 1a failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp 1a.O $srcdir/1a.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed 1a"; fi ;;
1) $echo "Test 1a failed: files 1a.O and $srcdir/1a.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test 1a may have failed." 1>&2;
$echo The command "cmp 1a.O $srcdir/1a.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s 1a.E || rm -f 1a.E
$xx 4294967291 > 2.O 2> 2.E
code=$?
if test $code != 0 ; then
$echo "Test 2 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp 2.O $srcdir/2.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed 2"; fi ;;
1) $echo "Test 2 failed: files 2.O and $srcdir/2.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test 2 may have failed." 1>&2;
$echo The command "cmp 2.O $srcdir/2.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s 2.E || rm -f 2.E
$xx 4294967292 > 3.O 2> 3.E
code=$?
if test $code != 0 ; then
$echo "Test 3 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp 3.O $srcdir/3.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed 3"; fi ;;
1) $echo "Test 3 failed: files 3.O and $srcdir/3.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test 3 may have failed." 1>&2;
$echo The command "cmp 3.O $srcdir/3.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s 3.E || rm -f 3.E
$xx 4294967293 > 4.O 2> 4.E
code=$?
if test $code != 0 ; then
$echo "Test 4 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp 4.O $srcdir/4.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed 4"; fi ;;
1) $echo "Test 4 failed: files 4.O and $srcdir/4.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test 4 may have failed." 1>&2;
$echo The command "cmp 4.O $srcdir/4.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s 4.E || rm -f 4.E
$xx 4294966201 > a.O 2> a.E
code=$?
if test $code != 0 ; then
$echo "Test a failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp a.O $srcdir/a.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed a"; fi ;;
1) $echo "Test a failed: files a.O and $srcdir/a.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test a may have failed." 1>&2;
$echo The command "cmp a.O $srcdir/a.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s a.E || rm -f a.E
$xx 4294966339 > b.O 2> b.E
code=$?
if test $code != 0 ; then
$echo "Test b failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp b.O $srcdir/b.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed b"; fi ;;
1) $echo "Test b failed: files b.O and $srcdir/b.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test b may have failed." 1>&2;
$echo The command "cmp b.O $srcdir/b.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s b.E || rm -f b.E
$xx 4294966631 > c.O 2> c.E
code=$?
if test $code != 0 ; then
$echo "Test c failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp c.O $srcdir/c.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed c"; fi ;;
1) $echo "Test c failed: files c.O and $srcdir/c.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test c may have failed." 1>&2;
$echo The command "cmp c.O $srcdir/c.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s c.E || rm -f c.E
$xx 4294966457 > d.O 2> d.E
code=$?
if test $code != 0 ; then
$echo "Test d failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp d.O $srcdir/d.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed d"; fi ;;
1) $echo "Test d failed: files d.O and $srcdir/d.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test d may have failed." 1>&2;
$echo The command "cmp d.O $srcdir/d.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s d.E || rm -f d.E
$xx 4294966759 > e.O 2> e.E
code=$?
if test $code != 0 ; then
$echo "Test e failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp e.O $srcdir/e.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed e"; fi ;;
1) $echo "Test e failed: files e.O and $srcdir/e.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test e may have failed." 1>&2;
$echo The command "cmp e.O $srcdir/e.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s e.E || rm -f e.E
$xx 4294966573 > f.O 2> f.E
code=$?
if test $code != 0 ; then
$echo "Test f failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp f.O $srcdir/f.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed f"; fi ;;
1) $echo "Test f failed: files f.O and $srcdir/f.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test f may have failed." 1>&2;
$echo The command "cmp f.O $srcdir/f.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s f.E || rm -f f.E
$xx 4294967101 > g.O 2> g.E
code=$?
if test $code != 0 ; then
$echo "Test g failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp g.O $srcdir/g.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed g"; fi ;;
1) $echo "Test g failed: files g.O and $srcdir/g.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test g may have failed." 1>&2;
$echo The command "cmp g.O $srcdir/g.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s g.E || rm -f g.E
$xx 4294966519 > h.O 2> h.E
code=$?
if test $code != 0 ; then
$echo "Test h failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp h.O $srcdir/h.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed h"; fi ;;
1) $echo "Test h failed: files h.O and $srcdir/h.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test h may have failed." 1>&2;
$echo The command "cmp h.O $srcdir/h.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s h.E || rm -f h.E
$xx 4294966561 > i.O 2> i.E
code=$?
if test $code != 0 ; then
$echo "Test i failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp i.O $srcdir/i.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed i"; fi ;;
1) $echo "Test i failed: files i.O and $srcdir/i.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test i may have failed." 1>&2;
$echo The command "cmp i.O $srcdir/i.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s i.E || rm -f i.E
$xx 4294966901 > j.O 2> j.E
code=$?
if test $code != 0 ; then
$echo "Test j failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp j.O $srcdir/j.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed j"; fi ;;
1) $echo "Test j failed: files j.O and $srcdir/j.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test j may have failed." 1>&2;
$echo The command "cmp j.O $srcdir/j.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s j.E || rm -f j.E
$xx 4294966691 > k.O 2> k.E
code=$?
if test $code != 0 ; then
$echo "Test k failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp k.O $srcdir/k.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed k"; fi ;;
1) $echo "Test k failed: files k.O and $srcdir/k.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test k may have failed." 1>&2;
$echo The command "cmp k.O $srcdir/k.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s k.E || rm -f k.E
$xx 4294966969 > l.O 2> l.E
code=$?
if test $code != 0 ; then
$echo "Test l failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp l.O $srcdir/l.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed l"; fi ;;
1) $echo "Test l failed: files l.O and $srcdir/l.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test l may have failed." 1>&2;
$echo The command "cmp l.O $srcdir/l.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s l.E || rm -f l.E
$xx 4294967099 > m.O 2> m.E
code=$?
if test $code != 0 ; then
$echo "Test m failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp m.O $srcdir/m.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed m"; fi ;;
1) $echo "Test m failed: files m.O and $srcdir/m.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test m may have failed." 1>&2;
$echo The command "cmp m.O $srcdir/m.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s m.E || rm -f m.E
$xx 4294966271 > n.O 2> n.E
code=$?
if test $code != 0 ; then
$echo "Test n failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp n.O $srcdir/n.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed n"; fi ;;
1) $echo "Test n failed: files n.O and $srcdir/n.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test n may have failed." 1>&2;
$echo The command "cmp n.O $srcdir/n.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s n.E || rm -f n.E
$xx 4294966789 > o.O 2> o.E
code=$?
if test $code != 0 ; then
$echo "Test o failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp o.O $srcdir/o.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed o"; fi ;;
1) $echo "Test o failed: files o.O and $srcdir/o.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test o may have failed." 1>&2;
$echo The command "cmp o.O $srcdir/o.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s o.E || rm -f o.E
$xx 4294966189 > p.O 2> p.E
code=$?
if test $code != 0 ; then
$echo "Test p failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp p.O $srcdir/p.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed p"; fi ;;
1) $echo "Test p failed: files p.O and $srcdir/p.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test p may have failed." 1>&2;
$echo The command "cmp p.O $srcdir/p.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s p.E || rm -f p.E
$xx 4294967213 > q.O 2> q.E
code=$?
if test $code != 0 ; then
$echo "Test q failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp q.O $srcdir/q.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed q"; fi ;;
1) $echo "Test q failed: files q.O and $srcdir/q.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test q may have failed." 1>&2;
$echo The command "cmp q.O $srcdir/q.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s q.E || rm -f q.E
$xx 4294967071 > s.O 2> s.E
code=$?
if test $code != 0 ; then
$echo "Test s failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp s.O $srcdir/s.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed s"; fi ;;
1) $echo "Test s failed: files s.O and $srcdir/s.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test s may have failed." 1>&2;
$echo The command "cmp s.O $srcdir/s.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s s.E || rm -f s.E
$xx 4294966194 > t.O 2> t.E
code=$?
if test $code != 0 ; then
$echo "Test t failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp t.O $srcdir/t.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed t"; fi ;;
1) $echo "Test t failed: files t.O and $srcdir/t.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test t may have failed." 1>&2;
$echo The command "cmp t.O $srcdir/t.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t.E || rm -f t.E
$xx 4294966272 > u.O 2> u.E
code=$?
if test $code != 0 ; then
$echo "Test u failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp u.O $srcdir/u.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed u"; fi ;;
1) $echo "Test u failed: files u.O and $srcdir/u.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test u may have failed." 1>&2;
$echo The command "cmp u.O $srcdir/u.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s u.E || rm -f u.E
$xx 4294966400 > v.O 2> v.E
code=$?
if test $code != 0 ; then
$echo "Test v failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp v.O $srcdir/v.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed v"; fi ;;
1) $echo "Test v failed: files v.O and $srcdir/v.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test v may have failed." 1>&2;
$echo The command "cmp v.O $srcdir/v.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s v.E || rm -f v.E
$xx 4294966464 > w.O 2> w.E
code=$?
if test $code != 0 ; then
$echo "Test w failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp w.O $srcdir/w.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed w"; fi ;;
1) $echo "Test w failed: files w.O and $srcdir/w.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test w may have failed." 1>&2;
$echo The command "cmp w.O $srcdir/w.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s w.E || rm -f w.E
$xx 4294966896 > x.O 2> x.E
code=$?
if test $code != 0 ; then
$echo "Test x failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp x.O $srcdir/x.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed x"; fi ;;
1) $echo "Test x failed: files x.O and $srcdir/x.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test x may have failed." 1>&2;
$echo The command "cmp x.O $srcdir/x.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s x.E || rm -f x.E
$xx 4294966998 > y.O 2> y.E
code=$?
if test $code != 0 ; then
$echo "Test y failed: ../../src/factor return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp y.O $srcdir/y.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed y"; fi ;;
1) $echo "Test y failed: files y.O and $srcdir/y.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test y may have failed." 1>&2;
$echo The command "cmp y.O $srcdir/y.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s y.E || rm -f y.E
$xx -1 > z.O 2> z.E
code=$?
if test $code != 1 ; then
$echo "Test z failed: ../../src/factor return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp z.O $srcdir/z.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed z"; fi ;;
1) $echo "Test z failed: files z.O and $srcdir/z.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test z may have failed." 1>&2;
$echo The command "cmp z.O $srcdir/z.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s z.E || rm -f z.E
if test $errors = 0 ; then
$echo Passed all 30 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi
test $errors = 0 || errors=1
exit $errors

View File

@@ -1,6 +1,13 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = r-1 r-2 r-3 i-1 ir-1 f-1 sunos-1 deep-1
TESTS = r-1 r-2 r-3 i-1 ir-1 f-1 sunos-1 deep-1 # unreadable empty-name
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = RM=../../src/rm MKDIR=../../src/mkdir
TESTS_ENVIRONMENT = \
RM=../../src/rm \
MKDIR=../../src/mkdir \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=rm

View File

@@ -92,9 +92,16 @@ l = @l@
AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = r-1 r-2 r-3 i-1 ir-1 f-1 sunos-1 deep-1
TESTS = r-1 r-2 r-3 i-1 ir-1 f-1 sunos-1 deep-1 # unreadable empty-name
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = RM=../../src/rm MKDIR=../../src/mkdir
TESTS_ENVIRONMENT = \
RM=../../src/rm \
MKDIR=../../src/mkdir \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=rm
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =

41
tests/rm/empty-name Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
# Make sure that rm -r '' fails.
# On SunOS 4.1.3, running rm -r '' in a nonempty directory may
# actually remove files with names of entries in the current directory
# but relative to `/' rather than relative to the current directory.
: ${PERL=perl}
: ${srcdir=.}
case "$PERL" in
*'missing perl')
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
exit 77
;;
esac
exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF
require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
my @Tests =
(
# test-name options input expected-output
#
['empty-name-1', "''", {EXIT => 1},
{ERR => "$prog: cannot remove `': No such file or directory\n"}],
);
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF

45
tests/rm/unreadable Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
: ${PERL=perl}
: ${srcdir=.}
case "$PERL" in
*'missing perl')
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
exit 77
;;
esac
exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF
require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $d = "dir-$$";
my $mkdir = {PRE => sub {mkdir $d,0100 or die "$d: $!\n"}};
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
my @Tests =
(
# test-name options input expected-output
#
['unreadable-1', '-rf', $d,
{EXIT => 1}, {ERR => "$prog: $d/.: Permission denied\n"}, $mkdir],
['unreadable-2', '-rf', $d,
{EXIT => 1},
{ERR => "$prog: $d/.: Permission denied\n" .
"$prog: cannot remove directory `$d': File exists\n"},
{PRE => sub { (mkdir $d,0700 and mkdir "$d/x",0700 and chmod 0100,$d)
or die "$d: $!\n"}} ],
);
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF

View File

@@ -1,9 +1,10 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Makefile.in generated automatically by automake 1.3b from Makefile.am
# 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.
# 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
@@ -31,7 +32,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -172,7 +173,7 @@ check-TESTS: $(TESTS)
info:
dvi:
check: all
$(MAKE) check-TESTS
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
@@ -186,24 +187,19 @@ install: install-exec install-data all
uninstall:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-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)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Makefile.in generated automatically by automake 1.3b from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -32,7 +32,7 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -221,7 +221,7 @@ check-TESTS: $(TESTS)
info:
dvi:
check: all
$(MAKE) check-TESTS
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
@@ -235,24 +235,21 @@ install: install-exec install-data all
uninstall:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-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)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean