aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-10 18:12:48 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-10 18:12:48 +0200
commitf731d36d9229a57844551ebcfe78c91a1e9a37ec (patch)
treec51f26524aed2fb72a3d28c2caf5558ed6a09bb2
parentba5414545ed0cbce19bd305c5c21c4d159ef852f (diff)
downloadre-name-f731d36d9229a57844551ebcfe78c91a1e9a37ec.tar.gz
name.c: Remove superfluous strings from, to
-rw-r--r--name.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/name.c b/name.c
index 26f6c8c..e9c13d7 100644
--- a/name.c
+++ b/name.c
@@ -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) {