52
if (rename(s, newname) != 0) {
54
fprintf(stderr, _("%s: renaming %s to %s failed: %s\n"),
55
progname, s, newname, strerror(errsv));
52
if (rename(s, newname) != 0)
53
err(EXIT_FAILURE, _("renaming %s to %s failed"),
56
printf("`%s' -> `%s'\n", s, newname);
63
main(int argc, char **argv) {
68
if ((p = strrchr(progname, '/')) != NULL)
62
static void __attribute__ ((__noreturn__)) usage(FILE * out)
64
fputs(_("\nUsage:\n"), out);
66
_(" %s [options] expression replacement file...\n"),
67
program_invocation_short_name);
69
fputs(_("\nOptions:\n"), out);
70
fputs(_(" -v, --verbose explain what is being done\n"
71
" -V, --version output version information and exit\n"
72
" -h, --help display this help and exit\n\n"), out);
74
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
77
int main(int argc, char **argv)
80
int i, c, verbose = 0;
82
static const struct option longopts[] = {
83
{"verbose", no_argument, NULL, 'v'},
84
{"version", no_argument, NULL, 'V'},
85
{"help", no_argument, NULL, 'h'},
71
89
setlocale(LC_ALL, "");
72
90
bindtextdomain(PACKAGE, LOCALEDIR);
73
91
textdomain(PACKAGE);
76
if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) {
77
printf(_("%s (%s)\n"),
78
progname, PACKAGE_STRING);
93
while ((c = getopt_long(argc, argv, "vVh", longopts, NULL)) != -1)
99
printf(_("%s from %s\n"),
100
program_invocation_short_name,
84
fprintf(stderr, _("call: %s from to files...\n"), progname);
113
warnx("not enough arguments");
91
for (i=3; i<argc; i++)
92
do_rename(from, to, argv[i]);
120
for (i = 2; i < argc; i++)
121
do_rename(from, to, argv[i], verbose);