2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
17 static char UNUSED id[] = "$Id: tool.c,v 1.1 2003/01/13 12:20:16 alex Exp $";
30 ngt_TrimStr( CHAR *String )
32 /* Mit ngt_TrimStr() werden fuehrende und folgende Leerzeichen,
33 * Tabulatoren und Zeilenumbrueche (ASCII 10 und ASCII 13) aus
34 * dem String entfernt. */
38 assert( String != NULL );
42 /* Zeichen am Anfang pruefen ... */
43 while(( *start == ' ' ) || ( *start == 9 )) start++;
45 /* Zeichen am Ende pruefen ... */
46 ptr = strchr( start, '\0' ) - 1;
47 while((( *ptr == ' ' ) || ( *ptr == 9 ) || ( *ptr == 10 ) || ( *ptr == 13 )) && ptr >= start ) ptr--;
50 memmove( String, start, strlen( start ) + 1 );
55 ngt_LowerStr( CHAR *String )
57 /* String in Kleinbuchstaben konvertieren. Der uebergebene
58 * Speicherbereich wird durch das Ergebnis ersetzt, zusaetzlich
59 * wird dieser auch als Pointer geliefert. */
63 assert( String != NULL );
65 /* Zeichen konvertieren */
69 *ptr = tolower( *ptr );