diff options
-rw-r--r-- | name.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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"); |