1 /* vi: set sw=4 ts=4: */
3 * Mini cmp implementation for busybox
5 * Copyright (C) 2000,2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 int cmp_main(int argc, char **argv)
32 FILE *fp1 = NULL, *fp2 = stdin;
33 char *filename1, *filename2 = "-";
34 int c, c1, c2, char_pos = 1, line_pos = 1, silent = FALSE;
36 while ((c = getopt(argc, argv, "s")) != EOF) {
46 filename1 = argv[optind];
47 switch (argc - optind) {
49 fp2 = xfopen(filename2 = argv[optind + 1], "r");
51 fp1 = xfopen(filename1, "r");
64 printf("EOF on %s\n", filename1);
66 printf("EOF on %s\n", filename2);
68 printf("%s %s differ: char %d, line %d\n", filename1, filename2,