[comp.sources.misc] v17i014: mfold - Maaniker's fold and column making, Patch02

smidt@fy.chalmers.se (Peter Smidt) (02/24/91)

Submitted-by: Peter Smidt <smidt@fy.chalmers.se>
Posting-number: Volume 17, Issue 14
Archive-name: mfold/patch02
Patch-To: mfold: Volume 15, Issue 82

This is a patch for mfold 1.05 to get 1.06. 
When the insert text (using the '-i' flag) is one character long the '-n' flag
won't work properly. It removes the empty lines, instead of keeping them.
This patch will make the above two flags work as they are expected to do,
together. ))

Peter
----
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  patch6.README patch6.mfold.c
# Wrapped by smidt@coco on Fri Feb 22 18:44:58 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patch6.README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch6.README'\"
else
echo shar: Extracting \"'patch6.README'\" \(464 characters\)
sed "s/^X//" >'patch6.README' <<'END_OF_FILE'
X*** README	Fri Feb 22 18:39:42 1991
X--- ../README	Fri Feb 22 18:35:13 1991
X***************
X*** 1,4 ****
X! Version 1.05, last change 9 february 1991.
X  
X  The program mfold is a simple folding and column making program.
X  unpack the files from the shar file put them in a empty
X--- 1,4 ----
X! Version 1.06, last change 22 february 1991.
X  
X  The program mfold is a simple folding and column making program.
X  unpack the files from the shar file put them in a empty
END_OF_FILE
if test 464 -ne `wc -c <'patch6.README'`; then
    echo shar: \"'patch6.README'\" unpacked with wrong size!
fi
# end of 'patch6.README'
fi
if test -f 'patch6.mfold.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch6.mfold.c'\"
else
echo shar: Extracting \"'patch6.mfold.c'\" \(1284 characters\)
sed "s/^X//" >'patch6.mfold.c' <<'END_OF_FILE'
X*** mfold.c	Fri Feb 22 18:40:32 1991
X--- ../mfold.c	Fri Feb 22 18:28:56 1991
X***************
X*** 250,259 ****
X--- 250,261 ----
X  		if ( in != '\n' ) {
X  			if ( cnt_nwl > 1 && got_newlines ) {
X  				while ( --cnt_nwl ) {
X+ 					set_putting_text(0);
X  					putcolu('\n');
X  					putcolu(' ');
X  				}
X  				putcolu('\n');
X+ 				set_putting_text(1);
X  				DO_ALL1
X  			}
X  			cnt_nwl = 0;
X***************
X*** 452,459 ****
X  	exit(t);
X  }
X  
X! int col = 0;
X  
X  putcolu(c)
X  char c;
X  {
X--- 454,465 ----
X  	exit(t);
X  }
X  
X! int col = 0, putting_text = 1;
X  
X+ set_putting_text(n) {
X+ 	putting_text = n;
X+ }
X+ 
X  putcolu(c)
X  char c;
X  {
X***************
X*** 460,472 ****
X  	int i;
X  
X  	if ( c == '\n' || col == colu_chars ) {
X! 		if ( c == '\n' && str_len(cur_page[lin]) == ins_len ) {
X  			for ( i = 0; i < ins_len; i++ ) {
X  				cur_page[lin][i] = '\0';
X  			}
X  			col = 0;
X  		}
X- 		if ( col ) advance_line();
X  		return;
X  	}
X  	cur_page[lin][col++] = c;
X--- 466,479 ----
X  	int i;
X  
X  	if ( c == '\n' || col == colu_chars ) {
X! 		if ( c == '\n' && putting_text && str_len(cur_page[lin]) == ins_len ) {
X  			for ( i = 0; i < ins_len; i++ ) {
X  				cur_page[lin][i] = '\0';
X  			}
X  			col = 0;
X+ 		} else {
X+ 			advance_line();
X  		}
X  		return;
X  	}
X  	cur_page[lin][col++] = c;
END_OF_FILE
if test 1284 -ne `wc -c <'patch6.mfold.c'`; then
    echo shar: \"'patch6.mfold.c'\" unpacked with wrong size!
fi
# end of 'patch6.mfold.c'
fi
echo shar: End of shell archive.
exit 0

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.