From rfellows@fujin.intellistor.com Mon Sep 11 15:05:12 MET DST 1995
Article: 6668 of gnu.utils.bug
Path: jurix.jura.uni-sb.de!pf2.phil.uni-sb.de!news.coli.uni-sb.de!news.dfn.de!Germany.EU.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!fujin.intellistor.com!rfellows
From: rfellows@fujin.intellistor.com (Russ Fellows)
Newsgroups: gnu.utils.bug
Subject: sdiff
Date: 30 Aug 1995 14:18:37 -0400
Organization: GNUs Not Usenet
Lines: 177
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-utils@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9508301815.AA24789@fujin.ISI.systems>

This is in regards to the sdiff program, which is a part of the "diffutils"
package.  I believe that the current revision is 2.7.

I have enclosed a patch to the sdiff.c file that was a part of revision 2.6

This patch is for an "bug-fix" that is basically a lack of a feature.  In
the standard version of sdiff, the line number of the files are printed.
This lets users know what modified lines are being effected.  However,
the Gnu version of sdiff does not have this feature.  The patch provided
provides this feature.  I see it an incompatability to not provide this
feature, and therefore would like to request that it is included in future
versions.

Sincerly,
Russell Fellows
=============================================================================
*** sdiff.c.orig	Fri Nov 18 15:58:21 1994
--- sdiff.c	Fri Nov 18 16:03:07 1994
***************
*** 43,48 ****
--- 43,52 ----
  static char const *diffbin = DIFF_PROGRAM;
  static char const *edbin = DEFAULT_EDITOR;
  
+ static char	l_buf[]= "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n
";
+ static char	r_buf[]= ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
\n";
+ static char	sep_buf[]= "=====================================================
\n";
+ 
  static char *tmpname;
  static int volatile tmpmade;
  static pid_t volatile diffpid;
***************
*** 911,924 ****
  	  {
  	    FILE *tmp = ck_fopen (tmpname, "w+");
  
! 	    if (cmd1 == 'l' || cmd1 == 'b')
  	      lf_copy (left, lenl, tmp);
! 	    else
  	      lf_skip (left, lenl);
  
! 	    if (cmd1 == 'r' || cmd1 == 'b')
  	      lf_copy (right, lenr, tmp);
! 	    else
  	      lf_skip (right, lenr);
  
  	    ck_fflush (tmp);
--- 915,936 ----
  	  {
  	    FILE *tmp = ck_fopen (tmpname, "w+");
  
! 	    if (cmd1 == 'l' || cmd1 == 'b') { 
! 	    	if (cmd1 == 'b')
! 				ck_fwrite (l_buf, (sizeof(l_buf) -1), tmp);
  	      lf_copy (left, lenl, tmp);
! 		} else {
  	      lf_skip (left, lenl);
+ 		}
  
! 	    if (cmd1 == 'b') 
! 			ck_fwrite (sep_buf, (sizeof(sep_buf) -1), tmp);
! 
! 	    if (cmd1 == 'r' || cmd1 == 'b') {
  	      lf_copy (right, lenr, tmp);
! 	    	if (cmd1 == 'b')
! 				ck_fwrite (r_buf, (sizeof(r_buf) -1), tmp);
! 		} else
  	      lf_skip (right, lenr);
  
  	    ck_fflush (tmp);
***************
*** 999,1004 ****
--- 1011,1018 ----
  {
    for (;;)
      {
+ 	  static int lft_tot_ln = 1;	
+ 	  static int rht_tot_ln = 1;	
        char diff_help[256];
        int snarfed = lf_snarf (diff, diff_help, sizeof (diff_help));
  
***************
*** 1010,1017 ****
        switch (diff_help[0])
  	{
  	case ' ':
! 	  puts (diff_help + 1);
! 	  break;
  	case 'i':
  	  {
  	    int lenl = atoi (diff_help + 1), lenr, lenmax;
--- 1024,1037 ----
        switch (diff_help[0])
  	{
  	case ' ':
! 	  {
! 	    int lend = atoi (diff_help + 1);
! 
! 	    lft_tot_ln += lend;
! 	    rht_tot_ln += lend;
! 	    puts (diff_help + 1);
! 	    break;
! 	  }
  	case 'i':
  	  {
  	    int lenl = atoi (diff_help + 1), lenr, lenmax;
***************
*** 1022,1031 ****
  	    lenr = atoi (p + 1);
  	    lenmax = max (lenl, lenr);
  
  	    if (suppress_common_flag)
  	      lf_skip (diff, lenmax);
! 	    else
  	      lf_copy (diff, lenmax, stdout);
  
  	    lf_copy (left, lenl, outfile);
  	    lf_skip (right, lenr);
--- 1042,1058 ----
  	    lenr = atoi (p + 1);
  	    lenmax = max (lenl, lenr);
  
+ 
  	    if (suppress_common_flag)
  	      lf_skip (diff, lenmax);
! 	    else {
! 		  fprintf (stdout,"i%d,%d:%d\n", lft_tot_ln, rht_tot_ln, lenmax);
! 		  fflush (stdout);
  	      lf_copy (diff, lenmax, stdout);
+ 		}
+ 
+ 	  	lft_tot_ln += lenl;
+ 	    rht_tot_ln += lenr;
  
  	    lf_copy (left, lenl, outfile);
  	    lf_skip (right, lenr);
***************
*** 1033,1045 ****
  	  }
  	case 'c':
  	  {
! 	    int lenl = atoi (diff_help + 1), lenr;
  	    char *p = strchr (diff_help, ',');
  
  	    if (!p)
  	      fatal (diff_help);
  	    lenr = atoi (p + 1);
! 	    lf_copy (diff, max (lenl, lenr), stdout);
  	    if (! edit (left, lenl, right, lenr, outfile))
  	      return 0;
  	    break;
--- 1060,1080 ----
  	  }
  	case 'c':
  	  {
! 	    int lenl = atoi (diff_help + 1), lenr, lenmax;
  	    char *p = strchr (diff_help, ',');
  
  	    if (!p)
  	      fatal (diff_help);
  	    lenr = atoi (p + 1);
! 	    lenmax = max (lenl, lenr);
! 
! 		fprintf (stdout,"c%d,%d:%d\n", lft_tot_ln, rht_tot_ln, lenmax);
! 		fflush (stdout);
! 
! 	  	lft_tot_ln += lenl;
! 	    rht_tot_ln += lenr;
! 
! 	    lf_copy (diff, lenmax, stdout);
  	    if (! edit (left, lenl, right, lenr, outfile))
  	      return 0;
  	    break;




