home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
XGRP_000.SZH
/
STRIPS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-15
|
1KB
|
62 lines
#include <string.h>
#include <ctype.h>
#include "nofast.h"
char * _fastcall rstrip (char *a) { /* Remove trailing spaces and tabs */
register int x;
x=strlen(a);
while (x && a && (a[x-1]==' ' || a[x-1]=='\t')) a[--x]=0;
return a;
}
char * _fastcall lstrip (char *a) { /* Remove leading spaces and tabs */
register int x;
x=strlen(a);
while (x && (*a==' ' || *a=='\t')) memmove (a,(a+1),x--);
return (a);
}
char * _fastcall stripcr (char *a) { /* Remove trailing crs and lfs */
register int x;
x=strlen(a);
while (x && (a[x-1]=='\n' || a[x-1]=='\r')) a[--x]=0;
return a;
}
char * _fastcall strip_trail_bksl (char *a) { /* Remove trailing slashes */
register int x;
int y;
/* note: this maintains the backslash instead of the slash so that
system calls (through CMD.EXE or COMMAND.COM) are 'guaranteed'
to work. */
x = strlen(a);
y = 0;
while(y < x) {
if(a[y] == '/') a[y] = '\\';
y++;
}
while(x && (a[x - 1] == '\\')) a[--x]=0;
return a;
}