aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/unixize.11
-rw-r--r--src/c_opts.c15
-rw-r--r--src/c_opts.h2
-rw-r--r--src/c_unixize.c20
4 files changed, 22 insertions, 16 deletions
diff --git a/man/unixize.1 b/man/unixize.1
index 75057bb..29d65cd 100644
--- a/man/unixize.1
+++ b/man/unixize.1
@@ -119,5 +119,6 @@ relevant ascii character (or double characters).
.SH OPTIONS
.SH SEE ALSO
.IR ascii (1),
+.IR ls (1),
.IR rename (2)
.\" vim: set filetype=groff:
diff --git a/src/c_opts.c b/src/c_opts.c
index 6df0722..996643e 100644
--- a/src/c_opts.c
+++ b/src/c_opts.c
@@ -190,7 +190,7 @@ c_get_opts
C_C_OPT_FMT,
optarg
);
- exit(2);
+ exit(1);
}
else {
opts->cxx = optarg[0] - 48;
@@ -203,18 +203,23 @@ c_get_opts
}
if (
argv[0][0] != C_RECURSIVE_CHAR &&
+ argv[optind] == NULL
+ ) {
+ c_dump_usage();
+ exit(1);
+ }
+ if (
+ argv[0][0] != C_RECURSIVE_CHAR &&
optind < argc &&
argv[optind] != NULL
- ) {
+ ) {
strncpy(opts->dir, argv[optind], PATH_MAX);
if (opts->dir[strlen(opts->dir) - 1] == '/') {
opts->dir[strlen(opts->dir) - 1] = 0x00;
}
}
- else if (argv[0][0] == C_RECURSIVE_CHAR || argv[optind] == NULL) {
+ else if (argv[0][0] == C_RECURSIVE_CHAR) {
strlcpy(opts->dir, ".", 2 * sizeof(char));
- }
- if (argv[0][0] == C_RECURSIVE_CHAR) {
c_recursive_parse(opts, argv);
}
ret = TRUE;
diff --git a/src/c_opts.h b/src/c_opts.h
index 029fcaa..92788ed 100644
--- a/src/c_opts.h
+++ b/src/c_opts.h
@@ -51,7 +51,7 @@
#define C_OPTS "ahiknprRve:"
#define C_RECURSIVE_CHAR 'r'
#define C_USAGE_FMT \
- "usage: unixize [-ahiknprRv] [-e ext] [directory]\n"
+ "usage: unixize [-ahiknprRv] [-e ext] directory\n"
#define C_C_OPT_FMT \
"unixize: unsupported -e value '%s' (must be always 0, 1 or 2)\n"
diff --git a/src/c_unixize.c b/src/c_unixize.c
index b444ec3..84c4371 100644
--- a/src/c_unixize.c
+++ b/src/c_unixize.c
@@ -152,16 +152,16 @@ main
);
}
if (opts.pretend == FALSE) {
- if (rename(og_files->filename, new_files->filename) == -1) {
- dprintf(
- STDERR_FILENO,
- "unixize: rename %s to %s: %s\n",
- og_files->filename,
- new_files->filename,
- strerror(errno)
- );
- ret = 2;
- }
+ /* if (rename(og_files->filename, new_files->filename) == -1) { */
+ /* dprintf( */
+ /* STDERR_FILENO, */
+ /* "unixize: rename %s to %s: %s\n", */
+ /* og_files->filename, */
+ /* new_files->filename, */
+ /* strerror(errno) */
+ /* ); */
+ /* ret = 2; */
+ /* } */
}
}
else if (opts.rverbose == TRUE) {