r6831@lvps87-230-33-50: verhaegs | 2008-02-03 14:08:57 +0100
[tangerine.git] / compiler / clib / stpblk.c
blob620c74e5c5af7591fecfe3f533d42cc878606074
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Supplemental C function stpblk().
6 */
8 #include <ctype.h>
10 /*****************************************************************************
12 NAME */
13 #include <string.h>
15 char * stpblk (
17 /* SYNOPSIS */
18 const char * str )
20 /* FUNCTION
21 Searches for the first non-blank character in a string. A blank
22 character is defined as one that isspace() treats like one
23 (ie. spaces, tabs and newlines).
25 INPUTS
26 str - String to search.
28 RESULT
29 A pointer to the first occurence of a non-blank character in str.
31 NOTES
32 This function always returns a valid pointer as provided str isn't
33 NULL. If there are no non-blank characters in the string, a pointer
34 to the trailing '\0' is returned (ie. an empty string).
36 EXAMPLE
37 char *hello = " Hello";
38 char *empty = " ";
40 printf( stpblk( hello ) );
41 --> Hello
43 printf( stpblk( empty ) );
44 -->
46 printf( "%d", strlen( stpblk( hello ) ) );
47 --> 5
49 printf( "%d", strlen( stpblk( empty ) ) );
50 --> 0
52 BUGS
54 SEE ALSO
55 isspace()
57 INTERNALS
59 ******************************************************************************/
61 if( str == NULL ) return NULL;
63 while( *str != '\0' && isspace( *str ) )
65 str++;
68 return (char *)str;
69 } /* stpblk */