#include <grp.h>
#include <getopt.h>
#include "system.h"
+#include "version.h"
#if !defined (isascii) || defined (STDC_HEADERS)
+#undef isascii
#define isascii(c) 1
#endif
/* The name of the group to which ownership of the files is being given. */
static char *groupname;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"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},
{0, 0, 0, 0}
};
if (optind >= argc - 1)
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
parse_group (argv[optind++], &group);
for (; optind < argc; ++optind)
#include <sys/types.h>
#include "modechange.h"
#include "system.h"
+#include "version.h"
int lstat ();
/* If nonzero, describe only modes that change. */
static int changes_only;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"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},
{0, 0, 0, 0}
};
if (optind >= argc)
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
changes = mode_compile (argv[modeind],
MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS);
if (changes == MODE_INVALID)
#include <grp.h>
#include <getopt.h>
#include "system.h"
+#include "version.h"
#ifndef _POSIX_VERSION
struct passwd *getpwnam ();
/* The name of the group to which ownership of the files is being given. */
static char *groupname;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"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},
{0, 0, 0, 0}
};
if (optind >= argc - 1)
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
e = parse_user_spec (argv[optind], &user, &group, &username, &groupname);
if (e)
error (1, 0, "%s: %s", argv[optind], e);
#include <getopt.h>
#include "cp.h"
#include "backupfile.h"
+#include "version.h"
#ifndef _POSIX_VERSION
uid_t geteuid ();
/* Initial number of entries in the inode hash table. */
#define INITIAL_ENTRY_TAB_SIZE 70
+/* The invocation name of this program. */
+char *program_name;
+
/* A pointer to either lstat or stat, depending on
whether dereferencing of symlinks is done. */
static int (*xstat) ();
-/* The invocation name of this program. */
-char *program_name;
-
/* If nonzero, copy all files except directories and, if not dereferencing
them, symbolic links, as if they were regular files. */
static int flag_copy_as_regular = 1;
/* This process's effective user ID. */
static uid_t myeuid;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_opts[] =
{
{"archive", no_argument, NULL, 'a'},
{"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},
{NULL, 0, NULL, 0}
};
\f
if (flag_hard_link && flag_symbolic_link)
usage ("cannot make both hard and symbolic links");
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage (NULL);
+
if (make_backups)
backup_type = get_version (version);
#include <ctype.h>
#if !defined (isascii) || defined (STDC_HEADERS)
+#undef isascii
#define isascii(c) 1
#endif
070, 071, 0372, 0373, 0374, 0375, 0376, 0377
};
+/* If non-zero, display usage information and exit. */
static int flag_help;
+
+/* If non-zero, print the version on standard error. */
static int flag_version;
static struct option const long_options[] =
scanargs (argc, argv);
if (flag_version)
- fprintf (stderr, "%s", version_string);
+ fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ("", NULL, NULL);
#include "mountlist.h"
#include "fsusage.h"
#include "system.h"
+#include "version.h"
char *strstr ();
char *xmalloc ();
static void show_point ();
static void usage ();
+/* Name this program was run with. */
+char *program_name;
+
/* If nonzero, show inode information. */
static int inode_format;
/* Nonzero if errors have occurred. */
static int exit_status;
-/* Name this program was run with. */
-char *program_name;
-
/* A filesystem type to display. */
struct fs_type_list
/* Linked list of mounted filesystems. */
static struct mount_entry *mount_list;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"all", no_argument, &show_all_fs, 1},
{"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},
{NULL, 0, NULL, 0}
};
}
}
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (optind != argc)
{
/* Display explicitly requested empty filesystems. */
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
+#include "version.h"
int lstat ();
int stat ();
static int (*xstat) ();
/* The exit status to use if we don't get any fatal errors. */
-
static int exit_status;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"all", no_argument, &opt_all, 1},
{"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},
{NULL, 0, NULL, 0}
};
if (opt_all && opt_summarize_only)
usage ("cannot both summarize and show all entries");
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ("");
+
/* Initialize the hash structure for inode numbers. */
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
#include <pwd.h>
#include <grp.h>
#include "system.h"
+#include "version.h"
#include "modechange.h"
#if !defined (isascii) || defined (STDC_HEADERS)
+#undef isascii
#define isascii(c) 1
#endif
/* If nonzero, install a directory instead of a regular file. */
static int dir_arg;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"strip", no_argument, NULL, 's'},
{"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},
{NULL, 0, NULL, 0}
};
|| (optind == argc - 1 && !dir_arg))
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (symbolic_mode)
{
struct mode_change *change = mode_compile (symbolic_mode, 0);
#include <getopt.h>
#include "system.h"
#include "backupfile.h"
+#include "version.h"
int link (); /* Some systems don't declare this anywhere. */
static void usage ();
static int do_link ();
+/* The name by which the program was run, for error messages. */
+char *program_name;
+
/* A pointer to the function used to make links. This will point to either
`link' or `symlink'. */
static int (*linkfunc) ();
/* If nonzero, allow the superuser to make hard links to directories. */
static int hard_dir_link;
-/* The name by which the program was run, for error messages. */
-char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_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},
{NULL, 0, NULL, 0}
};
if (optind == argc)
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (make_backups)
backup_type = get_version (version);
#include <sys/types.h>
#include "system.h"
#include "modechange.h"
+#include "version.h"
int make_path ();
void error ();
static void usage ();
+/* The name this program was run with. */
+char *program_name;
+
/* If nonzero, ensure that a path exists. */
static int path_mode;
-/* The name this program was run with. */
-char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_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},
{NULL, 0, NULL, 0}
};
if (optind == argc)
usage ();
-
+
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
newmode = 0777 & ~umask (0);
parent_mode = newmode | 0300; /* u+wx */
if (symbolic_mode)
#include <sys/types.h>
#include "system.h"
#include "modechange.h"
+#include "version.h"
void error ();
/* The name this program was run with. */
char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
+ {"help", no_argument, &flag_help, 1},
+ {"version", no_argument, &flag_version, 1},
{NULL, 0, NULL, 0}
};
if (optind == argc)
usage ();
-
+
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
newmode = 0666 & ~umask (0);
if (symbolic_mode)
{
#include <sys/types.h>
#include "system.h"
#include "modechange.h"
+#include "version.h"
void error ();
/* The name this program was run with. */
char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
+ {"help", no_argument, &flag_help, 1},
+ {"version", no_argument, &flag_version, 1},
{NULL, 0, NULL, 0}
};
}
}
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
newmode = 0666 & ~umask (0);
if (symbolic_mode)
{
#include <sys/types.h>
#include "system.h"
#include "backupfile.h"
+#include "version.h"
#ifndef _POSIX_VERSION
uid_t geteuid ();
/* This process's effective user ID. */
static uid_t myeuid;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_options[] =
{
{"backup", no_argument, NULL, 'b'},
{"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},
{NULL, 0, NULL, 0}
};
if (argc < optind + 2)
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (make_backups)
backup_type = get_version (version);
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
+#include "version.h"
#ifdef _POSIX_SOURCE
/* POSIX.1 doesn't have inodes, so fake them to avoid lots of ifdefs. */
static int rm ();
static void usage ();
+/* Name this program was run with. */
+char *program_name;
+
/* Path of file now being processed; extended as necessary. */
static char *pathname;
made larger when necessary, but never smaller. */
static int pnsize;
-/* Name this program was run with. */
-char *program_name;
-
/* If nonzero, display the name of each file removed. */
static int verbose;
/* If nonzero, stdin is a tty. */
static int stdin_tty;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const long_opts[] =
{
{"directory", no_argument, &unlink_dirs, 1},
{"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},
{NULL, 0, NULL, 0}
};
}
}
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (optind == argc)
{
if (ignore_missing_files)
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
+#include "version.h"
void error ();
void strip_trailing_slashes ();
static void remove_parents ();
static void usage ();
+/* The name this program was run with. */
+char *program_name;
+
/* If nonzero, remove empty parent directories. */
static int empty_paths;
-/* The name this program was run with. */
-char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
static struct option const longopts[] =
{
{"path", no_argument, &empty_paths, 1},
+ {"help", no_argument, &flag_help, 1},
+ {"version", no_argument, &flag_version, 1},
{NULL, 0, NULL, 0}
};
if (optind == argc)
usage ();
-
+
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
for (; optind < argc; ++optind)
{
/* Stripping slashes is harmless for rmdir;
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
+#include "version.h"
#ifdef STDC_HEADERS
#include <time.h>
#define CH_ATIME 1
#define CH_MTIME 2
+/* The name by which this program was run. */
+char *program_name;
+
/* Which timestamps to change. */
static int change_times;
/* Info about the reference file. */
static struct stat ref_stats;
-/* The name by which this program was run. */
-char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_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},
{0, 0, 0, 0}
};
}
}
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (change_times == 0)
change_times = CH_ATIME | CH_MTIME;