Removed incomplete file search tool. It was in "contrib"
[AROS-Contrib.git] / libini / iniAllTrim.c
blob042277a7f339f2bce306e5d1efdca21add1c2a82
1 /**********************************************************************************
2 * .
5 **************************************************
6 * This code was created by Peter Harvey @ CodeByDesign.
7 * Released under LGPL 28.JAN.99
9 * Contributions from...
10 * -----------------------------------------------
11 * Peter Harvey - pharvey@codebydesign.com
12 **************************************************/
14 #include "inifile_intern.h"
15 #include "ini.h"
16 #include <aros/libcall.h>
18 /*****************************************************************************
20 NAME */
21 AROS_LH1(int, iniAllTrim,
23 /* SYNOPSIS */
24 AROS_LHA(char *, pszString, A0),
26 /* LOCATION */
27 struct Library *, inifileBase, 8, inifile)
29 /* FUNCTION
31 INPUTS
33 RESULT
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 HISTORY
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 int nForwardCursor = 0;
52 int nTrailingCursor = 0;
53 int bTrim = 1;
55 /* TRIM LEFT */
56 for ( nForwardCursor=0; pszString[nForwardCursor] != '\0'; nForwardCursor++ )
58 if ( bTrim && isspace( pszString[nForwardCursor] ) )
60 /* DO NOTHING */
62 else
64 bTrim = 0;
65 pszString[nTrailingCursor] = pszString[nForwardCursor];
66 nTrailingCursor++;
69 pszString[nTrailingCursor] = '\0';
71 /* TRIM RIGHT */
72 for ( nForwardCursor=strlen(pszString)-1;
73 nForwardCursor >= 0 && isspace( pszString[nForwardCursor] );
74 nForwardCursor-- )
77 pszString[nForwardCursor+1] = '\0';
79 return INI_SUCCESS;
81 AROS_LIBFUNC_EXIT
82 } /* iniAllTrim */