Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/editors/diff.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/editors/diff.c
r3232 r3621 77 77 */ 78 78 79 //config:config DIFF 80 //config: bool "diff" 81 //config: default y 82 //config: help 83 //config: diff compares two files or directories and outputs the 84 //config: differences between them in a form that can be given to 85 //config: the patch command. 86 //config: 87 //config:config FEATURE_DIFF_LONG_OPTIONS 88 //config: bool "Enable long options" 89 //config: default y 90 //config: depends on DIFF && LONG_OPTS 91 //config: help 92 //config: Enable use of long options. 93 //config: 94 //config:config FEATURE_DIFF_DIR 95 //config: bool "Enable directory support" 96 //config: default y 97 //config: depends on DIFF 98 //config: help 99 //config: This option enables support for directory and subdirectory 100 //config: comparison. 101 102 //kbuild:lib-$(CONFIG_DIFF) += diff.o 103 104 //applet:IF_DIFF(APPLET(diff, BB_DIR_USR_BIN, BB_SUID_DROP)) 105 79 106 //usage:#define diff_trivial_usage 80 107 //usage: "[-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2" … … 99 126 100 127 #include "libbb.h" 128 #include "common_bufsiz.h" 101 129 102 130 #if 0 … … 337 365 338 366 struct line { 339 /* 'serial' is not used in the begin ing, so we reuse it367 /* 'serial' is not used in the beginning, so we reuse it 340 368 * to store line offsets, thus reducing memory pressure 341 369 */ … … 407 435 int c = fgetc(ft->ft_fp); 408 436 if (c == EOF) { 409 p rintf("\n\\ No newline at end of file\n");437 puts("\n\\ No newline at end of file"); 410 438 return; 411 439 } … … 632 660 633 661 for (j = 0; j < 2; j++) 634 for (k = v[j].a; k < v[j].b; k++)635 nonempty |= (ix[j][k +1] - ix[j][k] != 1);662 for (k = v[j].a; k <= v[j].b; k++) 663 nonempty |= (ix[j][k] - ix[j][k - 1] != 1); 636 664 637 665 vec = xrealloc_vector(vec, 6, ++idx); … … 666 694 printf(",%d", (a < b) ? b - a + 1 : 0); 667 695 } 668 p rintf(" @@\n");696 puts(" @@"); 669 697 /* 670 698 * Output changes in "unified" diff format--the old and new lines … … 714 742 if (bb_copyfd_eof(fd, fd_tmp) < 0) 715 743 xfunc_die(); 716 if (fd ) /* Prevents closing of stdin */744 if (fd != STDIN_FILENO) 717 745 close(fd); 718 746 fd = fd_tmp; 747 xlseek(fd, 0, SEEK_SET); 719 748 } 720 749 fp[i] = fdopen(fd, "r"); 721 750 } 722 751 752 setup_common_bufsiz(); 723 753 while (1) { 724 754 const size_t sz = COMMON_BUFSIZE / 2;
Note:
See TracChangeset
for help on using the changeset viewer.