view sbr/trimcpy.c @ 12:441a2190cfae

Lion fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 21 Apr 2012 13:10:49 +0900
parents bce86c4163a3
children
line wrap: on
line source

/* trimcpy.c - strip [lt]wsp and replace newlines with spaces */
#ifndef       lint
static char ident[] = "@(#)$Id: trimcpy.c,v 1.1.1.1 2005/04/18 14:46:06 kono Exp $";
#endif	/*        lint */


#include "../h/mh.h"
#include <ctype.h>
#include <stdio.h>


char *trimcpy (cp)
register char *cp;
{
    register char  *sp;

    while (isspace (*cp & 0xff))
	cp++;
    for (sp = cp + strlen (cp) - 1; sp >= cp; sp--)
	if (isspace (*sp & 0xff))
	    *sp = 0;
	else
	    break;
    for (sp = cp; *sp; sp++)
	if (isspace (*sp & 0xff))
	    *sp = ' ';

    return getcpy (cp);
}