Lines Matching defs:files

1 /* diff.c - compare files line by line
8 USE_DIFF(NEWTOY(diff, "<2>2(color)(strip-trailing-cr)B(ignore-blank-lines)d(minimal)b(ignore-space-change)ut(expand-tabs)w(ignore-all-space)i(ignore-case)T(initial-tab)s(report-identical-files)q(brief)a(text)L(label)*S(starting-file):N(new-file)r(recursive)U(unified)#<0=3", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_ARGFAIL(2)))
16 -a Treat all files as text
22 -N Treat absent files as empty
23 -q Output only whether files differ
27 -s Report when two files are the same
250 * 1. calc hashes for both the files and store them in vector(v[0], v[1])
374 static int *diff(char **files)
384 if (IS_STDIN(files[i])) file[i].fp = read_stdin();
385 else file[i].fp = fopen(files[i], "r");
388 perror_msg("%s",files[i]);
587 static void do_diff(char **files)
597 J = diff(files);
644 else show_label("---", files[0], &(TT).st[0]);
646 show_label("+++", files[1], &(TT).st[1]);
717 static void show_status(char **files)
722 printf("Files %s and %s are identical\n",files[0], files[1]);
726 printf("Files %s and %s differ\n",files[0], files[1]);
807 create_empty_entry(l, r, j); //create non empty dirs/files if -N.
849 char *files[2];
856 files[j] = toys.optargs[j];
857 if (IS_STDIN(files[j])) {
859 perror_exit("can't fstat %s", files[j]);
861 xstat(files[j], &TT.st[j]);
865 if ((IS_STDIN(files[0]) || IS_STDIN(files[1]))
872 return show_status(files);
878 dirtree_flagread(files[j], DIRTREE_SYMFOLLOW, list_dir);
902 char *slash = strrchr(files[d], '/');
904 files[1 - d] = concat_file_path(files[1 - d], slash ? slash + 1 : files[d]);
905 if ((stat(files[1 - d], &TT.st[1 - d])) == -1)
906 perror_exit("%s", files[1 - d]);
908 do_diff(files);
909 show_status(files);