Lines Matching +full:sig +full:- +full:dir

1 /* sdiff - side-by-side merge of file differences
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 #include <unlocked-io.h>
29 #include <c-stack.h>
34 #include <file-type.h>
37 #include <version-etc.h>
87 #define handler_index_of_SIGINT (NUM_SIGS - 2)
88 #define handler_index_of_SIGPIPE (NUM_SIGS - 1)
98 # define signal_handler(sig, handler) signal (sig, handler) argument
105 # define sigmask(sig) (1 << ((sig) - 1)) argument
107 # define sigaddset(s, sig) (*(s) |= sigmask (sig)) argument
123 /* Name of output file if -o specified. */
129 /* Value for the long option that does not have single-letter equivalents. */
140 {"diff-program", 1, 0, DIFF_PROGRAM_OPTION},
141 {"expand-tabs", 0, 0, 't'},
143 {"ignore-all-space", 0, 0, 'W'}, /* swap W and w for historical reasons */
144 {"ignore-blank-lines", 0, 0, 'B'},
145 {"ignore-case", 0, 0, 'i'},
146 {"ignore-matching-lines", 1, 0, 'I'},
147 {"ignore-space-change", 0, 0, 'b'},
148 {"ignore-tab-expansion", 0, 0, 'E'},
149 {"left-column", 0, 0, 'l'},
152 {"speed-large-files", 0, 0, 'H'},
153 {"strip-trailing-cr", 0, 0, STRIP_TRAILING_CR_OPTION},
154 {"suppress-common-lines", 0, 0, 's'},
168 error (EXIT_TROUBLE, 0, _("Try `%s --help' for more information."), in try_help()
183 N_("-o FILE --output=FILE Operate interactively, sending output to FILE."),
185 N_("-i --ignore-case Consider upper- and lower-case to be the same."),
186 N_("-E --ignore-tab-expansion Ignore changes due to tab expansion."),
187 N_("-b --ignore-space-change Ignore changes in the amount of white space."),
188 N_("-W --ignore-all-space Ignore all white space."),
189 N_("-B --ignore-blank-lines Ignore changes whose lines are all blank."),
190 N_("-I RE --ignore-matching-lines=RE Ignore changes whose lines all match RE."),
191 N_("--strip-trailing-cr Strip trailing carriage return on input."),
192 N_("-a --text Treat all files as text."),
194 N_("-w NUM --width=NUM Output at most NUM (default 130) print columns."),
195 N_("-l --left-column Output only the left column of common lines."),
196 N_("-s --suppress-common-lines Do not output common lines."),
198 N_("-t --expand-tabs Expand tabs to spaces in output."),
199 N_("--tabsize=NUM Tab stops are every NUM (default 8) print columns."),
201 N_("-d --minimal Try hard to find a smaller set of changes."),
202 N_("-H --speed-large-files Assume large files and many scattered small changes."),
203 N_("--diff-program=PROGRAM Use PROGRAM to compare files."),
205 N_("-v --version Output version info."),
206 N_("--help Output this help."),
216 printf ("%s\n\n", _("Side-by-side merge of file differences.")); in usage()
223 _("If a FILE is `-', read standard input."), in usage()
225 _("Report bugs to <bug-gnu-utils@gnu.org>.")); in usage()
229 async-signal-safe. */
332 if (strcmp (name, "-") == 0) in expand_name()
341 bool insert_slash = *base_name (name) && name[namelen - 1] != '/'; in expand_name()
360 lf->infile = infile; in lf_init()
361 lf->bufpos = lf->buffer = lf->buflim = xmalloc (SDIFF_BUFSIZE + 1); in lf_init()
362 lf->buflim[0] = '\n'; in lf_init()
369 size_t s = ck_fread (lf->buffer, SDIFF_BUFSIZE, lf->infile); in lf_refill()
370 lf->bufpos = lf->buffer; in lf_refill()
371 lf->buflim = lf->buffer + s; in lf_refill()
372 lf->buflim[0] = '\n'; in lf_refill()
381 char *start = lf->bufpos; in lf_copy()
385 lf->bufpos = (char *) memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); in lf_copy()
386 if (! lf->bufpos) in lf_copy()
388 ck_fwrite (start, lf->buflim - start, outfile); in lf_copy()
391 start = lf->bufpos; in lf_copy()
395 --lines; in lf_copy()
396 ++lf->bufpos; in lf_copy()
400 ck_fwrite (start, lf->bufpos - start, outfile); in lf_copy()
409 lf->bufpos = (char *) memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); in lf_skip()
410 if (! lf->bufpos) in lf_skip()
417 --lines; in lf_skip()
418 ++lf->bufpos; in lf_skip()
429 char *start = lf->bufpos; in lf_snarf()
430 char *next = (char *) memchr (start, '\n', lf->buflim + 1 - start); in lf_snarf()
431 size_t s = next - start; in lf_snarf()
435 if (next < lf->buflim) in lf_snarf()
438 lf->bufpos = next + 1; in lf_snarf()
444 bufsize -= s; in lf_snarf()
470 != -1) in main()
475 diffarg ("-a"); in main()
479 diffarg ("-b"); in main()
483 diffarg ("-B"); in main()
487 diffarg ("-d"); in main()
491 diffarg ("-E"); in main()
495 diffarg ("-H"); in main()
499 diffarg ("-i"); in main()
503 diffarg ("-I"); in main()
508 diffarg ("--left-column"); in main()
520 diffarg ("-t"); in main()
530 diffarg ("-W"); in main()
535 diffarg ("-w"); in main()
548 diffarg ("--strip-trailing-cr"); in main()
552 diffarg ("--tabsize"); in main()
561 if (argc - optind != 2) in main()
563 if (argc - optind < 2) in main()
564 try_help ("missing operand after `%s'", argv[argc - 1]); in main()
573 diffarg ("--suppress-common-lines"); in main()
574 diffarg ("-y"); in main()
575 diffarg ("--"); in main()
602 diffarg ("--sdiff-merge-assist"); in main()
603 diffarg ("--"); in main()
624 p[-1] = 0; in main()
712 if (wstatus == -1) in main()
739 return EXIT_SUCCESS; /* Fool `-Wall'. */ in main()
780 signal_handler (int sig, void (*handler) (int)) in signal_handler() argument
783 sigaction (sig, &catchaction, 0); in signal_handler()
909 cmd1 = 0; /* Pacify `gcc -W'. */ in edit()
1011 fprintf (tmp, "--- %s %ld\n", lname, (long int) lline); in edit()
1013 fprintf (tmp, "--- %s %ld,%ld\n", lname, in edit()
1015 (long int) (lline + llen - 1)); in edit()
1037 (long int) (rline + rlen - 1)); in edit()
1065 if (wstatus == -1) in edit()
1187 /* Return true if DIR is an existing directory. */
1189 diraccess (char const *dir) in diraccess() argument
1192 return stat (dir, &buf) == 0 && S_ISDIR (buf.st_mode); in diraccess()
1209 char const *dir = tmpdir ? tmpdir : P_tmpdir; in temporary_file() local
1210 char *buf = xmalloc (strlen (dir) + 1 + 5 + 6 + 1); in temporary_file()
1215 sprintf (buf, "%s/sdiffXXXXXX", dir); in temporary_file()