File wdiff-0.5.2.dif of Package wdiff

--- configure.in
+++ configure.in
@@ -26,7 +26,7 @@
 AC_DEFINE_UNQUOTED(PAGER_PROGRAM, "$PAGER")
 
 AC_PROG_CC
-AM_PROG_INSTALL
+AC_PROG_INSTALL
 AC_PROG_RANLIB
 
 AC_AIX
--- po/Makefile.in.in
+++ po/Makefile.in.in
@@ -124,9 +124,9 @@
 install-data-no: all
 install-data-yes: all
 	if test -r $(MKINSTALLDIRS); then \
-	  $(MKINSTALLDIRS) $(datadir); \
+	  $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
 	else \
-	  $(top_srcdir)/mkinstalldirs $(datadir); \
+	  $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
 	fi
 	@catalogs='$(CATALOGS)'; \
 	for cat in $$catalogs; do \
@@ -137,25 +137,25 @@
 	  lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
 	  dir=$$destdir/$$lang/LC_MESSAGES; \
 	  if test -r $(MKINSTALLDIRS); then \
-	    $(MKINSTALLDIRS) $$dir; \
+	    $(MKINSTALLDIRS) $(DESTDIR)$$dir; \
 	  else \
-	    $(top_srcdir)/mkinstalldirs $$dir; \
+	    $(top_srcdir)/mkinstalldirs $(DESTDIR)$$dir; \
 	  fi; \
 	  if test -r $$cat; then \
-	    $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+	    $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT); \
 	    echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
 	  else \
-	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+	    $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT); \
 	    echo "installing $(srcdir)/$$cat as" \
 		 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
 	  fi; \
 	  if test -r $$cat.m; then \
-	    $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+	    $(INSTALL_DATA) $$cat.m $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
 	    echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
 	  else \
 	    if test -r $(srcdir)/$$cat.m ; then \
 	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
-		$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+		$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
 	      echo "installing $(srcdir)/$$cat as" \
 		   "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
 	    else \
@@ -165,12 +165,12 @@
 	done
 	if test "$(PACKAGE)" = "gettext"; then \
 	  if test -r $(MKINSTALLDIRS); then \
-	    $(MKINSTALLDIRS) $(gettextsrcdir); \
+	    $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
 	  else \
-	    $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+	    $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
 	  fi; \
 	  cd $(srcdir) && \
-	    $(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/Makefile.in.in; \
+	    $(INSTALL_DATA) Makefile.in.in $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
 	else \
 	  : ; \
 	fi
--- src/unify.c
+++ src/unify.c
@@ -20,6 +20,8 @@
 
    Originally written by Wayne Davison <davison@borland.com>.  */
 
+#include <string.h>
+
 #include "system.h"
 #include "getopt.h"
 
--- src/wdiff.c
+++ src/wdiff.c
@@ -16,6 +16,10 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#ifdef LERMEN_STUFF
+#define LVERSION "L3"
+#endif
+
 #include "system.h"
 
 /* Exit codes values.  */
@@ -52,7 +56,9 @@
 # endif
 #endif
 
-char *strstr ();
+#ifndef strstr
+/*char *strstr ();*/
+#endif
 
 #if HAVE_TPUTS
 # if HAVE_TERMCAP_H
@@ -110,11 +116,15 @@
   {"no-deleted"  , 0, NULL, '1'},
   {"no-inserted" , 0, NULL, '2'},
   {"printer"     , 0, NULL, 'p'},
+  {"punctuation" , 0, NULL, 'P'},
   {"start-delete", 1, NULL, 'w'},
   {"start-insert", 1, NULL, 'y'},
   {"statistics"  , 0, NULL, 's'},
   {"terminal"    , 0, NULL, 't'},
   {"version"     , 0, NULL, 'V'},
+#ifdef LERMEN_STUFF
+  {"context"     , 1, NULL, 'c'},
+#endif
   {NULL          , 0, NULL, 0}
 };
 
@@ -127,6 +137,7 @@
 int inhibit_right;		/* inhibit display of left side words */
 int inhibit_common;		/* inhibit display of common words */
 int ignore_case;		/* ignore case in comparisons */
+int ignore_punct;		/* ignore punctuation (treat as whitespace) */
 int show_statistics;		/* if printing summary statistics */
 int no_wrapping;		/* end/restart strings at end of lines */
 int autopager;			/* if calling the pager automatically */
@@ -222,6 +233,142 @@
 }
 
 
+#ifdef LERMEN_STUFF
+
+/* we intercept output to 'output_file' in order to catch some lines
+ * of context _before_ and _after_ the emphasized parts
+ */
+ 
+#define BUFLINE_SIZE 1024
+struct bufline {
+  struct bufline *next;
+  char line[BUFLINE_SIZE];
+};
+
+static struct bufline *headbufline = 0;
+static struct bufline *tailbufline = 0;
+static int bufcols = 0;
+static int in_emphasize = 0;
+static int context_lines = 0;
+static int bufline_overrun = 0;
+static int behind_emphasize = 0;
+
+static void init_savebuffers(int lines)
+{
+  struct bufline *p;
+  int i;
+
+  if (headbufline) return;
+  context_lines = ++lines;
+  headbufline = p = malloc(sizeof(struct bufline));
+  for (i=0; i<lines; i++) {
+    p->next = malloc(sizeof(struct bufline));
+    p = p->next;
+  }
+  p->next = tailbufline = headbufline;  /* close the circle */    
+}
+
+static inline void inc_headbuf(void)
+{
+  headbufline = headbufline->next;
+  if (headbufline == tailbufline) {
+    bufline_overrun = 1;
+    tailbufline = tailbufline->next;
+  }
+}
+
+static void flush_buflines(void)
+{
+  if (!bufcols && (headbufline == tailbufline)) return;
+  if (bufcols) {
+    headbufline->line[bufcols] = 0;
+    inc_headbuf();
+    bufcols = 0;
+  }
+  while (headbufline != tailbufline) {
+    if (bufline_overrun) {
+      fprintf(output_file, "\n%s\n", SEPARATOR_LINE);
+      bufline_overrun = 0;
+    }
+    fputs(tailbufline->line, output_file);
+    tailbufline = tailbufline->next;
+  }
+}
+
+static inline void save_char(int c)
+{
+  headbufline->line[bufcols++] = c;
+  if (c == '\n') {
+    headbufline->line[bufcols] = 0;
+    inc_headbuf();
+    bufcols = 0;
+  }
+}
+
+static inline int our_putc(int c, FILE *stream)
+{
+  if (context_lines && stream == output_file) {
+    if (!in_emphasize) {
+      if (behind_emphasize) {
+        if (c == '\n') behind_emphasize--;
+      }
+      else {
+        save_char(c);
+        return (int)((unsigned char) c);
+      }
+    }
+  }
+  return putc(c, stream);
+}
+#undef putc
+#define putc our_putc
+
+
+static void real_start_of_delete (void);
+static void real_end_of_delete (void);
+static void real_start_of_insert (void);
+static void real_end_of_insert (void);
+
+static void our_start_of_delete (void)
+{
+  if (context_lines) flush_buflines();
+  in_emphasize = 1;
+  real_start_of_delete();
+}
+static void our_end_of_delete (void)
+{
+  real_end_of_delete();
+  in_emphasize = 0;
+  behind_emphasize = context_lines;
+}
+static void our_start_of_insert (void)
+{
+  if (context_lines) flush_buflines();
+  in_emphasize = 1;
+  real_start_of_insert();
+}
+static void our_end_of_insert (void)
+{
+  real_end_of_insert();
+  in_emphasize = 0;
+  behind_emphasize = context_lines;
+}
+
+#define start_of_delete our_start_of_delete
+#define end_of_delete our_end_of_delete
+#define start_of_insert our_start_of_insert
+#define end_of_insert our_end_of_insert
+
+#else /* not LERMEN_STUFF */
+
+#define start_of_delete real_start_of_delete
+#define end_of_delete real_end_of_delete
+#define start_of_insert real_start_of_insert
+#define end_of_insert real_end_of_insert
+
+#endif
+
+
 /* Terminal initialization.  */
 
 static void
@@ -294,7 +441,7 @@
 `---------------------------*/
 
 static void
-start_of_delete (void)
+real_start_of_delete (void)
 {
 
   /* Avoid any emphasis if it would be useless.  */
@@ -316,7 +463,7 @@
 `-------------------------*/
 
 static void
-end_of_delete (void)
+real_end_of_delete (void)
 {
 
   /* Avoid any emphasis if it would be useless.  */
@@ -338,7 +485,7 @@
 `---------------------------*/
 
 static void
-start_of_insert (void)
+real_start_of_insert (void)
 {
 
   /* Avoid any emphasis if it would be useless.  */
@@ -360,7 +507,7 @@
 `-------------------------*/
 
 static void
-end_of_insert (void)
+real_end_of_insert (void)
 {
 
   /* Avoid any emphasis if it would be useless.  */
@@ -377,6 +524,12 @@
   copy_mode = COPY_NORMAL;
 }
 
+/*----------------------------------------------------------------.
+| We say "white space", but we actually mean space or punctuation |
+`----------------------------------------------------------------*/
+
+#define is_space_or_punct(c) (isspace(c) || ignore_punct && ispunct(c))
+
 /*--------------------------------.
 | Skip over white space on SIDE.  |
 `--------------------------------*/
@@ -387,7 +540,7 @@
   if (interrupted)
     longjmp (signal_label, 1);
 
-  while (isspace (side->character))
+  while (is_space_or_punct (side->character))
     side->character = getc (side->file);
 }
 
@@ -401,7 +554,7 @@
   if (interrupted)
     longjmp (signal_label, 1);
 
-  while (side->character != EOF && !isspace (side->character))
+  while (side->character != EOF && !is_space_or_punct (side->character))
     side->character = getc (side->file);
   side->position++;
 }
@@ -422,7 +575,7 @@
       /* While changing lines, ensure we stop any special display prior
 	 to, and restore the special display after.  When copy_mode is
 	 anything else than COPY_NORMAL, file is always output_file.  We
-	 care underlining whitespace or overstriking it with itself,
+	 care about underlining whitespace or overstriking it with itself,
 	 because "less" understands these things as emphasis requests.  */
 
       switch (copy_mode)
@@ -905,7 +1058,10 @@
 static void
 complete_input_program (void)
 {
-  fclose (input_file);
+  if (input_file) {
+    fclose (input_file);
+    input_file = NULL;
+  }
   wait (NULL);
 }
 
@@ -1007,6 +1163,7 @@
   if (output_file && output_file != stdout)
     {
       fclose (output_file);
+      output_file = NULL;
       wait (NULL);
     }
 
@@ -1037,29 +1194,29 @@
   count_common_right
     = count_total_right - count_isolated_right - count_changed_right;
 
-  printf (_("%s: %d words"), left_side->filename, count_total_left);
+  fprintf (stderr, "%s: %d words", left_side->filename, count_total_left);
   if (count_total_left > 0)
     {
-      printf (_("  %d %d%% common"), count_common_left,
+      fprintf (stderr, "  %d %d%% common", count_common_left,
 	      count_common_left * 100 / count_total_left);
-      printf (_("  %d %d%% deleted"), count_isolated_left,
+      fprintf (stderr, "  %d %d%% deleted", count_isolated_left,
 	      count_isolated_left * 100 / count_total_left);
-      printf (_("  %d %d%% changed"), count_changed_left,
+      fprintf (stderr, "  %d %d%% changed", count_changed_left,
 	      count_changed_left * 100 / count_total_left);
     }
-  printf ("\n");
+  fprintf (stderr, "\n");
 
-  printf (_("%s: %d words"), right_side->filename, count_total_right);
+  fprintf (stderr, _("%s: %d words"), right_side->filename, count_total_right);
   if (count_total_right > 0)
     {
-      printf (_("  %d %d%% common"), count_common_right,
+      fprintf (stderr, "  %d %d%% common", count_common_right,
 	      count_common_right * 100 / count_total_right);
-      printf (_("  %d %d%% inserted"), count_isolated_right,
+      fprintf (stderr, "  %d %d%% inserted", count_isolated_right,
 	      count_isolated_right * 100 / count_total_right);
-      printf (_("  %d %d%% changed"), count_changed_right,
+      fprintf (stderr, "  %d %d%% changed", count_changed_right,
 	      count_changed_right * 100 / count_total_right);
     }
-  printf ("\n");
+  fprintf (stderr, "\n");
 }
 
 
@@ -1111,13 +1268,19 @@
   -V, --version              print program version then exit\n\
   -1, --no-deleted           inhibit output of deleted words\n\
   -2, --no-inserted          inhibit output of inserted words\n\
-  -3, --no-common            inhibit output of common words\n\
+  -3, --no-common            inhibit output of common words\n"));
+#ifdef LERMEN_STUFF
+      printf(_("\
+  -c  --context              like -3, but print given context lines\n"));
+#endif
+      printf(_("\
   -a, --auto-pager           automatically calls a pager\n\
   -h, --help                 print this help\n\
   -i, --ignore-case          fold character case while comparing\n\
   -l, --less-mode            variation of printer mode for \"less\"\n\
   -n, --avoid-wraps          do not extend fields through newlines\n\
   -p, --printer              overstrike as for printers\n\
+  -P, --punctuation          treat punctuation like white space\n\
   -s, --statistics           say how many words deleted, inserted etc.\n\
   -t, --terminal             use termcap as for terminal displays\n\
   -w, --start-delete=STRING  string to mark beginning of delete region\n\
@@ -1171,7 +1334,7 @@
   count_changed_left = 0;
   count_changed_right = 0;
 
-  while (option_char = getopt_long (argc, argv, "123CVahidlnpstw:x:y:z:",
+  while (option_char = getopt_long (argc, argv, "123CVahilnpPstw:x:y:z:c:",
 				    longopts, NULL),
 	 option_char != EOF)
     switch (option_char)
@@ -1193,7 +1356,11 @@
 	exit (EXIT_SUCCESS);
 
       case 'V':
-	printf ("GNU %s %s\n%s\n", PACKAGE, VERSION, copyright);
+#ifdef LERMEN_STUFF
+	printf ("GNU %s %s\n%s\n", VERSION,LVERSION,copyright);
+#else
+	printf ("GNU %s %s\n%s\n", VERSION,"",copyright);
+#endif
 	exit (EXIT_SUCCESS);
 
       case 'a':
@@ -1222,6 +1389,10 @@
 	overstrike = 1;
 	break;
 
+      case 'P':
+	ignore_punct = 1;
+	break;
+
       case 's':
 	show_statistics = 1;
 	break;
@@ -1252,6 +1423,12 @@
 	user_insert_end = optarg;
 	break;
 
+#ifdef LERMEN_STUFF
+      case 'c':
+	init_savebuffers(atoi(optarg));
+	break;
+#endif
+
       default:
 	usage (EXIT_OTHER_REASON);
       }
@@ -1262,6 +1439,13 @@
       usage (EXIT_OTHER_REASON);
     }
 
+#ifdef LERMEN_STUFF
+  if (context_lines) {
+     inhibit_common = 0;
+     if (inhibit_right && inhibit_left) inhibit_right = 0;
+  }
+#endif
+
   /* If find_termcap still undecided, make it true only if autopager is set
      while stdout is directed to a terminal.  This decision might be
      reversed later, if the pager happens to be "less".  */
--- src/xwdiff
+++ src/xwdiff
@@ -0,0 +1,307 @@
+#!/bin/bash
+# the next line restarts using wish \
+exec wish "$0" "$@"
+
+proc positionWindow w {
+  wm geometry $w +100+100
+}
+
+proc positionWindowRelative {w masterw dx dy} {
+  set xx [split [wm geometry $masterw] +]
+  wm geometry $w "+[expr [lindex $xx 1] + $dx]+[expr [lindex $xx 2] + $dy]"
+}
+
+proc positionSubWindow {w} {
+  positionWindowRelative $w . 0 +45
+}
+
+set answer 0
+
+proc ___read_and_display_output { w titletext but1 but2 movto filehandle} {
+    global answer
+    if {$w != ""} {
+      catch {destroy $w}
+      toplevel $w
+      set w_ $w
+    } else {
+      set w_ .
+    }
+    wm title $w_ $titletext
+    wm iconname $w_ $titletext
+    positionWindow $w_
+    set line ""
+
+
+    frame $w.buttons
+    pack  $w.buttons -side bottom -expand y -fill x -pady 2m
+    set answer 0
+    button $w.buttons.but1 -text $but1 -width 20 -command "destroy $w; global answer; set answer 0"
+    if { "$but2" == "" } {
+	pack $w.buttons.but1 -side left -expand 1
+    } else {
+	button $w.buttons.but2 -text $but2 -width 20 -command "destroy $w; global answer; set answer 1"
+	pack $w.buttons.but1 $w.buttons.but2 -side left -expand 1
+    }
+    text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 -height 25 -width 80
+    scrollbar $w.scroll -command "$w.text yview"
+    pack $w.scroll -side right -fill y
+    pack $w.text -expand yes -fill both
+    $w.text configure -background #fff2dc
+    $w.text configure -font -*-courier-medium-r-*-*-14-*-*-*-*-*-*-*
+
+    $w.text tag configure overstrike -overstrike on
+    $w.text tag configure boldoverstrike -overstrike on -font -*-courier-bold-r-*-*-14-*-*-*-*-*-*-*
+    $w.text tag configure bold -font -*-courier-bold-r-*-*-14-*-*-*-*-*-*-*
+#    $w.text tag configure color1 -background black -foreground white
+#    $w.text tag configure color1 -foreground #ff1800
+#    $w.text tag configure color1 -foreground #0000c0
+    $w.text tag configure boldblue -font -*-courier-bold-r-*-*-14-*-*-*-*-*-*-* -foreground #0000b0
+    set instag boldblue
+    set deltag boldoverstrike
+    set tag ""
+    set need_newline 0;
+    while {[eof $filehandle] == 0} {
+       set ret [gets $filehandle line]
+       if {$ret < 0} {
+          continue
+       }
+       if {[string compare "\x1bY1" $line] == 0} {
+         set need_newline 0;
+         set tag $instag
+         continue
+       }
+       if {[string compare "\x1bY0" $line] == 0} {
+         set need_newline 0;
+         set tag ""
+         continue
+       }
+       if {[string compare "\x1bX1" $line] == 0} {
+         set need_newline 0;
+         set tag $deltag
+         continue
+       }
+       if {[string compare "\x1bX0" $line] == 0} {
+         set need_newline 0;
+         set tag ""
+         continue
+       }
+       if {$need_newline} {$w.text insert end "\n"}
+       set need_newline 1;
+       $w.text insert end $line $tag
+    }
+    $w.text yview moveto $movto
+    vwait answer
+    return $answer
+}
+
+set lastsearchtx ""
+set lastcur ""
+
+# textSearch --
+# Search for all instances of a given string in a text widget and
+# apply a given tag to each instance found.
+#
+# Arguments:
+# w -		The window in which to search.  Must be a text widget.
+# string -	The string to search for.  The search is done using
+#		exact matching only;  no special characters.
+# tag -		Tag to apply to each instance of a matching string.
+
+proc textSearch {w string tag} {
+    global lastcur
+    $w tag remove search 0.0 end
+    set lastcur ""
+    if {$string == ""} {
+	return
+    }
+    set cur 1.0
+    while 1 {
+	set cur [$w search -nocase -count length $string $cur end]
+	if {$cur == ""} {
+	    if {$lastcur != ""} {$w yview $lastcur}
+	    break
+	}
+        if {$lastcur == ""} {set lastcur $cur}
+	$w tag add $tag $cur "$cur + $length char"
+	set cur [$w index "$cur + $length char"]
+    }
+}
+
+
+proc textSearchjmp {w string tag} {
+  global lastsearchtx lastcur
+  if { ($lastcur != "") && ([string compare $lastsearchtx $string] == 0) } {
+puts ">$lastcur< >$lastsearchtx<"
+     set lastcur [lindex [$w tag nextrange $tag [expr $lastcur + 1.0] end] 0]
+puts ">$lastcur<"
+     if {$lastcur != ""} {$w yview $lastcur}
+  } else {
+     textSearch $w $string $tag
+     set lastsearchtx $string
+  }
+}
+
+proc gotopos {w pos} {
+  global lastcur
+  $w yview $pos
+  set lastcur [ $w index $pos ]
+}
+
+proc read_and_display_output { w titletext but1 but2 movto filehandle} {
+    global answer lastcur
+    if {$w != ""} {
+      catch {destroy $w}
+      toplevel $w
+      set w_ $w
+    } else {
+      set w_ .
+    }
+    wm title $w_ $titletext
+    wm iconname $w_ $titletext
+    positionWindow $w_
+    set line ""
+
+
+    frame $w.buttons
+    pack  $w.buttons -side bottom -expand y -fill x -pady 2m
+    set answer 0
+    button $w.buttons.but1 -text $but1 -command "destroy $w; global answer; set answer 0"
+    if { "$but2" == "" } {
+	pack $w.buttons.but1 -side left -expand 1
+    } else {
+	button $w.buttons.but2 -text $but2 -width 20 -command "destroy $w; global answer; set answer 1"
+	pack $w.buttons.but1 $w.buttons.but2 -side left -expand 1
+    }
+
+    button $w.buttons.top -text "Go top" -anchor w -command \
+	"gotopos $w.text 1.0"
+    button $w.buttons.bot -text "Go bottom" -anchor w -command \
+	"gotopos $w.text end"
+    pack $w.buttons.top $w.buttons.bot -side left -expand 1
+
+    label $w.buttons.label -textvariable lastcur -anchor w -width 8
+    button $w.buttons.search -text "Search" -anchor w -command \
+	"textSearchjmp $w.text \$searchString search"
+    entry $w.buttons.entry -width 40 -textvariable searchString
+    pack $w.buttons.label $w.buttons.entry $w.buttons.search -side left -padx 2
+    bind $w.buttons.entry <Return> "textSearchjmp $w.text \$searchString search"
+
+    text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 -height 25 -width 80
+    scrollbar $w.scroll -command "$w.text yview"
+    pack $w.scroll -side right -fill y
+    pack $w.text -expand yes -fill both
+    $w.text configure -background #fff2dc
+    $w.text configure -font -*-courier-medium-r-*-*-14-*-*-*-*-*-*-*
+
+    $w.text tag configure overstrike -overstrike on
+    $w.text tag configure boldoverstrike -overstrike on -font -*-courier-bold-r-*-*-14-*-*-*-*-*-*-*
+    $w.text tag configure bold -font -*-courier-bold-r-*-*-14-*-*-*-*-*-*-*
+#    $w.text tag configure color1 -background black -foreground white
+#    $w.text tag configure color1 -foreground #ff1800
+#    $w.text tag configure color1 -foreground #0000c0
+    $w.text tag configure boldblue -font -*-courier-bold-r-*-*-14-*-*-*-*-*-*-* -foreground #0000b0
+
+$w.text tag configure search -background #c83000 -foreground white \
+       -relief raised -borderwidth 2
+
+    set instag boldblue
+    set deltag boldoverstrike
+    set tag ""
+    set need_newline 0;
+    while {[eof $filehandle] == 0} {
+       set ret [gets $filehandle line]
+       if {$ret < 0} {
+          continue
+       }
+       if {[string compare "\x1bY1" $line] == 0} {
+         set need_newline 0;
+         set tag $instag
+         continue
+       }
+       if {[string compare "\x1bY0" $line] == 0} {
+         set need_newline 0;
+         set tag ""
+         continue
+       }
+       if {[string compare "\x1bX1" $line] == 0} {
+         set need_newline 0;
+         set tag $deltag
+         continue
+       }
+       if {[string compare "\x1bX0" $line] == 0} {
+         set need_newline 0;
+         set tag ""
+         continue
+       }
+       if {$need_newline} {$w.text insert end "\n"}
+       set need_newline 1;
+       $w.text insert end $line $tag
+    }
+    $w.text yview moveto $movto
+    vwait answer
+    return $answer
+}
+
+proc usage {} {
+  puts {
+USAGE:
+  xwdiff oldfile newfile
+  xwdiff -w numcontextlines oldfile newfile >prepared_diff_file
+  xwdiff -view TitleText <prepared_diff_file
+  xwdiff -a numcontextlines oldfile newfile >plain_ascii_diff
+}
+  exit 1
+}
+
+set secondphase "-view"
+set option_W    "-w"
+set option_D    "-a"
+set arg1 [lindex $argv 0]
+
+if { [string compare $arg1 $option_W] == 0 } {
+  set context [lindex $argv 1]
+  set n1 [lindex $argv 2]
+  set n2 [lindex $argv 3]
+  if {$n2 == ""} {usage} 
+  catch {exec wdiff -w "\n\x1bX1\n" -x "\n\x1bX0\n" \
+     -y "\n\x1bY1\n" -z "\n\x1bY0\n" -c $context $n1 $n2 >@ file1 }
+  exit
+}
+
+if { [string compare $arg1 $option_D] == 0 } {
+  set context [lindex $argv 1]
+  set n1 [lindex $argv 2]
+  set n2 [lindex $argv 3]
+  if {$n2 == ""} {usage} 
+#  catch {exec wdiff -w "\n\[---\n" -x "\n---\]\n" \
+#     -y "\n\{+++\n" -z "\n+++\}\n" -c $context $n1 $n2 >@ file1}
+  catch {exec wdiff -w "\n\[OLD\n" -x "\n\\OLD\]\n" \
+     -y "\n\{NEW\n" -z "\n\\NEW\}\n" -c $context $n1 $n2 >@ file1}
+  exit
+}
+
+if { [string compare $arg1 $secondphase] } {
+  set n1 [lindex $argv 0]
+  set n2 [lindex $argv 1]
+  if {$n2 == ""} {usage}
+  catch { exec wdiff -w "\n\x1bX1\n" -x "\n\x1bX0\n" -y "\n\x1bY1\n" \
+     -z "\n\x1bY0\n" -c4 $n1 $n2 | $argv0 $secondphase "xwdiff $n2"}
+  exit
+}
+
+set arg2 [lindex $argv 1]
+if {$arg2 == ""} {usage} 
+
+read_and_display_output "" $arg2 Quit "" 0 file0
+exit
+
+
+
+
+
+
+
+
+
+
+
openSUSE Build Service is sponsored by