]> arthur.barton.de Git - ngircd-alex.git/commitdiff
fix ngt_TrimStr(), fix format string
authorFlorian Westphal <fw@strlen.de>
Fri, 24 Mar 2006 23:25:38 +0000 (23:25 +0000)
committerFlorian Westphal <fw@strlen.de>
Fri, 24 Mar 2006 23:25:38 +0000 (23:25 +0000)
src/ngircd/client.c
src/tool/tool.c

index b317b5beb0dcbb045aec7438fdb09602bbf758de..30e214c440c74f95a2b563e313884884ae9a3498 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "portab.h"
 
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: client.c,v 1.89 2006/03/11 10:43:49 fw Exp $";
+static char UNUSED id[] = "$Id: client.c,v 1.90 2006/03/24 23:25:38 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
 
 #include "imp.h"
 #include <assert.h>
@@ -321,11 +321,9 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
                                {
                                        if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
                                        else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
                                {
                                        if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
                                        else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
-                               }
-                               else
-                               {
-                                       if( c->id[0] ) Log( LOG_WARNING, "Unregistered unknown client \"%s\": %s", c->id, txt );
-                                       else Log( LOG_WARNING, "Unregistered unknown client: %s", c->id, txt );
+                               } else {
+                                       Log(LOG_WARNING, "Unregistered unknown client \"%s\": %s",
+                                                               c->id[0] ? c->id : "(No Nick)", txt );
                                }
                        }
 
                                }
                        }
 
index effa640da84ad625e73647d0b361c880e975fdcc..27051ced632cdc5e8280bb11f35c37a79b059082 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: tool.c,v 1.4 2006/03/22 08:05:10 alex Exp $";
+static char UNUSED id[] = "$Id: tool.c,v 1.5 2006/03/24 23:25:39 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
 
 #include "imp.h"
 #include <assert.h>
@@ -43,16 +43,21 @@ ngt_TrimStr(char *String)
        while (*start == ' ' || *start == '\t')
                start++;
 
        while (*start == ' ' || *start == '\t')
                start++;
 
+       if (!*start) {
+               *String = 0;
+               return;
+       }
        /* ... and at the end: */
        end = strchr(start, '\0');
        /* ... and at the end: */
        end = strchr(start, '\0');
+       end--;
        while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')
        while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')
-              && end >= start)
+              && end > start)
                end--;
 
        /* New trailing NULL byte */
        *(++end) = '\0';
 
                end--;
 
        /* New trailing NULL byte */
        *(++end) = '\0';
 
-       memmove(String, start, (size_t)(end - start));
+       memmove(String, start, (size_t)(end - start)+1);
 } /* ngt_TrimStr */
 
 
 } /* ngt_TrimStr */