DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦7076abeb9⟧ TextFile

    Length: 997 (0x3e5)
    Types: TextFile
    Names: »compress.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/util/compress.c« 

TextFile

/* compress: compress out redundant, & strip trailing linear white space */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/util/RCS/compress.c,v 5.0 90/09/20 16:17:05 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/util/RCS/compress.c,v 5.0 90/09/20 16:17:05 pp Exp Locker: pp $
 *
 * $Log:	compress.c,v $
 * Revision 5.0  90/09/20  16:17:05  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"


char *compress (fromptr, toptr)
register char   *fromptr;
register char   *toptr;
{
	register char   chr;
	char		*in_toptr = toptr;
	/*
	init to skip leading spaces
	*/
	chr = ' ';

	while ((*toptr = *fromptr++) != '\0') {
		/*
		convert newlines and tabs to only save first space
		*/
		if (isspace (*toptr)) {
			if (chr != ' ')
				*toptr++ = chr = ' ';
		}
		else
			chr = *toptr++;
	}


	/*
	remove trailing space if any
	*/
	if ((chr == ' ')
	    && (toptr != in_toptr))
		*--toptr = '\0';
	return (toptr);
}