]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/tool.c
- New functions Channel_[Set]Key(), Channel_[Set]MaxUsers.
[ngircd-alex.git] / src / ngircd / tool.c
index f7daea1df2c5a16fffe11ba861ac4c7337b7aefc..440fcb4b235a0a315bd44dea1ee28e40cf242b74 100644 (file)
@@ -1,43 +1,33 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
  *
- * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
- * der GNU General Public License (GPL), wie von der Free Software Foundation
- * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
- * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
- * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
- * der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: tool.c,v 1.3 2001/12/29 03:05:34 alex Exp $
- *
- * tool.c: Hilfsfunktionen, ggf. Platformabhaengig
- *
- * $Log: tool.c,v $
- * Revision 1.3  2001/12/29 03:05:34  alex
- * - Funktionsnamen etwas konsequenter umbenannt :-)
- *
- * Revision 1.2  2001/12/12 17:20:33  alex
- * - Tool-Funktionen haben nun das Praefix "ngt_".
- *
- * Revision 1.1.1.1  2001/12/11 21:53:04  alex
- * - Imported sources to CVS.
+ * Tool functions
  */
 
 
-#include <portab.h>
-#include "global.h"
+#include "portab.h"
 
-#include <imp.h>
+static char UNUSED id[] = "$Id: tool.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
+
+#include "imp.h"
 #include <assert.h>
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 
-#include <exp.h>
+#include "exp.h"
 #include "tool.h"
 
 
-GLOBAL VOID ngt_TrimStr( CHAR *String )
+GLOBAL VOID
+ngt_TrimStr( CHAR *String )
 {
        /* Mit ngt_TrimStr() werden fuehrende und folgende Leerzeichen,
         * Tabulatoren und Zeilenumbrueche (ASCII 10 und ASCII 13) aus
@@ -54,11 +44,34 @@ GLOBAL VOID ngt_TrimStr( CHAR *String )
        
        /* Zeichen am Ende pruefen ... */
        ptr = strchr( start, '\0' ) - 1;
-       while(( *ptr == ' ' ) || ( *ptr == 9 ) || ( *ptr == 10 ) || ( *ptr == 13 )) ptr--;
+       while((( *ptr == ' ' ) || ( *ptr == 9 ) || ( *ptr == 10 ) || ( *ptr == 13 )) && ptr >= start ) ptr--;
        *(++ptr) = '\0';
 
        memmove( String, start, strlen( start ) + 1 );
 } /* ngt_TrimStr */
 
 
+GLOBAL CHAR *
+ngt_LowerStr( CHAR *String )
+{
+       /* String in Kleinbuchstaben konvertieren. Der uebergebene
+        * Speicherbereich wird durch das Ergebnis ersetzt, zusaetzlich
+        * wird dieser auch als Pointer geliefert. */
+
+       CHAR *ptr;
+
+       assert( String != NULL );
+
+       /* Zeichen konvertieren */
+       ptr = String;
+       while( *ptr )
+       {
+               *ptr = tolower( *ptr );
+               ptr++;
+       }
+       
+       return String;
+} /* ngt_LowerStr */
+
+
 /* -eof- */