diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-23 23:47:53 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-23 23:47:53 +0200 |
commit | 871fe1b311145129f42dc1a4b97f70e9f6d2dbf9 (patch) | |
tree | cf44f524f8d5100484a693b014b1c8353510c098 | |
parent | 059f5b13acf3774b279125b3b568b55e13680ac6 (diff) | |
download | re-name-master.tar.gz |
-rw-r--r-- | name.c | 12 | ||||
-rw-r--r-- | re.c | 1 |
2 files changed, 3 insertions, 10 deletions
@@ -6,9 +6,9 @@ #include <sys/select.h> #include <sys/wait.h> -#define MAXFILES 100 /* Maximum number of files. */ -#define MAXFILE 255 /* Maximum file name length. */ -#define MAXLINE MAXFILE+1 /* MAXFILE plus newline. */ +#define MAXFILES 100 +#define MAXFILE 255 +#define MAXLINE MAXFILE+1 extern char *optarg; extern int optind; @@ -23,7 +23,6 @@ main(int argc, char *argv[]) FILE *fp; int c, i, j, s, xflag; - /* Allocate memory. */ for(i = 0; i < MAXFILES; i++) if(!(froms[i] = malloc(MAXFILE)) || !(tos[i] = malloc(MAXFILE))) err(1, "malloc"); @@ -42,7 +41,6 @@ main(int argc, char *argv[]) return 1; } - /* Read command-line options. */ name = argv[0]; xflag = 0; while((c = getopt(argc, argv, "x")) != -1) @@ -81,10 +79,6 @@ usage: fprintf(stderr, "usage: %s [-x]\n", name); return 1; } - /* - * The corresponding mv invocations are printed on standard out. - * If the -x flag is given, they are executed too. - */ for(i = 0; i < j; i++){ escape(froms[i], &tmp); printf("mv -- '%s'", tmp); escape(tos[i], &tmp); printf(" '%s'\n", tmp); @@ -14,7 +14,6 @@ main(int argc, char *argv[]) return 1; } - /* Ensure arguments do not contain newlines. */ for(i = 1; i < argc; i++) for(a = argv[i]; *a; a++) if(*a == '\n'){ |