1/**********************************************************************************
2 * .
3 *
4 *
5 **************************************************
6 * This code was created by Peter Harvey @ CodeByDesign.
7 * Released under LGPL 28.JAN.99
8 *
9 * Contributions from...
10 * -----------------------------------------------
11 * Peter Harvey - pharvey@codebydesign.com
12 **************************************************/
13
14#include <config.h>
15#include "ini.h"
16
17int iniAllTrim( char *pszString )
18{
19 int nForwardCursor = 0;
20 int nTrailingCursor = 0;
21 int bTrim = 1;
22
23 /* TRIM LEFT */
24 for ( nForwardCursor=0; pszString[nForwardCursor] != '\0'; nForwardCursor++ )
25 {
26 if ( bTrim && isspace( pszString[nForwardCursor] ) )
27 {
28 /* DO NOTHING */
29 }
30 else
31 {
32 bTrim = 0;
33 pszString[nTrailingCursor] = pszString[nForwardCursor];
34 nTrailingCursor++;
35 }
36 }
37 pszString[nTrailingCursor] = '\0';
38
39 /* TRIM RIGHT */
40 for ( nForwardCursor=strlen(pszString)-1;
41 nForwardCursor >= 0 && isspace( pszString[nForwardCursor] );
42 nForwardCursor-- )
43 {
44 }
45 pszString[nForwardCursor+1] = '\0';
46
47 return INI_SUCCESS;
48}
49
50
51