[cvslog] (2002-07-09 05:41:06 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Tue Jul 9 00:42:01 CST 2002


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2002-07-09 05:41:06 UTC
Commited by: Jeff Fisher <guppy at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 src/botnet.c src/cmds.c src/dccutil.c src/patch.h
     src/users.c src/mod/irc.mod/cmdsirc.c

Log message:

the new handlen friendly patch --- please people w/ handlen > 9 test this :)

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.370 eggdrop1.6/doc/UPDATES1.6:1.371
--- eggdrop1.6/doc/UPDATES1.6:1.370	Tue Jul  9 00:37:22 2002
+++ eggdrop1.6/doc/UPDATES1.6	Tue Jul  9 00:40:55 2002
@@ -1,10 +1,12 @@
-$Id: UPDATES1.6,v 1.370 2002/07/09 05:37:22 guppy Exp $
+$Id: UPDATES1.6,v 1.371 2002/07/09 05:40:55 guppy Exp $
 
 Changes in Eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.11
 Found by  Fixed by  What...
+          Zart      added handlen friendly code to various commands (this is a new patch to
+                    replace the handlen friendly patch reverted in 1.6.10
           BarkerJr  don't show +inactive channels in a remote .who
           guppy     changed the .status output a bit (includes the name of the config file
                     now)
Index: eggdrop1.6/src/botnet.c
diff -u eggdrop1.6/src/botnet.c:1.42 eggdrop1.6/src/botnet.c:1.43
--- eggdrop1.6/src/botnet.c:1.42	Thu Mar 21 21:53:56 2002
+++ eggdrop1.6/src/botnet.c	Tue Jul  9 00:40:55 2002
@@ -7,7 +7,7 @@
  *   linking, unlinking, and relaying to another bot
  *   pinging the bots periodically and checking leaf status
  *
- * $Id: botnet.c,v 1.42 2002/03/22 03:53:56 guppy Exp $
+ * $Id: botnet.c,v 1.43 2002/07/09 05:40:55 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -31,7 +31,6 @@
 #include "main.h"
 #include "tandem.h"
 
-extern char		 spaces[], spaces2[];
 extern int		 dcc_total, backgrd, connect_timeout, max_dcc,
 			 egg_numver;
 extern struct userrec	*userlist;
@@ -430,8 +429,9 @@
  */
 void answer_local_whom(int idx, int chan)
 {
-  char c, idle[40], spaces2[33] = "                               ";
-  int i, len, len2, t, nicklen, botnicklen, total=0;
+  char format[81];
+  char c, idle[40];
+  int i, t, nicklen, botnicklen, total=0;
 
   if (chan == (-1))
     dprintf(idx, "%s (+: %s, *: %s)\n", BOT_BOTNETUSERS, BOT_PARTYLINE,
@@ -464,13 +464,12 @@
   if(nicklen < 9) nicklen = 9;
   if(botnicklen < 9) botnicklen = 9;
 
-  spaces[nicklen - 9] = 0;
-  spaces2[botnicklen - 9] = 0;
-  dprintf(idx, " Nick     %s   Bot      %s  Host\n", spaces, spaces2);
-  dprintf(idx, "----------%s   ---------%s  --------------------\n",
-	  spaces, spaces2);
-  spaces[nicklen - 9] = ' ';
-  spaces2[botnicklen - 9] = ' ';
+  snprintf(format, sizeof format, "%%-%us   %%-%us  %%s\n", 
+                                  nicklen, botnicklen);
+  dprintf(idx, format, " Nick", 	" Bot",      " Host");
+  dprintf(idx, format, "----------",	"---------", "--------------------");
+  snprintf(format, sizeof format, "%%c%%-%us %%c %%-%us  %%s%%s\n", 
+                                  nicklen, botnicklen);
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_CHAT) {
       if ((chan == (-1)) || ((chan >= 0) && (dcc[i].u.chat->channel == chan))) {
@@ -491,16 +490,11 @@
 	    sprintf(idle, " [idle %lum]", mins);
 	} else
 	  idle[0] = 0;
-	spaces[len = nicklen - strlen(dcc[i].nick)] = 0;
-	spaces2[len2 = botnicklen - strlen(botnetnick)] = 0;
         total++;
-	dprintf(idx, "%c%s%s %c %s%s  %s%s\n", c, dcc[i].nick, spaces,
+	dprintf(idx, format, c, dcc[i].nick, 
 		(dcc[i].u.chat->channel == 0) && (chan == (-1)) ? '+' :
 		(dcc[i].u.chat->channel > GLOBAL_CHANS) &&
-		(chan == (-1)) ? '*' : ' ',
-		botnetnick, spaces2, dcc[i].host, idle);
-	spaces[len] = ' ';
-	spaces2[len2] = ' ';
+		(chan == (-1)) ? '*' : ' ', botnetnick, dcc[i].host, idle);
 	if (dcc[i].u.chat->away != NULL)
 	  dprintf(idx, "   AWAY: %s\n", dcc[i].u.chat->away);
       }
@@ -526,14 +520,10 @@
 	  sprintf(idle, " [idle %lum]", mins);
       } else
 	idle[0] = 0;
-      spaces[len = nicklen - strlen(party[i].nick)] = 0;
-      spaces2[len2 = botnicklen - strlen(party[i].bot)] = 0;
       total++;
-      dprintf(idx, "%c%s%s %c %s%s  %s%s\n", c, party[i].nick, spaces,
+      dprintf(idx, format, c, party[i].nick, 
 	      (party[i].chan == 0) && (chan == (-1)) ? '+' : ' ',
-	      party[i].bot, spaces2, party[i].from, idle);
-      spaces[len] = ' ';
-      spaces2[len2] = ' ';
+	      party[i].bot, party[i].from, idle);
       if (party[i].status & PLSTAT_AWAY)
 	dprintf(idx, "   %s: %s\n", MISC_AWAY,
 		party[i].away ? party[i].away : "");
Index: eggdrop1.6/src/cmds.c
diff -u eggdrop1.6/src/cmds.c:1.80 eggdrop1.6/src/cmds.c:1.81
--- eggdrop1.6/src/cmds.c:1.80	Tue Mar 26 22:27:29 2002
+++ eggdrop1.6/src/cmds.c	Tue Jul  9 00:40:55 2002
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.80 2002/03/27 04:27:29 guppy Exp $
+ * $Id: cmds.c,v 1.81 2002/07/09 05:40:55 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -48,7 +48,7 @@
 			 itraffic_unknown, itraffic_unknown_today;
 extern Tcl_Interp	*interp;
 extern char		 botnetnick[], origbotname[], ver[], network[],
-			 owner[], spaces[], quit_msg[];
+			 owner[], quit_msg[];
 extern time_t		 now, online_since;
 extern module_entry	*module_list;
 
@@ -90,7 +90,9 @@
 
 static void tell_who(struct userrec *u, int idx, int chan)
 {
-  int i, k, ok = 0, atr = u ? u->flags : 0, len;
+  int i, k, ok = 0, atr = u ? u->flags : 0;
+  int nicklen;
+  char format[81];
   char s[1024];			/* temp fix - 1.4 has a better one */
 
   if (!chan)
@@ -111,20 +113,29 @@
 		       chan % GLOBAL_CHANS,
 		       MISC_OWNER, MISC_MASTER, MISC_OP);
   }
+
+  /* calculate max nicklen */
+  nicklen = 0;
+  for (i = 0; i < dcc_total; i++) {
+      if(strlen(dcc[i].nick) > nicklen)
+          nicklen = strlen(dcc[i].nick);
+  }
+  if(nicklen < 9) nicklen = 9;
+  
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_CHAT)
       if (dcc[i].u.chat->channel == chan) {
-	spaces[len = HANDLEN - strlen(dcc[i].nick)] = 0;
 	if (atr & USER_OWNER) {
-	  sprintf(s, "  [%.2lu]  %c%s%s %s",
+	  snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us %%s", nicklen);
+	  sprintf(s, format,
 		  dcc[i].sock, (geticon(i) == '-' ? ' ' : geticon(i)),
-		  dcc[i].nick, spaces, dcc[i].host);
+		  dcc[i].nick, dcc[i].host);
 	} else {
-	  sprintf(s, "  %c%s%s %s",
+	  snprintf(format, sizeof format, "  %%c%%-%us %%s", nicklen);
+	  sprintf(s, format,
 		  (geticon(i) == '-' ? ' ' : geticon(i)),
-		  dcc[i].nick, spaces, dcc[i].host);
+		  dcc[i].nick, dcc[i].host);
 	}
-	spaces[len] = ' ';
 	if (atr & USER_MASTER) {
 	  if (dcc[i].u.chat->con_flags)
 	    sprintf(&s[strlen(s)], " (con:%s)",
@@ -154,19 +165,20 @@
 	dprintf(idx, "Bots connected:\n");
       }
       egg_strftime(s, 14, "%d %b %H:%M", localtime(&dcc[i].timeval));
-      spaces[len = HANDLEN - strlen(dcc[i].nick)] = 0;
       if (atr & USER_OWNER) {
-	dprintf(idx, "  [%.2lu]  %s%c%s%s (%s) %s\n",
+        snprintf(format, sizeof format, "  [%%.2lu]  %%s%%c%%-%us (%%s) %%s\n", 
+			    nicklen);
+	dprintf(idx, format,
 		dcc[i].sock, dcc[i].status & STAT_CALLED ? "<-" : "->",
 		dcc[i].status & STAT_SHARE ? '+' : ' ',
-		dcc[i].nick, spaces, s, dcc[i].u.bot->version);
+		dcc[i].nick, s, dcc[i].u.bot->version);
       } else {
-	dprintf(idx, "  %s%c%s%s (%s) %s\n",
+        snprintf(format, sizeof format, "  %%s%%c%%-%us (%%s) %%s\n", nicklen);
+	dprintf(idx, format,
 		dcc[i].status & STAT_CALLED ? "<-" : "->",
 		dcc[i].status & STAT_SHARE ? '+' : ' ',
-		dcc[i].nick, spaces, s, dcc[i].u.bot->version);
+		dcc[i].nick, s, dcc[i].u.bot->version);
       }
-      spaces[len] = ' ';
     }
   ok = 0;
   for (i = 0; i < dcc_total; i++) {
@@ -175,18 +187,15 @@
 	ok = 1;
 	dprintf(idx, "Other people on the bot:\n");
       }
-      spaces[len = HANDLEN - strlen(dcc[i].nick)] = 0;
       if (atr & USER_OWNER) {
-	sprintf(s, "  [%.2lu]  %c%s%s ",
-		dcc[i].sock,
-		(geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick,
-		spaces);
+	snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us ", nicklen);
+	sprintf(s, format, dcc[i].sock,
+		(geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
       } else {
-	sprintf(s, "  %c%s%s ",
-		(geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick,
-		spaces);
+	snprintf(format, sizeof format, "  %%c%%-%us ", nicklen);
+	sprintf(s, format,
+		(geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
       }
-      spaces[len] = ' ';
       if (atr & USER_MASTER) {
 	if (dcc[i].u.chat->channel < 0)
 	  strcat(s, "(-OFF-) ");
@@ -218,17 +227,18 @@
 	ok = 1;
 	dprintf(idx, "Other people on the bot:\n");
       }
-      spaces[len = HANDLEN - strlen(dcc[i].nick)] = 0;
       if (atr & USER_OWNER) {
-	sprintf(s, "  [%.2lu]  %c%s%s (files) %s",
+	snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us (files) %%s", 
+				nicklen);
+	sprintf(s, format,
 		dcc[i].sock, dcc[i].status & STAT_CHAT ? '+' : ' ',
-		dcc[i].nick, spaces, dcc[i].host);
+		dcc[i].nick, dcc[i].host);
       } else {
-	sprintf(s, "  %c%s%s (files) %s",
+	snprintf(format, sizeof format, "  %%c%%-%us (files) %%s", nicklen);
+	sprintf(s, format,
 		dcc[i].status & STAT_CHAT ? '+' : ' ',
-		dcc[i].nick, spaces, dcc[i].host);
+		dcc[i].nick, dcc[i].host);
       }
-      spaces[len] = ' ';
       dprintf(idx, "%s\n", s);
     }
   }
Index: eggdrop1.6/src/dccutil.c
diff -u eggdrop1.6/src/dccutil.c:1.38 eggdrop1.6/src/dccutil.c:1.39
--- eggdrop1.6/src/dccutil.c:1.38	Tue Mar 26 22:27:29 2002
+++ eggdrop1.6/src/dccutil.c	Tue Jul  9 00:40:55 2002
@@ -6,7 +6,7 @@
  *   memory management for dcc structures
  *   timeout checking for dcc connections
  *
- * $Id: dccutil.c,v 1.38 2002/03/27 04:27:29 guppy Exp $
+ * $Id: dccutil.c,v 1.39 2002/07/09 05:40:55 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -36,7 +36,7 @@
 
 extern struct dcc_t	*dcc;
 extern int		 dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS;
-extern char		 botnetnick[], spaces[], version[];
+extern char		 botnetnick[], version[];
 extern time_t		 now;
 extern sock_list	*socklist;
 extern Tcl_Interp	*interp;
@@ -314,15 +314,27 @@
  */
 void tell_dcc(int zidx)
 {
-  int i, j, k;
+  int i, j;
   char other[160];
+  char format[81];
+  int nicklen;
+
+  /* calculate max nicklen */
+  nicklen = 0;
+  for (i = 0; i < dcc_total; i++) {
+      if(strlen(dcc[i].nick) > nicklen)
+          nicklen = strlen(dcc[i].nick);
+  }
+  if(nicklen < 9) nicklen = 9;
+  
+  snprintf(format, sizeof format, "%%-4s %%-8s %%-5s %%-%us %%-17s %%s\n", 
+                          nicklen);
+  dprintf(zidx, format, "SOCK", "ADDR",     "PORT",  "NICK", "HOST", "TYPE");
+  dprintf(zidx, format, "----", "--------", "-----", "---------", 
+                        "-----------------", "----");
 
-  spaces[HANDLEN - 9] = 0;
-  dprintf(zidx, "SOCK ADDR     PORT  NICK     %s HOST              TYPE\n"
-	  ,spaces);
-  dprintf(zidx, "---- -------- ----- ---------%s ----------------- ----\n"
-	  ,spaces);
-  spaces[HANDLEN - 9] = ' ';
+  snprintf(format, sizeof format, "%%-4d %%08X %%5d %%-%us %%-17s %%s\n", 
+                          nicklen);
   /* Show server */
   for (i = 0; i < dcc_total; i++) {
     j = strlen(dcc[i].host);
@@ -336,11 +348,8 @@
       sprintf(other, "?:%lX  !! ERROR !!", (long) dcc[i].type);
       break;
     }
-    k = HANDLEN - strlen(dcc[i].nick);
-    spaces[k] = 0;
-    dprintf(zidx, "%-4d %08X %5d %s%s %-17s %s\n", dcc[i].sock, dcc[i].addr,
-	    dcc[i].port, dcc[i].nick, spaces, dcc[i].host + j, other);
-    spaces[k] = ' ';
+    dprintf(zidx, format, dcc[i].sock, dcc[i].addr, dcc[i].port, dcc[i].nick, 
+			  dcc[i].host + j, other);
   }
 }
 
Index: eggdrop1.6/src/mod/irc.mod/cmdsirc.c
diff -u eggdrop1.6/src/mod/irc.mod/cmdsirc.c:1.34 eggdrop1.6/src/mod/irc.mod/cmdsirc.c:1.35
--- eggdrop1.6/src/mod/irc.mod/cmdsirc.c:1.34	Thu Jun 13 15:43:08 2002
+++ eggdrop1.6/src/mod/irc.mod/cmdsirc.c	Tue Jul  9 00:40:56 2002
@@ -2,7 +2,7 @@
  * chancmds.c -- part of irc.mod
  *   handles commands directly relating to channel interaction
  *
- * $Id: cmdsirc.c,v 1.34 2002/06/13 20:43:08 wcc Exp $
+ * $Id: cmdsirc.c,v 1.35 2002/07/09 05:40:56 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -646,9 +646,8 @@
        *chname;
   struct chanset_t *chan;
   memberlist *m;
-  static char spaces[33] = "                              ";
-  static char spaces2[33] = "                              ";
-  int len, len2;
+  int maxnicklen, maxhandlen;
+  char format[81];
 
   if (!has_oporhalfop(idx, par))
     return;
@@ -675,13 +674,22 @@
   if (chan->channel.topic)
     dprintf(idx, "%s: %s\n", IRC_CHANNELTOPIC, chan->channel.topic);
   if (channel_active(chan)) {
+    /* find max nicklen and handlen */
+    maxnicklen = maxhandlen = 0;
+    for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+	if(strlen(m->nick) > maxnicklen)
+	    maxnicklen = strlen(m->nick);
+	if(m->user)
+	    if(strlen(m->user->handle) > maxhandlen)
+		maxhandlen = strlen(m->user->handle);
+    }
+    if(maxnicklen < 9) maxnicklen = 9;
+    if(maxhandlen < 9) maxhandlen = 9;
+    
     dprintf(idx, "(n = owner, m = master, o = op, d = deop, b = bot)\n");
-    spaces[nick_len - 9] = 0;
-    spaces2[HANDLEN - 9] = 0;
-    dprintf(idx, " NICKNAME %s HANDLE   %s JOIN   IDLE  USER at HOST\n",
-	    spaces, spaces2);
-    spaces[nick_len - 9] = ' ';
-    spaces2[HANDLEN - 9] = ' ';
+    snprintf(format, sizeof format, " %%-%us %%-%us %%-6s %%-5s %%s\n", 
+			maxnicklen, maxhandlen);
+    dprintf(idx, format, "NICKNAME", "HANDLE", " JOIN", "IDLE", "USER at HOST");
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
       if (m->joined > 0) {
 	if ((now - (m->joined)) > 86400)
@@ -775,16 +783,18 @@
 	chanflag = '+';
       else
 	chanflag = ' ';
-      spaces[len = (nick_len - strlen(m->nick))] = 0;
-      spaces2[len2 = (HANDLEN - strlen(handle))] = 0;
-      if (chan_issplit(m))
-	dprintf(idx, "%c%s%s %s%s %s %c     <- netsplit, %lus\n", chanflag,
-		m->nick, spaces, handle, spaces2, s, atrflag,
+      if (chan_issplit(m)) {
+        snprintf(format, sizeof format, 
+			"%%c%%-%us %%-%us %%s %%c     <- netsplit, %%lus\n", 
+			maxnicklen, maxhandlen);
+	dprintf(idx, format, chanflag, m->nick, handle, s, atrflag,
 		now - (m->split));
-      else if (!rfc_casecmp(m->nick, botname))
-	dprintf(idx, "%c%s%s %s%s %s %c     <- it's me!\n", chanflag, m->nick,
-		spaces, handle, spaces2, s, atrflag);
-      else {
+      } else if (!rfc_casecmp(m->nick, botname)) {
+        snprintf(format, sizeof format, 
+			"%%c%%-%us %%-%us %%s %%c     <- it's me!\n", 
+			maxnicklen, maxhandlen);
+	dprintf(idx, format, chanflag, m->nick, handle, s, atrflag);
+      } else {
 	/* Determine idle time */
 	if (now - (m->last) > 86400)
 	  egg_snprintf(s1, sizeof s1, "%2lud", ((now - (m->last)) / 86400));
@@ -794,11 +804,11 @@
 	  egg_snprintf(s1, sizeof s1, "%2lum", ((now - (m->last)) / 60));
 	else
 	  strncpyz(s1, "   ", sizeof s1);
-	dprintf(idx, "%c%s%s %s%s %s %c %s  %s\n", chanflag, m->nick,
-		spaces, handle, spaces2, s, atrflag, s1, m->userhost);
+	snprintf(format, sizeof format, "%%c%%-%us %%-%us %%s %%c %%s  %%s\n", 
+			maxnicklen, maxhandlen);
+	dprintf(idx, format, chanflag, m->nick,	handle, s, atrflag, s1, 
+		    m->userhost);
       }
-      spaces[len] = ' ';
-      spaces2[len2] = ' ';
       if (chan_fakeop(m))
 	dprintf(idx, "    (%s)\n", IRC_FAKECHANOP);
       if (chan_sentop(m))
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.771 eggdrop1.6/src/patch.h:1.772
--- eggdrop1.6/src/patch.h:1.771	Tue Jul  9 00:37:22 2002
+++ eggdrop1.6/src/patch.h	Tue Jul  9 00:40:55 2002
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.771 2002/07/09 05:37:22 guppy Exp $
+ * $Id: patch.h,v 1.772 2002/07/09 05:40:55 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1026193114");		/* current unixtime */
+patch("1026193319");		/* current unixtime */
 /*
  *
  *
  */
-patch("whochaninactive");
+patch("handlen-friendly2");
 /*
  *
  *
Index: eggdrop1.6/src/users.c
diff -u eggdrop1.6/src/users.c:1.33 eggdrop1.6/src/users.c:1.34
--- eggdrop1.6/src/users.c:1.33	Tue Mar 26 22:27:29 2002
+++ eggdrop1.6/src/users.c	Tue Jul  9 00:40:55 2002
@@ -10,7 +10,7 @@
  *
  * dprintf'ized, 9nov1995
  *
- * $Id: users.c,v 1.33 2002/03/27 04:27:29 guppy Exp $
+ * $Id: users.c,v 1.34 2002/07/09 05:40:55 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,8 +40,6 @@
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
-char spaces[33] = "                                 ";
-char spaces2[33] = "                                 ";
 
 extern struct dcc_t *dcc;
 extern struct userrec *userlist, *lastuser;
@@ -474,7 +472,8 @@
 void tell_user(int idx, struct userrec *u, int master)
 {
   char s[81], s1[81];
-  int n, l = HANDLEN - strlen(u->handle);
+  char format[81];
+  int n;
   time_t now2;
   struct chanuserrec *ch;
   struct user_entry *ue;
@@ -498,11 +497,11 @@
     else
       egg_strftime(s1, 6, "%H:%M", localtime(&li->laston));
   }
-  spaces[l] = 0;
-  dprintf(idx, "%s%s %-5s%5d %-15s %s (%-10.10s)\n", u->handle, spaces,
+  snprintf(format, sizeof format, "%%-%us %%-5s%%5d %%-15s %%s (%%-10.10s)\n", 
+                          HANDLEN);
+  dprintf(idx, format, u->handle, 
 	  get_user(&USERENTRY_PASS, u) ? "yes" : "no", n, s, s1,
 	  (li && li->lastonplace) ? li->lastonplace : "nowhere");
-  spaces[l] = ' ';
   /* channel flags? */
   for (ch = u->chanrec; ch; ch = ch->next) {
     fr.match = FR_CHAN | FR_GLOBAL;
@@ -521,9 +520,8 @@
       fr.chan = ch->flags;
       fr.udef_chan = ch->flags_udef;
       build_flags(s, &fr, NULL);
-      spaces[HANDLEN - 9] = 0;
-      dprintf(idx, "%s  %-18s %-15s %s\n", spaces, ch->channel, s, s1);
-      spaces[HANDLEN - 9] = ' ';
+      snprintf(format, sizeof format, "%%%us  %%-18s %%-15s %%s\n", HANDLEN-9);
+      dprintf(idx, format, " ", ch->channel, s, s1);
       if (ch->info != NULL)
 	dprintf(idx, "    INFO: %s\n", ch->info);
     }
@@ -537,6 +535,7 @@
 /* show user by ident */
 void tell_user_ident(int idx, char *id, int master)
 {
+  char format[81];
   struct userrec *u;
 
   u = get_user_by_handle(userlist, id);
@@ -546,9 +545,9 @@
     dprintf(idx, "%s.\n", USERF_NOMATCH);
     return;
   }
-  spaces[HANDLEN - 6] = 0;
-  dprintf(idx, "HANDLE%s PASS NOTES FLAGS           LAST\n", spaces);
-  spaces[HANDLEN - 6] = ' ';
+  snprintf(format, sizeof format, "%%-%us PASS NOTES FLAGS           LAST\n", 
+                          HANDLEN);
+  dprintf(idx, format, "HANDLE");
   tell_user(idx, u, master);
 }
 
@@ -558,6 +557,7 @@
 void tell_users_match(int idx, char *mtch, int start, int limit,
 		      int master, char *chname)
 {
+  char format[81];
   struct userrec *u;
   int fnd = 0, cnt, nomns = 0, flags = 0;
   struct list_type *q;
@@ -565,9 +565,9 @@
 
   dprintf(idx, "*** %s '%s':\n", MISC_MATCHING, mtch);
   cnt = 0;
-  spaces[HANDLEN - 6] = 0;
-  dprintf(idx, "HANDLE%s PASS NOTES FLAGS           LAST\n", spaces);
-  spaces[HANDLEN - 6] = ' ';
+  snprintf(format, sizeof format, "%%-%us PASS NOTES FLAGS           LAST\n", 
+                      HANDLEN);
+  dprintf(idx, format, "HANDLE");
   if (start > 1)
     dprintf(idx, "(%s %d)\n", MISC_SKIPPING, start - 1);
   if (strchr("+-&|", *mtch)) {
----------------------- End of diff -----------------------



More information about the Changes mailing list