# Makefile for library files used by GNU fileutils.
-# Do not use this makefile directly, but only from `../Makefile'.
-# Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
+# Copyright (C) 1990, 1991, 1992, 1993 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
srcdir = @srcdir@
VPATH = @srcdir@
-SOURCES = argmatch.c backupfile.c basename.c dirname.c eaccess.c \
+CC = @CC@
+AR = ar
+RANLIB = @RANLIB@
+DEFS = @DEFS@
+CFLAGS = -g
+
+SOURCES = getdate.y posixtm.y \
+argmatch.c backupfile.c basename.c dirname.c eaccess.c \
error.c filemode.c fsusage.c getopt.c getopt1.c \
getversion.c idcache.c isdir.c makepath.c \
modechange.c mountlist.c savedir.c \
stripslash.c xgetcwd.c xmalloc.c xstrdup.c userspec.c yesno.c \
-getdate.y posixtm.y \
fileblocks.c fnmatch.c ftruncate.c mkdir.c mktime.c rename.c stpcpy.c \
strdup.c strstr.c alloca.c
-OBJECTS = argmatch.o backupfile.o basename.o dirname.o eaccess.o \
+OBJECTS = getdate.o posixtm.o \
+argmatch.o backupfile.o basename.o dirname.o eaccess.o \
error.o filemode.o getopt.o getopt1.o \
getversion.o idcache.o isdir.o makepath.o \
modechange.o savedir.o \
stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
-getdate.o posixtm.o @LIBOBJS@ @ALLOCA@
+@LIBOBJS@ @ALLOCA@
DISTFILES = Makefile.in backupfile.h getopt.h modechange.h \
fnmatch.h fsusage.h mountlist.h pathmax.h system.h $(SOURCES)
all: libfu.a
.c.o:
- $(CC) -c $(DEFS) -I$(srcdir) $(CPPFLAGS) $(CFLAGS) $<
+ $(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) $(CFLAGS) $<
install: all
TAGS: $(SOURCES)
etags $(SOURCES)
+check:
+
clean:
rm -f *.a *.o
+Wed Aug 4 17:43:18 1993 Jim Meyering (meyering@comco.com)
+
+ * ls.c (get_link_name): Don't ever use the stat field st_size as a
+ buffer size. Too many systems don't set it properly for mount points.
+ Instead, use a fixed-length buffer. From Michael Joosten
+ <joost@ori.CAdlab.DE>.
+
+Mon Jul 19 17:39:01 1993 Jim Meyering (meyering@comco.com)
+
+ * backupfile.c (concat): Temporary STR1_LENGTH should have type `int'
+ instead of `char.'
+
+Fri Jul 16 22:00:16 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
+
+ * dd.c (print_stats): Change message from "truncated blocks"
+ to "truncated records" for final POSIX.2 spec.
+
+Fri Jun 25 17:18:15 1993 Jim Meyering (meyering@comco.com)
+
+ * mkdir.c, rmdir.c: Change --path long option to --parents to avoid
+ confusion with search-path semantics of --path as an option to other
+ programs. --path will still work, but is no longer documented.
+
+Tue Jun 8 00:46:26 1993 Jim Meyering (meyering@comco.com)
+
+ * dd.c (parse_integer): Also accept `c' multiplier for consistency
+ with find's -size option.
+
Thu May 27 00:03:51 1993 Jim Meyering (meyering@comco.com)
* Version 3.8.
the executable built from ls.o should act like ls, dir, or vdir.
* ls.c (decode_switches): Use the variable instead of #ifdefs.
This is modelled after the approach used in GNU binutils 2.x for
- ar and ranlib. Here we avoid two rudundant compilations.
+ ar and ranlib. Here we avoid two redundant compilations.
* install.c (change_attributes, copy_file, install_file_in_file):
Don't call chown if we can efficiently determine that doing so is
static char *groupname;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
{"verbose", no_argument, 0, 'v'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind >= argc - 1)
static int changes_only;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
{"verbose", no_argument, 0, 'v'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (modeind == 0)
static char *groupname;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
{"verbose", no_argument, 0, 'v'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind >= argc - 1)
static uid_t myeuid;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_opts[] =
{
{"update", no_argument, &flag_update, 1},
{"verbose", no_argument, &flag_verbose, 1},
{"version-control", required_argument, NULL, 'V'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
\f
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage (NULL);
if (flag_hard_link && flag_symbolic_link)
/* Options:
Numbers can be followed by a multiplier:
- b=512, k=1024, w=2, xm=number m
+ b=512, c=1, k=1024, w=2, xm=number m
if=FILE Read from FILE instead of stdin.
of=FILE Write to FILE instead of stdout; don't
};
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
/* Decode arguments. */
scanargs (argc, argv);
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
apply_translations ();
case 'b':
n *= 512;
goto loop;
+ case 'c':
+ goto loop;
case 'k':
n *= 1024;
goto loop;
fprintf (stderr, "%u+%u records in\n", r_full, r_partial);
fprintf (stderr, "%u+%u records out\n", w_full, w_partial);
if (r_truncate > 0)
- fprintf (stderr, "%u truncated block%s\n", r_truncate,
+ fprintf (stderr, "%u truncated record%s\n", r_truncate,
r_truncate == 1 ? "" : "s");
}
[conv={ascii,ebcdic,ibm,block,unblock,lcase,ucase,swab,noerror,notrunc,\n\
sync}] [--help] [--version]\n\
Numbers can be followed by a multiplier:\n\
-b=512, k=1024, w=2, xm=number m\n",
+b=512, c=1, k=1024, w=2, xm=number m\n",
program_name);
exit (1);
}
static struct mount_entry *mount_list;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"portability", no_argument, &posix_format, 1},
{"type", required_argument, 0, 't'},
{"exclude-type", required_argument, 0, 'x'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind != argc)
static int exit_status;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"separate-dirs", no_argument, &opt_separate_dirs, 1},
{"summarize", no_argument, &opt_summarize_only, 1},
{"total", no_argument, &opt_combined_arguments, 1},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage (NULL);
if (opt_all && opt_summarize_only)
static int dir_arg;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"group", required_argument, NULL, 'g'},
{"mode", required_argument, NULL, 'm'},
{"owner", required_argument, NULL, 'o'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
/* Check for invalid combinations of arguments. */
static int hard_dir_link;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"symbolic", no_argument, &symbolic_link, 1},
{"verbose", no_argument, &verbose, 1},
{"version-control", required_argument, NULL, 'V'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind == argc)
static int exit_status;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"sort", required_argument, 0, 10},
{"tabsize", required_argument, 0, 'T'},
{"time", required_argument, 0, 11},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
program_name = argv[0];
i = decode_switches (argc, argv);
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
format_needs_stat = sort_type == sort_time || sort_type == sort_size
char *filename;
struct file *f;
{
- register char *linkbuf;
-#ifdef _AIX
- register int bufsiz = PATH_MAX; /* st_size is wrong. */
-#else
- register int bufsiz = f->stat.st_size;
-#endif
+ char linkbuf[PATH_MAX + 1];
register int linksize;
- linkbuf = (char *) xmalloc (bufsiz + 1);
/* Some automounters give incorrect st_size for mount points.
I can't think of a good workaround for it, though. */
- linksize = readlink (filename, linkbuf, bufsiz);
+ linksize = readlink (filename, linkbuf, sizeof (linkbuf));
if (linksize < 0)
{
error (0, errno, "%s", filename);
exit_status = 1;
- free (linkbuf);
}
else
{
-#ifdef _AIX
- linkbuf = (char *) xrealloc (linkbuf, linksize + 1);
-#endif
linkbuf[linksize] = '\0';
- f->linkname = linkbuf;
+ f->linkname = xstrdup (linkbuf);
}
}
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Options:
- -p, --path Ensure that the given path(s) exist:
+ -p, --parent Ensure that the given path(s) exist:
Make any missing parent directories for each argument.
Parent dirs default to umask modified by `u+wx'.
Do not consider an argument directory that already
/* The name this program was run with. */
char *program_name;
-/* If nonzero, ensure that a path exists. */
+/* If nonzero, ensure that all parents of the specified directory exist. */
static int path_mode;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
{"path", no_argument, &path_mode, 1},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"parents", no_argument, &path_mode, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind == argc)
usage ()
{
fprintf (stderr, "\
-Usage: %s [-p] [-m mode] [--path] [--mode=mode] [--help] [--version] dir...\n",
- program_name);
+Usage: %s [-p] [-m mode] [--parents] [--mode=mode]\n\
+ [--help] [--version] dir...\n", program_name);
exit (1);
}
char *program_name;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind == argc)
char *program_name;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
newmode = 0666 & ~umask (0);
static uid_t myeuid;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_options[] =
{
{"update", no_argument, &update, 1},
{"verbose", no_argument, &verbose, 1},
{"version-control", required_argument, NULL, 'V'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (argc < optind + 2)
static int stdin_tty;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const long_opts[] =
{
{"interactive", no_argument, NULL, 'i'},
{"recursive", no_argument, &recursive, 1},
{"verbose", no_argument, &verbose, 1},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind == argc)
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Options:
- -p, --path Remove any parent dirs that are explicitly mentioned
+ -p, --parent Remove any parent dirs that are explicitly mentioned
in an argument, if they become empty after the
argument file is removed.
static int empty_paths;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const longopts[] =
{
{"path", no_argument, &empty_paths, 1},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"parents", no_argument, &empty_paths, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (optind == argc)
static void
usage ()
{
- fprintf (stderr, "Usage: %s [-p] [--path] [--help] [--version] dir...\n",
+ fprintf (stderr, "Usage: %s [-p] [--parents] [--help] [--version] dir...\n",
program_name);
exit (1);
}
static struct stat ref_stats;
/* If non-zero, display usage information and exit. */
-static int flag_help;
+static int show_help;
/* If non-zero, print the version on standard error. */
-static int flag_version;
+static int show_version;
static struct option const longopts[] =
{
{"no-create", no_argument, 0, 'c'},
{"date", required_argument, 0, 'd'},
{"file", required_argument, 0, 'r'},
- {"help", no_argument, &flag_help, 1},
- {"version", no_argument, &flag_version, 1},
+ {"help", no_argument, &show_help, 1},
+ {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
}
}
- if (flag_version)
+ if (show_version)
{
fprintf (stderr, "%s\n", version_string);
exit (0);
}
- if (flag_help)
+ if (show_help)
usage ();
if (change_times == 0)