Lines Matching +full:no +full:- +full:divider

68 static size_t line_width;	/* width of a line (two columns and divider) */
91 { "suppress-common-lines", no_argument, NULL, 's' },
95 { "diff-program", required_argument, NULL, DIFFPROG_OPT },
98 { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT },
99 { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT },
100 { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT },
104 { "ignore-blank-lines", no_argument, NULL, 'B' },
105 { "ignore-space-change", no_argument, NULL, 'b' },
107 { "ignore-tab-expansion", no_argument, NULL, 'E' },
108 { "ignore-matching-lines", required_argument, NULL, 'I' },
109 { "ignore-case", no_argument, NULL, 'i' },
110 { "left-column", no_argument, NULL, 'l' },
111 { "expand-tabs", no_argument, NULL, 't' },
112 { "speed-large-files", no_argument, NULL, 'H' },
113 { "ignore-all-space", no_argument, NULL, 'W' },
119 "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n",
120 "-l, --left-column: only print the left column for identical lines.",
121 "-o OUTFILE, --output=OUTFILE: interactively merge file1 and file2 into outfile.",
122 "-s, --suppress-common-lines: skip identical lines.",
123 "-w WIDTH, --width=WIDTH: print a maximum of WIDTH characters on each line.",
126 "\t-a, --text: treat file1 and file2 as text files.",
127 "\t-b, --ignore-trailing-cr: ignore trailing blank spaces.",
128 "\t-d, --minimal: minimize diff size.",
129 "\t-I RE, --ignore-matching-lines=RE: ignore changes whose line matches RE.",
130 "\t-i, --ignore-case: do a case-insensitive comparison.",
131 "\t-t, --expand-tabs: expand tabs to spaces.",
132 "\t-W, --ignore-all-space: ignore all whitespace.",
133 "\t--speed-large-files: assume large file with scattered changes.",
134 "\t--strip-trailing-cr: strip trailing carriage return.",
135 "\t--ignore-file-name-case: ignore case of file names.",
136 "\t--no-ignore-file-name-case: do not ignore file name case",
137 "\t--tabsize NUM: change size of tabs (default 8.)",
158 if (ifd != -1) {
159 if (fstat(ifd, &sb) == -1)
168 /* If ``-'' does not exist the user meant stdin. */
169 if (errno == ENOENT && strcmp(source_file, "-") == 0)
176 if (asprintf(&target_file, "%s/sdiff.XXXXXXXXXX", tmpdir) == -1)
178 if ((ofd = mkstemp(target_file)) == -1) {
182 while ((rcount = read(ifd, buf, sizeof(buf))) != -1 &&
187 if (-1 == wcount || rcount != wcount) {
192 if (rcount == -1) {
217 char I_arg[] = "-I";
218 char speed_lf[] = "--speed-large-files";
237 /* create a dynamic string for merging single-character options */
240 flagv[flagc] = '-';
245 longopts, NULL)) != -1) {
247 /* only compatible --long-name-form with diff */
253 /* combine no-arg single switches */
314 /* no single-character options were used */
317 sizeof(char *) * (diffargc - 2));
318 diffargc--;
322 argc -= optind;
372 /* Subtract column divider and divide by two. */
373 width = (wval - 3) / 2;
375 if (width > (SIZE_MAX - 3) / 2)
413 if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status) ||
418 /* No more diffs, so enqueue common lines. */
513 * that tabs are variable-width. Takes a string, the current column
530 if (*col > SIZE_MAX - tabsize)
582 if (eparse(p, s1, s2) == -1)
587 /* Choose left column as-is. */
596 /* Choose right column as-is. */
622 * If there was no error, we received an EOF from stdin, so we
631 * Takes two strings, separated by a column divider. NULL strings are
632 * treated as empty columns. If the divider is the ` ' character, the
633 * second column is not printed (-l flag). In this case, the second
634 * string must be NULL. When the second column is NULL, the divider
635 * does not print the trailing space following the divider character.
640 println(const char *s1, const char divider, const char *s2)
657 if (divider == ' ' && !s2) {
663 * Print column divider. If there is no second column, we don't
667 printf(" %c\n", divider);
670 printf(" %c ", divider);
694 if ((l = getline(&s, &linecap, file)) == -1) {
700 if (s[l-1] == '\n')
701 s[l-1] = '\0';
806 * specified by diff. Should only happen with -I flag.
817 /* If the -l flag was specified, print only left column. */
821 * XXX - If -l and -I are both specified, all
823 * `(' divider. This matches GNU sdiff, but I
825 * gsdiff -l -I '^$' samefile samefile.
850 /* If -l flag was given, don't print right column. */
863 n = file2end - file2start + 1;
867 n = file1end - file1start + 1 + 1 + file2end - file2start + 1;
871 n = file1end - file1start + 1;
879 while (n--) {
892 enqueue(char *left, char divider, char *right)
898 diffp->left = left;
899 diffp->div = divider;
900 diffp->right = right;
911 free(diffp->left);
912 free(diffp->right);
972 strlcpy(*s + offset, "\n", newsiz - offset);
973 strlcat(*s + offset, append, newsiz - offset);
975 /* New string length should be exactly newsiz - 1 characters. */
977 offset = newsiz - 1;
995 /* Remember the divider. */
996 divc = STAILQ_FIRST(&diffhead)->div;
1006 * Print changed lines if -s was given,
1007 * print all lines if -s was not given.
1009 if (!sflag || diffp->div == '|' || diffp->div == '<' ||
1010 diffp->div == '>')
1011 println(diffp->left, diffp->div, diffp->right);
1014 if (diffp->left)
1015 astrcat(&left, diffp->left);
1016 if (diffp->right)
1017 astrcat(&right, diffp->right);
1037 errx(2, "invalid divider: %c", divc);
1086 linep->line = line1;
1101 enqueue(del->line, '|', add);
1128 enqueue(filep->line, '<', NULL);
1165 "s:\tsilent mode--don't print identical lines\n"
1166 "v:\tverbose mode--print identical lines\n"
1175 "usage: sdiff [-abdilstHW] [-I regexp] [-o outfile] [-w width] file1"