Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/editors/diff.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/editors/diff.c

    r3232 r3621  
    7777 */
    7878
     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
    79106//usage:#define diff_trivial_usage
    80107//usage:       "[-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2"
     
    99126
    100127#include "libbb.h"
     128#include "common_bufsiz.h"
    101129
    102130#if 0
     
    337365
    338366struct line {
    339     /* 'serial' is not used in the begining, so we reuse it
     367    /* 'serial' is not used in the beginning, so we reuse it
    340368     * to store line offsets, thus reducing memory pressure
    341369     */
     
    407435            int c = fgetc(ft->ft_fp);
    408436            if (c == EOF) {
    409                 printf("\n\\ No newline at end of file\n");
     437                puts("\n\\ No newline at end of file");
    410438                return;
    411439            }
     
    632660
    633661                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);
    636664
    637665                vec = xrealloc_vector(vec, 6, ++idx);
     
    666694                printf(",%d", (a < b) ? b - a + 1 : 0);
    667695            }
    668             printf(" @@\n");
     696            puts(" @@");
    669697            /*
    670698             * Output changes in "unified" diff format--the old and new lines
     
    714742            if (bb_copyfd_eof(fd, fd_tmp) < 0)
    715743                xfunc_die();
    716             if (fd) /* Prevents closing of stdin */
     744            if (fd != STDIN_FILENO)
    717745                close(fd);
    718746            fd = fd_tmp;
     747            xlseek(fd, 0, SEEK_SET);
    719748        }
    720749        fp[i] = fdopen(fd, "r");
    721750    }
    722751
     752    setup_common_bufsiz();
    723753    while (1) {
    724754        const size_t sz = COMMON_BUFSIZE / 2;
Note: See TracChangeset for help on using the changeset viewer.