Lines Matching defs:files
1 /* diff.c - compare files line by line
8 USE_DIFF(NEWTOY(diff, "<2>2B(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))
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
242 * 1. calc hashes for both the files and store them in vector(v[0], v[1])
366 static int *diff(char **files)
376 if (IS_STDIN(files[i])) file[i].fp = read_stdin();
377 else file[i].fp = fopen(files[i], "r");
380 perror_msg("%s",files[i]);
512 static void do_diff(char **files)
522 J = diff(files);
568 xprintf("--- %s\n", (toys.optflags & FLAG_L) ? llist->arg : files[0]);
570 xprintf("+++ %s\n", files[1]);
637 static void show_status(char **files)
642 printf("Files %s and %s are identical\n",files[0], files[1]);
646 printf("Files %s and %s differ\n",files[0], files[1]);
727 create_empty_entry(l, r, j); //create non empty dirs/files if -N.
770 char *files[2];
773 files[j] = toys.optargs[j];
774 if (IS_STDIN(files[j])) {
776 perror_exit("can fstat %s", files[j]);
778 if (stat(files[j], &st[j]) == -1)
779 perror_exit("can't stat %s", files[j]);
783 if (IS_STDIN(files[0]) && IS_STDIN(files[1])) { //compat :(
784 show_status(files); //check ASAP
788 if ((IS_STDIN(files[0]) || IS_STDIN(files[1]))
794 show_status(files);
801 dirtree_handle_callback(dirtree_start(files[j], 1), list_dir);
825 char *slash = strrchr(files[d], '/');
827 files[1 - d] = concat_file_path(files[1 - d], slash ? slash + 1 : files[d]);
828 if ((stat(files[1 - d], &st[1 - d])) == -1)
829 perror_exit("%s", files[1 - d]);
831 do_diff(files);
832 show_status(files);