PATCH #1 to "colpr - yet another printer filter"
Chip Rosenthal
chip at vector.Dallas.TX.US
Sun Aug 27 19:37:21 AEST 1989
There is a nasty bug in "colpr". Two args to memset() are swapped. This
patch fixes that and also adds an "ISSPACE_NEEDS_ASCII" definition.
Define this if your isspace() needs to be qualified with isacsii().
Index: patch_history
*** patch_history~ Thu Aug 24 17:44:41 1989
--- patch_history Sat Aug 26 23:43:23 1989
***************
*** 0 ****
--- 1,9 ----
+ PATCHLEVEL 1
+
+ - Fixed misordered memset() parameters.
+
+ - Add ISSPACE_NEEDS_ASCII to qualify isspace() with isascii().
+
+ Thanks to: John Limpert <gronk!johnl at uunet.UU.NET>
+
+ @(#) patch_history 1.1 89/08/26 23:43:16
Prereq: 1.1
Index: colpr.c
*** colpr.c~ Thu Aug 24 17:51:02 1989
--- colpr.c Sun Aug 27 04:29:40 1989
***************
*** 1,7 ****
! /* @(#) colpr.c 1.1 89/08/23 22:58:01
*
* colpr - general printer output filter
*
* Wed Aug 23 22:17:46 1989 - Chip Rosenthal <chip at vector.Dallas.TX.US>
* Consolidation and cleanup for net release to alt.sources.
* Fri Dec 23 02:19:24 CST 1988 - C. Rosenthal (chip at vector.uucp)
--- 1,9 ----
! /* @(#) colpr.c 1.2 89/08/27 04:29:32
*
* colpr - general printer output filter
*
+ *Thu Aug 24 17:35:24 1989 - Chip Rosenthal <chip at vector.Dallas.TX.US>
+ * Fixed memset() argument order. Added ISSPACE_NEEDS_ASCII.
* Wed Aug 23 22:17:46 1989 - Chip Rosenthal <chip at vector.Dallas.TX.US>
* Consolidation and cleanup for net release to alt.sources.
* Fri Dec 23 02:19:24 CST 1988 - C. Rosenthal (chip at vector.uucp)
***************
*** 12,18 ****
#include <ctype.h>
#ifndef LINT
! static char SCCSID[] = "@(#) colpr.c 1.1 89/08/23 22:58:01";
#endif
#ifdef M_XENIX
--- 14,20 ----
#include <ctype.h>
#ifndef LINT
! static char SCCSID[] = "@(#) colpr.c 1.2 89/08/27 04:29:32";
#endif
#ifdef M_XENIX
***************
*** 22,27 ****
--- 24,32 ----
#define USAGE "usage: %s [-bng] [-t cols] [-f cols] [file ...]\n"
+ /*define NO_INLINE_NEXTCOL /* define to suppress Nextcol() macro */
+ /*define ISSPACE_NEEDS_ASCII /* define if isspace() arg must be ascii*/
+
#define BUFLEN 1024 /* maximum output line length */
#define MAXOVER 10 /* maximum number of overstrike passes */
#define TABSTOP 8 /* columns between tabstops */
***************
*** 29,36 ****
#define TRUE 1
#define FALSE 0
- /*define NO_INLINE_NEXTCOL /* define to suppress Nextcol() macro */
-
/*
* Macro to calculate next tabstop from current column. Will become a
--- 34,39 ----
***************
*** 79,84 ****
--- 82,94 ----
#endif
+ #ifdef ISSPACE_NEEDS_ASCII
+ # define Isspace(X) ( isascii(X) && isspace(X) )
+ #else
+ # define Isspace(X) isspace(X)
+ #endif
+
+
/*
* Global configuration settings.
*/
***************
*** 120,126 ****
/*
* Initialize.
*/
! Num_cols = BUFLEN+1; /* don't truncate or file */
Mode_output = NORMAL; /* don't truncate or fold */
Mode_backspace = FALSE; /* leave backspaces as is */
Mode_newline = FALSE; /* leave NL character as is */
--- 130,136 ----
/*
* Initialize.
*/
! Num_cols = BUFLEN+1; /* don't truncate or fold */
Mode_output = NORMAL; /* don't truncate or fold */
Mode_backspace = FALSE; /* leave backspaces as is */
Mode_newline = FALSE; /* leave NL character as is */
***************
*** 188,194 ****
/*
* Strip trailing spaces, tabs, and newline.
*/
! for ( c1 = bufp + strlen(bufp) - 1 ; c1 >= bufp && isspace(*c1) ; --c1 ) ;
*(c1+1) = '\0';
/*
--- 198,204 ----
/*
* Strip trailing spaces, tabs, and newline.
*/
! for ( c1 = bufp + strlen(bufp) - 1 ; c1 >= bufp && Isspace(*c1) ; --c1 ) ;
*(c1+1) = '\0';
/*
***************
*** 255,261 ****
/*
* Process non-printing, column movement characters.
*/
! if ( isspace(*bufp) || *bufp == '\b' ) {
col = Nextcol(col,*bufp);
continue;
}
--- 265,271 ----
/*
* Process non-printing, column movement characters.
*/
! if ( Isspace(*bufp) || *bufp == '\b' ) {
col = Nextcol(col,*bufp);
continue;
}
***************
*** 274,280 ****
*/
for ( i = 0 ; i < MAXOVER ; ++i ) {
while ( i >= bufused )
! (void) memset(Passbuf[++bufused],BUFLEN,' ');
if ( Passbuf[i][col] == ' ' )
break;
}
--- 284,290 ----
*/
for ( i = 0 ; i < MAXOVER ; ++i ) {
while ( i >= bufused )
! (void) memset(Passbuf[++bufused],' ',BUFLEN);
if ( Passbuf[i][col] == ' ' )
break;
}
--
Chip Rosenthal / chip at vector.Dallas.TX.US / Dallas Semiconductor / 214-450-5337
"I wish you'd put that starvation box down and go to bed" - Albert Collins' Mom
More information about the Alt.sources
mailing list