X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ftrimcpy.c;h=f24563ce73e25ee045a4c79bcb87680eba93279d;hp=b640ea6f2bcbe7faebb6b131de2d51fad1a2e4fb;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hpb=f480c03187724e54e5391ee61b810827da319a6c diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index b640ea6..f24563c 100644 --- a/sbr/trimcpy.c +++ b/sbr/trimcpy.c @@ -1,4 +1,3 @@ - /* * trimcpy.c -- strip leading and trailing whitespace, * -- replace internal whitespace with spaces, @@ -15,26 +14,26 @@ char * trimcpy (unsigned char *cp) { - unsigned char *sp; - - /* skip over leading whitespace */ - while (isspace(*cp)) - cp++; - - /* start at the end and zap trailing whitespace */ - for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) { - if (isspace(*sp)) - *sp = '\0'; - else - break; - } - - /* replace remaining whitespace with spaces */ - for (sp = cp; *sp; sp++) { - if (isspace(*sp)) - *sp = ' '; - } - - /* now return a copy */ - return getcpy(cp); + unsigned char *sp; + + /* skip over leading whitespace */ + while (isspace(*cp)) + cp++; + + /* start at the end and zap trailing whitespace */ + for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) { + if (isspace(*sp)) + *sp = '\0'; + else + break; + } + + /* replace remaining whitespace with spaces */ + for (sp = cp; *sp; sp++) { + if (isspace(*sp)) + *sp = ' '; + } + + /* now return a copy */ + return getcpy(cp); }