summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/diff/side.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-10-28 18:51:33 +0000
committerpeter <peter@FreeBSD.org>1995-10-28 18:51:33 +0000
commit27378b5694b4941bb63a62097f7ee523da0a35bb (patch)
tree9372a0168d8ef1138d4ec4ef2051198caed461de /gnu/usr.bin/diff/side.c
parent31fbfe9bebb8e48eaf39efc88875c743cf238ced (diff)
downloadFreeBSD-src-27378b5694b4941bb63a62097f7ee523da0a35bb.zip
FreeBSD-src-27378b5694b4941bb63a62097f7ee523da0a35bb.tar.gz
Import GNU diffutils 2.7
Note, this is going to be messy.. 2.3 was vendor-branch imported, while 2.6 was done as a delta. Sigh. I'm importing this on a vendor branch so that it will be easier to deal with next time.. (cvs-1.6 wants rcs-5.7, and rcs-5.7 suggests diffutils-2.7)
Diffstat (limited to 'gnu/usr.bin/diff/side.c')
-rw-r--r--gnu/usr.bin/diff/side.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/gnu/usr.bin/diff/side.c b/gnu/usr.bin/diff/side.c
index a3d6d8b..a150b5e 100644
--- a/gnu/usr.bin/diff/side.c
+++ b/gnu/usr.bin/diff/side.c
@@ -21,10 +21,11 @@ and this notice must be preserved on all copies. */
#include "diff.h"
-
-static void print_sdiff_hunk ();
-static void print_sdiff_common_lines ();
-static void print_1sdiff_line ();
+static unsigned print_half_line PARAMS((char const * const *, unsigned, unsigned));
+static unsigned tab_from_to PARAMS((unsigned, unsigned));
+static void print_1sdiff_line PARAMS((char const * const *, int, char const * const *));
+static void print_sdiff_common_lines PARAMS((int, int));
+static void print_sdiff_hunk PARAMS((struct change *));
/* Next line number to be printed in the two input files. */
static int next0, next1;
@@ -70,12 +71,12 @@ tab_from_to (from, to)
*/
static unsigned
print_half_line (line, indent, out_bound)
- const char * const *line;
+ char const * const *line;
unsigned indent, out_bound;
{
FILE *out = outfile;
register unsigned in_position = 0, out_position = 0;
- register const char
+ register char const
*text_pointer = line[0],
*text_limit = line[1];
@@ -132,21 +133,21 @@ print_half_line (line, indent, out_bound)
case '\f':
case '\v':
+ control_char:
if (in_position < out_bound)
putc (c, out);
break;
default:
- {
- register unsigned p = in_position;
- if (textchar[c])
- in_position++;
- if (p < out_bound)
- {
- out_position = in_position;
- putc (c, out);
- }
- }
+ if (! ISPRINT (c))
+ goto control_char;
+ /* falls through */
+ case ' ':
+ if (in_position++ < out_bound)
+ {
+ out_position = in_position;
+ putc (c, out);
+ }
break;
case '\n':
@@ -159,21 +160,21 @@ print_half_line (line, indent, out_bound)
/*
* Print side by side lines with a separator in the middle.
- * NULL parameters are taken to indicate whitespace text.
+ * 0 parameters are taken to indicate white space text.
* Blank lines that can easily be caught are reduced to a single newline.
*/
static void
print_1sdiff_line (left, sep, right)
- const char * const *left;
+ char const * const *left;
int sep;
- const char * const *right;
+ char const * const *right;
{
FILE *out = outfile;
unsigned hw = sdiff_half_width, c2o = sdiff_column2_offset;
unsigned col = 0;
int put_newline = 0;
-
+
if (left)
{
if (left[1][-1] == '\n')
OpenPOWER on IntegriCloud