aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--name.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/name.c b/name.c
index 57a467d..e74cd31 100644
--- a/name.c
+++ b/name.c
@@ -63,18 +63,18 @@ usage: fprintf(stderr, "usage: %s [-x]\n", name);
if(!(fp = fopen(file, "r")))
err(1, "fopen");
- /* Read original file names. */
- for(i = 0; i < MAXFILES && fgets(tmp, MAXLINE, fp); i++){
- tmp[strcspn(tmp, "\n")] = 0;
- strcpy(froms[i], tmp);
- }
-
/* Read new file names. */
for(j = 0; j < MAXFILES && fgets(tmp, MAXLINE, stdin); j++){
tmp[strcspn(tmp, "\n")] = 0;
strcpy(tos[j], tmp);
}
+ /* Read original file names. */
+ for(i = 0; i < MAXFILES && fgets(tmp, MAXLINE, fp); i++){
+ tmp[strcspn(tmp, "\n")] = 0;
+ strcpy(froms[i], tmp);
+ }
+
if(i != j){
fprintf(stderr, "%s: too %s lines\n",
name, j > i ? "many" : "few");