]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/tool.c
- replaced a lot of strcpy() calls with strlcpy() which is more secure.
[ngircd-alex.git] / src / ngircd / tool.c
index c801ccfddde079e7bdf898ed8848fcae9a79a537..440fcb4b235a0a315bd44dea1ee28e40cf242b74 100644 (file)
@@ -2,23 +2,23 @@
  * ngIRCd -- The Next Generation IRC Daemon
  * 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 ngIRCd 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.7 2002/03/12 14:37:52 alex Exp $
- *
- * tool.c: Hilfsfunktionen, ggf. Platformabhaengig
+ * Tool functions
  */
 
 
 #include "portab.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>
 
@@ -26,7 +26,8 @@
 #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
@@ -50,4 +51,27 @@ GLOBAL VOID ngt_TrimStr( CHAR *String )
 } /* 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- */