diff options
Diffstat (limited to 'name.c')
-rw-r--r-- | name.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -19,8 +19,7 @@ void waitstdin(void); int main(int argc, char *argv[]) { - char file[30], *name, from[MAXLINE], *froms[MAXFILES], - *tmp, to[MAXLINE], *tos[MAXFILES]; + char file[30], *name, *froms[MAXFILES], *tmp, *tos[MAXFILES]; FILE *fp; int c, i, j, s, xflag; @@ -65,15 +64,15 @@ usage: fprintf(stderr, "usage: %s [-x]\n", name); err(1, "fopen"); /* Read original file names. */ - for (i = 0; fgets(from, MAXLINE, fp); i++) { - from[strcspn(from, "\n")] = 0; - strcpy(froms[i], from); + for (i = 0; fgets(tmp, MAXLINE, fp); i++) { + tmp[strcspn(tmp, "\n")] = 0; + strcpy(froms[i], tmp); } /* Read new file names. */ - for (j = 0; fgets(to, MAXLINE, stdin); j++) { - to[strcspn(to, "\n")] = 0; - strcpy(tos[j], to); + for (j = 0; fgets(tmp, MAXLINE, stdin); j++) { + tmp[strcspn(tmp, "\n")] = 0; + strcpy(tos[j], tmp); } if (i != j) { |