view sbr/trimcpy.c @ 17:76d91e545ea8 default tip

addrsbr and dtimep fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 24 Nov 2014 14:49:25 +0900
parents 441a2190cfae
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);
}