summaryrefslogtreecommitdiff
path: root/contrib/diff/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/diff/diff.c')
-rw-r--r--contrib/diff/diff.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/contrib/diff/diff.c b/contrib/diff/diff.c
index ab1549be86437..1f5f842d2e934 100644
--- a/contrib/diff/diff.c
+++ b/contrib/diff/diff.c
@@ -20,11 +20,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* GNU DIFF was written by Mike Haertel, David Hayes,
Richard Stallman, Len Tower, and Paul Eggert. */
+/* $FreeBSD$ */
+
#define GDIFF_MAIN
#include "diff.h"
#include <signal.h>
#include "getopt.h"
+#ifdef __FreeBSD__
+#include <locale.h>
+#include <fnmatch.h>
+#else
#include "fnmatch.h"
+#endif
+#include "prepend_args.h"
#ifndef DEFAULT_WIDTH
#define DEFAULT_WIDTH 130
@@ -235,16 +243,21 @@ main (argc, argv)
int width = DEFAULT_WIDTH;
int show_c_function = 0;
+#ifdef __FreeBSD__
+ setlocale(LC_ALL, "");
+#endif
/* Do our initializations. */
initialize_main (&argc, &argv);
program_name = argv[0];
output_style = OUTPUT_NORMAL;
context = -1;
+ prepend_default_options (getenv ("DIFF_OPTIONS"), &argc, &argv);
+
/* Decode the options. */
while ((c = getopt_long (argc, argv,
- "0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y",
+ "0123456789abBcC:dD:efF:hHiI:lL:nNopPqrsS:tTuU:vwW:x:X:y",
longopts, 0)) != EOF)
{
switch (c)
@@ -416,6 +429,11 @@ main (argc, argv)
entire_new_file_flag = 1;
break;
+ case 'o':
+ /* Output in the old tradition style. */
+ specify_style (OUTPUT_NORMAL);
+ break;
+
case 'p':
/* Make context-style output and show name of last C function. */
show_c_function = 1;
@@ -697,7 +715,7 @@ static char const * const option_help[] = {
"-e --ed Output an ed script.",
"-n --rcs Output an RCS format diff.",
"-y --side-by-side Output in two columns.",
-" -w NUM --width=NUM Output at most NUM (default 130) characters per line.",
+" -W NUM --width=NUM Output at most NUM (default 130) characters per line.",
" --left-column Output only the left column of common lines.",
" --suppress-common-lines Do not output common lines.",
"-DNAME --ifdef=NAME Output merged file to show `#ifdef NAME' diffs.",
@@ -767,9 +785,6 @@ static void
specify_style (style)
enum output_style style;
{
- if (output_style != OUTPUT_NORMAL
- && output_style != style)
- error ("conflicting specifications of output style", 0, 0);
output_style = style;
}