File: is_ws.c

package info (click to toggle)
bibutils 4.8-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,512 kB
  • ctags: 1,340
  • sloc: ansic: 72,394; csh: 216; makefile: 117
file content (35 lines) | stat: -rw-r--r-- 439 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * is_ws.c
 *
 * Copyright (c) Chris Putnam 2003-2009
 *
 * Source code released under the GPL
 *
 */
#include "is_ws.h"

/* is_ws(), is whitespace */
int 
is_ws( char ch )
{
	if (ch==' ' || ch=='\n' || ch=='\t' || ch=='\r' ) return 1;
	else return 0;
}

char *
skip_ws( char *p )
{
	if ( p ) {
		while ( is_ws( *p ) ) p++;
	}
	return p;
}

char *
skip_notws( char *p )
{
	if ( p ) {
		while ( *p && !is_ws( *p ) ) p++;
	}
	return p;
}