Преглед на файлове

* Cleaned up shadowing variables

svn: 978
Bryan Drewery преди 22 години
родител
ревизия
3ae6e42a2d
променени са 16 файла, в които са добавени 171 реда и са изтрити 176 реда
  1. 15 15
      src/botcmd.c
  2. 5 5
      src/botmsg.c
  3. 15 15
      src/botnet.c
  4. 15 15
      src/cmds.c
  5. 10 13
      src/conf.c
  6. 0 2
      src/dcc.c
  7. 1 1
      src/debug.c
  8. 25 25
      src/misc.c
  9. 6 6
      src/mod/irc.mod/chan.c
  10. 1 1
      src/mod/irc.mod/irc.c
  11. 4 4
      src/mod/irc.mod/irc.h
  12. 3 3
      src/mod/irc.mod/mode.c
  13. 2 2
      src/net.c
  14. 61 61
      src/shell.c
  15. 5 5
      src/userent.c
  16. 3 3
      src/userrec.c

+ 15 - 15
src/botcmd.c

@@ -387,13 +387,13 @@ static void remote_tell_who(int idx, char *nick, int chan)
 	k = sprintf(s, "  %c%-15s %s", (geticon(i) == '-' ? ' ' : geticon(i)),
 		    dcc[i].nick, dcc[i].host);
 	if (now - dcc[i].timeval > 300) {
-	  unsigned long days, hrs, mins;
+	  unsigned long mydays, hrs, mins;
 
-	  days = (now - dcc[i].timeval) / 86400;
-	  hrs = ((now - dcc[i].timeval) - (days * 86400)) / 3600;
+	  mydays = (now - dcc[i].timeval) / 86400;
+	  hrs = ((now - dcc[i].timeval) - (mydays * 86400)) / 3600;
 	  mins = ((now - dcc[i].timeval) - (hrs * 3600)) / 60;
-	  if (days > 0)
-	    sprintf(s + k, " (%s %lud%luh)", MISC_IDLE, days, hrs);
+	  if (mydays > 0)
+	    sprintf(s + k, " (%s %lud%luh)", MISC_IDLE, mydays, hrs);
 	  else if (hrs > 0)
 	    sprintf(s + k, " (%s %luh%lum)", MISC_IDLE, hrs, mins);
 	  else
@@ -502,14 +502,14 @@ static void bot_infoq(int idx, char *par)
   now2 = now - online_since;
   s2[0] = 0;
   if (now2 > 86400) {
-    int days = now2 / 86400;
+    int mydays = now2 / 86400;
 
     /* Days */
-    sprintf(s2, "%d day", days);
-    if (days >= 2)
+    sprintf(s2, "%d day", mydays);
+    if (mydays >= 2)
       strcat(s2, "s");
     strcat(s2, ", ");
-    now2 -= days * 86400;
+    now2 -= mydays * 86400;
   }
   hr = (time_t) ((int) now2 / 3600);
   now2 -= (hr * 3600);
@@ -786,7 +786,7 @@ static void bot_traced(int idx, char *par)
   }
   if (!egg_strcasecmp(p, conf.bot->nick)) {
     time_t t = 0;
-    char *p = par, *ss = TBUF;
+    char *p2 = par, *ss = TBUF;
 
     splitc(ss, to, ':');
     if (ss[0])
@@ -795,11 +795,11 @@ static void bot_traced(int idx, char *par)
       sock = (-1);
     if (par[0] == ':') {
       t = atoi(par + 1);
-      p = strchr(par + 1, ':');
-      if (p)
-	p++;
+      p2 = strchr(par + 1, ':');
+      if (p2)
+	p2++;
       else
-	p = par + 1;
+	p2 = par + 1;
     }
     for (i = 0; i < dcc_total; i++)
       if ((dcc[i].type->flags & DCT_CHAT) &&
@@ -811,7 +811,7 @@ static void bot_traced(int idx, char *par)
             register char *c=p;
             for (; *c != '\0'; c++) if (*c == ':') j++;
           }
-         dprintf(i, "%s -> %s (%lu secs, %d hop%s)\n", BOT_TRACERESULT, p,
+         dprintf(i, "%s -> %s (%lu secs, %d hop%s)\n", BOT_TRACERESULT, p2,
             now - t, j, (j != 1) ? "s" : "");
 	} else
 	  dprintf(i, "%s -> %s\n", BOT_TRACERESULT, p);

+ 5 - 5
src/botmsg.c

@@ -642,16 +642,16 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
 	  status = NOTE_AWAY;
 	}
       if (aok) {
-	char *p = NULL, *fr = from;
+	char *p2 = NULL, *fr = from;
 	int l = 0;
 	char work[1024] = "";
 
 	while ((*msg == '<') || (*msg == '>')) {
-	  p = newsplit(&msg);
-	  if (*p == '<')
-	    l += simple_sprintf(work + l, "via %s, ", p + 1);
+	  p2 = newsplit(&msg);
+	  if (*p2 == '<')
+	    l += simple_sprintf(work + l, "via %s, ", p2 + 1);
 	  else if (*from == '@')
-	    fr = p + 1;
+	    fr = p2 + 1;
 	}
 	if (idx == -2 || (!egg_strcasecmp(from, conf.bot->nick)))
 	  dprintf(i, "*** [%s] %s%s\n", fr, l ? work : "", msg);

+ 15 - 15
src/botnet.c

@@ -380,7 +380,7 @@ void unvia(int idx, tand_t * who)
 void besthub(char *hub)
 {
   tand_t *ptr = tandbot;
-  struct userrec *u = NULL, *besthub = NULL;
+  struct userrec *u = NULL, *besthubu = NULL;
   char bestlval[20] = "", lval[20] = "";
 
   hub[0] = 0;
@@ -391,13 +391,13 @@ void besthub(char *hub)
       link_pref_val(u, lval);
       if (strcmp(lval, bestlval) < 0) {
         strcpy(bestlval, lval);
-        besthub = u;
+        besthubu = u;
       }
     }
     ptr = ptr->next;
   }
-  if (besthub)
-    strcpy(hub, besthub->handle);
+  if (besthubu)
+    strcpy(hub, besthubu->handle);
   return;
 }
 
@@ -484,13 +484,13 @@ void answer_local_whom(int idx, int chan)
 	if (c == '-')
 	  c = ' ';
 	if (now - dcc[i].timeval > 300) {
-	  unsigned long days, hrs, mins;
+	  unsigned long mydays, hrs, mins;
 
-	  days = (now - dcc[i].timeval) / 86400;
-	  hrs = ((now - dcc[i].timeval) - (days * 86400)) / 3600;
+	  mydays = (now - dcc[i].timeval) / 86400;
+	  hrs = ((now - dcc[i].timeval) - (mydays * 86400)) / 3600;
 	  mins = ((now - dcc[i].timeval) - (hrs * 3600)) / 60;
-	  if (days > 0)
-	    sprintf(idle, " [idle %lud%luh]", days, hrs);
+	  if (mydays > 0)
+	    sprintf(idle, " [idle %lud%luh]", mydays, hrs);
 	  else if (hrs > 0)
 	    sprintf(idle, " [idle %luh%lum]", hrs, mins);
 	  else
@@ -519,13 +519,13 @@ void answer_local_whom(int idx, int chan)
       if (party[i].timer == 0L)
 	strcpy(idle, " [idle?]");
       else if (now - party[i].timer > 300) {
-	unsigned long days, hrs, mins;
+	unsigned long mydays, hrs, mins;
 
-	days = (now - party[i].timer) / 86400;
-	hrs = ((now - party[i].timer) - (days * 86400)) / 3600;
+	mydays = (now - party[i].timer) / 86400;
+	hrs = ((now - party[i].timer) - (mydays * 86400)) / 3600;
 	mins = ((now - party[i].timer) - (hrs * 3600)) / 60;
-	if (days > 0)
-	  sprintf(idle, " [idle %lud%luh]", days, hrs);
+	if (mydays > 0)
+	  sprintf(idle, " [idle %lud%luh]", mydays, hrs);
 	else if (hrs > 0)
 	  sprintf(idle, " [idle %luh%lum]", hrs, mins);
 	else
@@ -1618,7 +1618,7 @@ void check_botnet_pings()
   }
   for (i = 0; i < dcc_total; i++) {
     if ((dcc[i].type == &DCC_BOT) && (dcc[i].status & STAT_LEAF)) {
-      tand_t *bot, *via = findbot(dcc[i].nick);
+      tand_t *via = findbot(dcc[i].nick);
 
       for (bot = tandbot; bot; bot = bot->next) {
 	if ((via == bot->via) && (bot != via)) {

+ 15 - 15
src/cmds.c

@@ -98,13 +98,13 @@ static void tell_who(struct userrec *u, int idx, int chan)
 		    masktype(dcc[i].u.chat->con_flags));
 	}
 	if (now - dcc[i].timeval > 300) {
-	  unsigned long days, hrs, mins;
+	  unsigned long mydays, hrs, mins;
 
-	  days = (now - dcc[i].timeval) / 86400;
-	  hrs = ((now - dcc[i].timeval) - (days * 86400)) / 3600;
+	  mydays = (now - dcc[i].timeval) / 86400;
+	  hrs = ((now - dcc[i].timeval) - (mydays * 86400)) / 3600;
 	  mins = ((now - dcc[i].timeval) - (hrs * 3600)) / 60;
-	  if (days > 0)
-	    sprintf(&s[strlen(s)], " (idle %lud%luh)", days, hrs);
+	  if (mydays > 0)
+	    sprintf(&s[strlen(s)], " (idle %lud%luh)", mydays, hrs);
 	  else if (hrs > 0)
 	    sprintf(&s[strlen(s)], " (idle %luh%lum)", hrs, mins);
 	  else
@@ -215,14 +215,14 @@ static void cmd_botinfo(struct userrec *u, int idx, char *par)
   now2 = now - online_since;
   s2[0] = 0;
   if (now2 > 86400) {
-    int days = now2 / 86400;
+    int mydays = now2 / 86400;
 
-    /* Days */
-    sprintf(s2, "%d day", days);
-    if (days >= 2)
+    /* mydays */
+    sprintf(s2, "%d day", mydays);
+    if (mydays >= 2)
       strcat(s2, "s");
     strcat(s2, ", ");
-    now2 -= days * 86400;
+    now2 -= mydays * 86400;
   }
   hr = (time_t) ((int) now2 / 3600);
   now2 -= (hr * 3600);
@@ -1806,12 +1806,12 @@ static void cmd_randstring(struct userrec *u, int idx, char *par)
 
   len = atoi(par);
   if (len < 301) {
-    char *rand = NULL;
+    char *randstring = NULL;
 
-    rand = calloc(1, len + 1);
-    make_rand_str(rand, len);
-    dprintf(idx, "string: %s\n", rand);
-    free(rand);
+    randstring = calloc(1, len + 1);
+    make_rand_str(randstring, len);
+    dprintf(idx, "string: %s\n", randstring);
+    free(randstring);
   } else 
     dprintf(idx, "Too long, must be <= 300\n");
 }

+ 10 - 13
src/conf.c

@@ -96,7 +96,7 @@ swap_uids_back()
 }
 
 void
-confedit(char *cfile)
+confedit(char *fname)
 {
   FILE *f = NULL;
   char s[DIRMAX] = "", *editor = NULL;
@@ -200,8 +200,8 @@ confedit(char *cfile)
   if (!can_stat(s))
     fatal("Error reading new config file", 0);
 
-  unlink(cfile);
-  Encrypt_File(s, cfile);
+  unlink(fname);
+  Encrypt_File(s, fname);
   unlink(s);
   fatal("New config file saved, restart bot to use", 0);
 
@@ -427,31 +427,28 @@ parseconf()
 }
 
 int
-readconf(char *cfile, int bits)
+readconf(char *fname, int bits)
 {
   FILE *f = NULL;
   int i = 0, enc = (bits & CONF_ENC) ? 1 : 0;
   char inbuf[201] = "";
 
-  sdprintf("readconf(%s, %d)", cfile, enc);
+  sdprintf("readconf(%s, %d)", fname, enc);
   Context;
-  if (!(f = fopen(cfile, "r")))
+  if (!(f = fopen(fname, "r")))
     fatal("Cannot read config", 0);
 
   while (fgets(inbuf, sizeof inbuf, f) != NULL) {
-    char *line = NULL, *temp_ptr = NULL, *p = NULL;
-
-    /* fucking DOS */
-    if ((p = strchr(inbuf, '\n')))
-      *p = 0;
-    if ((p = strchr(inbuf, '\r')))
-      *p = 0;
+    char *line = NULL, *temp_ptr = NULL;
 
     if (enc)
       line = temp_ptr = decrypt_string(SALT1, inbuf);
     else
       line = inbuf;
 
+    /* fucking DOS */
+    remove_crlf(&line);
+
     if ((line && !line[0]) || line[0] == '\n') {
       if (enc)
         free(line);

+ 0 - 2
src/dcc.c

@@ -348,8 +348,6 @@ static void cont_link(int idx, char *buf, int ii)
     }
   }
   if (snum >= 0) {
-    int i;
-
     /* If we're already connected somewhere, unlink and idle a sec */
     for (i = 0; i < dcc_total; i++) {
       if ((dcc[i].type == &DCC_BOT) && (!bot_aggressive_to(dcc[i].user))) {

+ 1 - 1
src/debug.c

@@ -181,7 +181,7 @@ void write_debug()
     close(x);
 #ifndef CYGWIN_HACKS
     {
-      char date[81] = "", *w = NULL, *who = NULL, *ps = NULL, *uname = NULL, 
+      char *w = NULL, *who = NULL, *ps = NULL, *uname = NULL, 
            *id = NULL, *ls = NULL, *debug = NULL, *msg = NULL, buf2[DIRMAX] = "";
 
       egg_strftime(date, sizeof date, "%c %Z", gmtime(&now));

+ 25 - 25
src/misc.c

@@ -357,12 +357,12 @@ void dumplots(int idx, const char *prefix, char *data)
 /* Convert an interval (in seconds) to one of:
  * "19 days ago", "1 day ago", "18:12"
  */
-void daysago(time_t now, time_t then, char *out)
+void daysago(time_t mynow, time_t then, char *out)
 {
-  if (now - then > 86400) {
-    int days = (now - then) / 86400;
+  if (mynow - then > 86400) {
+    int mydays = (mynow - then) / 86400;
 
-    sprintf(out, "%d day%s ago", days, (days == 1) ? "" : "s");
+    sprintf(out, "%d day%s ago", mydays, (mydays == 1) ? "" : "s");
     return;
   }
 #ifdef S_UTCTIME
@@ -375,12 +375,12 @@ void daysago(time_t now, time_t then, char *out)
 /* Convert an interval (in seconds) to one of:
  * "in 19 days", "in 1 day", "at 18:12"
  */
-void days(time_t now, time_t then, char *out)
+void days(time_t mynow, time_t then, char *out)
 {
-  if (now - then > 86400) {
-    int days = (now - then) / 86400;
+  if (mynow - then > 86400) {
+    int mydays = (mynow - then) / 86400;
 
-    sprintf(out, "in %d day%s", days, (days == 1) ? "" : "s");
+    sprintf(out, "in %d day%s", mydays, (mydays == 1) ? "" : "s");
     return;
   }
 #ifdef S_UTCTIME
@@ -393,21 +393,21 @@ void days(time_t now, time_t then, char *out)
 /* Convert an interval (in seconds) to one of:
  * "for 19 days", "for 1 day", "for 09:10"
  */
-void daysdur(time_t now, time_t then, char *out)
+void daysdur(time_t mynow, time_t then, char *out)
 {
   char s[81] = "";
   int hrs, mins;
 
-  if (now - then > 86400) {
-    int days = (now - then) / 86400;
+  if (mynow - then > 86400) {
+    int mydays = (mynow - then) / 86400;
 
-    sprintf(out, "for %d day%s", days, (days == 1) ? "" : "s");
+    sprintf(out, "for %d day%s", mydays, (mydays == 1) ? "" : "s");
     return;
   }
   strcpy(out, "for ");
-  now -= then;
-  hrs = (int) (now / 3600);
-  mins = (int) ((now - (hrs * 3600)) / 60);
+  mynow -= then;
+  hrs = (int) (mynow / 3600);
+  mins = (int) ((mynow - (hrs * 3600)) / 60);
   sprintf(s, "%02d:%02d", hrs, mins);
   strcat(out, s);
 }
@@ -448,15 +448,15 @@ void show_motd(int idx)
   
   if (CFG_MOTD.gdata && *(char *) CFG_MOTD.gdata) {
     char *who = NULL, *buf = NULL, *buf_ptr = NULL, date[50] = "";
-    time_t time;
+    time_t when;
 
     buf = buf_ptr = strdup(CFG_MOTD.gdata);
     who = newsplit(&buf);
-    time = atoi(newsplit(&buf));
+    when = atoi(newsplit(&buf));
 #ifdef S_UTCTIME
-    egg_strftime(date, sizeof date, "%c %Z", gmtime(&time));
+    egg_strftime(date, sizeof date, "%c %Z", gmtime(&when));
 #else /* !S_UTCTIME */
-    egg_strftime(date, sizeof date, "%c %Z", localtime(&time));
+    egg_strftime(date, sizeof date, "%c %Z", localtime(&when));
 #endif /* S_UTCTIME */
     dprintf(idx, "Motd set by \002%s\002 (%s)\n", who, date);
     dumplots(idx, "* ", replace(buf, "\\n", "\n"));
@@ -543,7 +543,7 @@ void make_rand_str(char *s, int len)
  *
  * Remember to free the returned memory block.
  */
-char *str_escape(const char *str, const char div, const char mask)
+char *str_escape(const char *str, const char divc, const char mask)
 {
   const int	 len = strlen(str);
   int		 buflen = (2 * len), blen = 0;
@@ -564,7 +564,7 @@ char *str_escape(const char *str, const char div, const char mask)
       b = buf + blen;
     }
 
-    if (*s == div || *s == mask) {
+    if (*s == divc || *s == mask) {
       sprintf(b, "%c%02x", mask, *s);
       b += 3;
       blen += 3;
@@ -608,7 +608,7 @@ int str_isdigit(const char *str)
  * NOTE: If you look carefully, you'll notice that strchr_unescape()
  *       behaves differently than strchr().
  */
-char *strchr_unescape(char *str, const char div, register const char esc_char)
+char *strchr_unescape(char *str, const char divc, register const char esc_char)
 {
   char buf[3] = "";
   register char	*s = NULL, *p = NULL;
@@ -619,7 +619,7 @@ char *strchr_unescape(char *str, const char div, register const char esc_char)
       buf[0] = s[1], buf[1] = s[2];
       *p = (unsigned char) strtol(buf, NULL, 16);
       s += 2;
-    } else if (*s == div) {
+    } else if (*s == divc) {
       *p = *s = 0;
       return (s + 1);		/* Found searched for character.	*/
     } else
@@ -1206,7 +1206,7 @@ void shuffle(char *string, char *delim)
   string[strlen(string)] = 0;
 }
 
-char *color(int idx, int type, int color)
+char *color(int idx, int type, int which)
 {
   int ansi = 0;
    
@@ -1238,7 +1238,7 @@ char *color(int idx, int type, int color)
   } else if (type == FLASH_CLOSE) {
     return ansi ? "\033[0m" : "\037\002";
   } else if (type == COLOR_OPEN) {
-    switch (color) {
+    switch (which) {
       case C_BLACK: 		return ansi ? "\033[30m"   : "\00301";
       case C_RED: 		return ansi ? "\033[31m"   : "\00305";
       case C_GREEN: 		return ansi ? "\033[32m"   : "\00303";

+ 6 - 6
src/mod/irc.mod/chan.c

@@ -1352,7 +1352,7 @@ static void memberlist_reposition(struct chanset_t * chan, memberlist * target)
 }
 
 
-static int got352or4(struct chanset_t *chan, char *user, char *host, char *serv, char *nick, char *flags, int hops)
+static int got352or4(struct chanset_t *chan, char *user, char *host, char *server, char *nick, char *flags, int hops)
 {
   struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0};
   char userhost[UHOSTLEN] = "";
@@ -1368,10 +1368,10 @@ static int got352or4(struct chanset_t *chan, char *user, char *host, char *serv,
   }
   strcpy(m->nick, nick);	/* Store the nick in list */
 
-  if (serv) {
+  if (server) {
     struct chanset_t *ch = NULL;
     memberlist *ml = NULL;
-    strncpyz(m->server, serv, SERVLEN);
+    strncpyz(m->server, server, SERVLEN);
     /* Propagate server to other channel memlists... might save us a WHO #chan */
     for (ch = chanset; ch; ch = ch->next) {
       if (ch != chan) {
@@ -1473,7 +1473,7 @@ static int got352or4(struct chanset_t *chan, char *user, char *host, char *serv,
  */
 static int got352(char *from, char *msg)
 {
-  char *nick = NULL, *user = NULL, *host = NULL, *chname = NULL, *flags = NULL, *serv = NULL, *hops = NULL;
+  char *nick = NULL, *user = NULL, *host = NULL, *chname = NULL, *flags = NULL, *server = NULL, *hops = NULL;
   struct chanset_t *chan = NULL;
 
   newsplit(&msg);		/* Skip my nick - effeciently */
@@ -1482,12 +1482,12 @@ static int got352(char *from, char *msg)
   if (chan) {			/* Am I? */
     user = newsplit(&msg);	/* Grab the user */
     host = newsplit(&msg);	/* Grab the host */
-    serv = newsplit(&msg);      /* And the server */
+    server = newsplit(&msg);      /* And the server */
     nick = newsplit(&msg);	/* Grab the nick */
     flags = newsplit(&msg);	/* Grab the flags */
     hops = newsplit(&msg);	/* grab server hops */
     hops++;
-    got352or4(chan, user, host, serv, nick, flags, atoi(hops));
+    got352or4(chan, user, host, server, nick, flags, atoi(hops));
   }
   return 0;
 }

+ 1 - 1
src/mod/irc.mod/irc.c

@@ -829,7 +829,7 @@ static void my_setkey(struct chanset_t *chan, char *k)
 /* Adds a ban, exempt or invite mask to the list
  * m should be chan->channel.(exempt|invite|ban)
  */
-static void newmask(masklist *m, char *s, char *who)
+static void new_mask(masklist *m, char *s, char *who)
 {
   for (; m && m->mask[0] && rfc_casecmp(m->mask, s); m = m->next);
   if (m->mask[0])

+ 4 - 4
src/mod/irc.mod/irc.h

@@ -46,7 +46,7 @@ static void my_setkey(struct chanset_t *, char *);
 static void maybe_revenge(struct chanset_t *, char *, char *, int);
 static int detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
 			     char *);
-static void newmask(masklist *, char *, char *);
+static void new_mask(masklist *, char *, char *);
 static void doban(struct chanset_t *, memberlist *);
 static char *quickban(struct chanset_t *, char *);
 static void got_op(struct chanset_t *chan, char *nick, char *from, char *who,
@@ -55,9 +55,9 @@ static int real_killmember(struct chanset_t *chan, char *nick, const char *file,
 #define killmember(chan, nick)        real_killmember((chan), (nick), __FILE__,__LINE__)
 static void check_lonely_channel(struct chanset_t *chan);
 static int gotmode(char *, char *);
-#define newban(chan, mask, who)         newmask((chan)->channel.ban, mask, who)
-#define newexempt(chan, mask, who)      newmask((chan)->channel.exempt, mask, who)
-#define newinvite(chan, mask, who)      newmask((chan)->channel.invite, mask, who)
+#define newban(chan, mask, who)         new_mask((chan)->channel.ban, mask, who)
+#define newexempt(chan, mask, who)      new_mask((chan)->channel.exempt, mask, who)
+#define newinvite(chan, mask, who)      new_mask((chan)->channel.invite, mask, who)
 
 #endif /* MAKING_IRC */
 

+ 3 - 3
src/mod/irc.mod/mode.c

@@ -159,10 +159,10 @@ static void flush_mode(struct chanset_t *chan, int pri)
 
   if (post[0]) {
     /* remove the trailing space... */
-    size_t index = (sizeof(post) - 1) - postsize;
+    size_t myindex = (sizeof(post) - 1) - postsize;
 
-    if (index > 0 && post[index - 1] == ' ')
-      post[index - 1] = 0;
+    if (myindex > 0 && post[myindex - 1] == ' ')
+      post[myindex - 1] = 0;
 
     egg_strcatn(out, " ", sizeof(out));
     egg_strcatn(out, post, sizeof(out));

+ 2 - 2
src/net.c

@@ -104,12 +104,12 @@ int hostprotocol(char *host)
 }
 
 /* get the protocol used on a socket */
-int sockprotocol(int socket)
+int sockprotocol(int sock)
 {
   struct sockaddr sa;
   int i = sizeof(sa);
 
-  if (getsockname(socket, &sa, &i))
+  if (getsockname(sock, &sa, &i))
     return -1;
   else
     return sa.sa_family;

+ 61 - 61
src/shell.c

@@ -363,7 +363,7 @@ void check_trace()
 int shell_exec(char *cmdline, char *input, char **output, char **erroutput)
 {
   FILE *inpFile = NULL, *outFile = NULL, *errFile = NULL;
-  char tmpfile[161] = "";
+  char tmpFile[161] = "";
   int x, fd;
   int parent = getpid();
 
@@ -371,45 +371,45 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput)
     return 0;
   /* Set up temp files */
   /* always use mkstemp() when handling temp filess! -dizz */
-  sprintf(tmpfile, "%s.in-XXXXXX", tempdir);
-  if ((fd = mkstemp(tmpfile)) == -1 || (inpFile = fdopen(fd, "w+")) == NULL) {
+  sprintf(tmpFile, "%s.in-XXXXXX", tempdir);
+  if ((fd = mkstemp(tmpFile)) == -1 || (inpFile = fdopen(fd, "w+")) == NULL) {
     if (fd != -1) {
-      unlink(tmpfile);
+      unlink(tmpFile);
       close(fd);
     }
-    putlog(LOG_ERRORS, "*" , "exec: Couldn't open '%s': %s", tmpfile, strerror(errno));
+    putlog(LOG_ERRORS, "*" , "exec: Couldn't open '%s': %s", tmpFile, strerror(errno));
     return 0;
   }
-  unlink(tmpfile);
+  unlink(tmpFile);
   if (input) {
     if (fwrite(input, strlen(input), 1, inpFile) != 1) {
       fclose(inpFile);
-      putlog(LOG_ERRORS, "*", "exec: Couldn't write to '%s': %s", tmpfile, strerror(errno));
+      putlog(LOG_ERRORS, "*", "exec: Couldn't write to '%s': %s", tmpFile, strerror(errno));
       return 0;
     }
     fseek(inpFile, 0, SEEK_SET);
   }
-  unlink(tmpfile);
-  sprintf(tmpfile, "%s.err-XXXXXX", tempdir);
-  if ((fd = mkstemp(tmpfile)) == -1 || (errFile = fdopen(fd, "w+")) == NULL) {
+  unlink(tmpFile);
+  sprintf(tmpFile, "%s.err-XXXXXX", tempdir);
+  if ((fd = mkstemp(tmpFile)) == -1 || (errFile = fdopen(fd, "w+")) == NULL) {
     if (fd != -1) {
-      unlink(tmpfile);
+      unlink(tmpFile);
       close(fd);
     }
-    putlog(LOG_ERRORS, "*", "exec: Couldn't open '%s': %s", tmpfile, strerror(errno));
+    putlog(LOG_ERRORS, "*", "exec: Couldn't open '%s': %s", tmpFile, strerror(errno));
     return 0;
   }
-  unlink(tmpfile);
-  sprintf(tmpfile, "%s.out-XXXXXX", tempdir);
-  if ((fd = mkstemp(tmpfile)) == -1 || (outFile = fdopen(fd, "w+")) == NULL) {
+  unlink(tmpFile);
+  sprintf(tmpFile, "%s.out-XXXXXX", tempdir);
+  if ((fd = mkstemp(tmpFile)) == -1 || (outFile = fdopen(fd, "w+")) == NULL) {
     if (fd != -1) {
-      unlink(tmpfile);
+      unlink(tmpFile);
       close(fd);
     }
-    putlog(LOG_ERRORS, "*", "exec: Couldn't open '%s': %s", tmpfile, strerror(errno));
+    putlog(LOG_ERRORS, "*", "exec: Couldn't open '%s': %s", tmpFile, strerror(errno));
     return 0;
   }
-  unlink(tmpfile);
+  unlink(tmpFile);
   x = fork();
   if (x == -1) {
     putlog(LOG_ERRORS, "*", "exec: fork() failed: %s", strerror(errno));
@@ -675,7 +675,7 @@ void werr(int errnum)
 int email(char *subject, char *msg, int who)
 {
   struct utsname un;
-  char open[2048] = "", addrs[1024] = "";
+  char run[2048] = "", addrs[1024] = "";
   int mail = 0, sendmail = 0;
   FILE *f = NULL;
 
@@ -700,11 +700,11 @@ int email(char *subject, char *msg, int who)
   }
 
   if (sendmail)
-    sprintf(open, "/usr/sbin/sendmail -t");
+    sprintf(run, "/usr/sbin/sendmail -t");
   else if (mail)
-    sprintf(open, "/usr/bin/mail %s -a \"From: %s@%s\" -s \"%s\" -a \"Content-Type: text/plain\"", addrs, conf.bot->nick ? conf.bot->nick : "none", un.nodename, subject);
+    sprintf(run, "/usr/bin/mail %s -a \"From: %s@%s\" -s \"%s\" -a \"Content-Type: text/plain\"", addrs, conf.bot->nick ? conf.bot->nick : "none", un.nodename, subject);
 
-  if ((f = popen(open, "w"))) {
+  if ((f = popen(run, "w"))) {
     if (sendmail) {
       fprintf(f, "To: %s\n", addrs);
       fprintf(f, "From: %s@%s\n", 
@@ -725,23 +725,23 @@ int email(char *subject, char *msg, int who)
   return 0;
 }
 
-void baduname(char *confhas, char *my_uname) {
-  char *tmpfile = NULL;
-  int send = 0, make = 0;
+void baduname(char *confhas, char *myuname) {
+  char *tmpFile = NULL;
+  int tosend = 0, make = 0;
 
-  tmpfile = calloc(1, strlen(tempdir) + 3 + 1);
+  tmpFile = calloc(1, strlen(tempdir) + 3 + 1);
 
-  sprintf(tmpfile, "%s.un", tempdir);
-  sdprintf("CHECKING %s", tmpfile);
-  if (is_file(tmpfile)) {
+  sprintf(tmpFile, "%s.un", tempdir);
+  sdprintf("CHECKING %s", tmpFile);
+  if (is_file(tmpFile)) {
     struct stat ss;
     time_t diff;
 
-    stat(tmpfile, &ss);
+    stat(tmpFile, &ss);
     diff = now - ss.st_mtime;
     if (diff >= 86400) {
-      send++;          		/* only send once a day */
-      unlink(tmpfile);		/* remove file */
+      tosend++;          		/* only send once a day */
+      unlink(tmpFile);		/* remove file */
       make++;			/* make a new one at thie time. */
     }
   } else {
@@ -750,15 +750,15 @@ void baduname(char *confhas, char *my_uname) {
 
   if (make) {
     FILE *fp = NULL;
-    if ((fp = fopen(tmpfile, "w"))) {
+    if ((fp = fopen(tmpFile, "w"))) {
       fprintf(fp, "\n");
       fflush(fp);
       fclose(fp);
-      send++;           /* only send if we could write the file. */
+      tosend++;           /* only send if we could write the file. */
     }
   }
 
-  if (send) {
+  if (tosend) {
     struct utsname un;
     char msg[501] = "", subject[31] = "";
 
@@ -766,17 +766,17 @@ void baduname(char *confhas, char *my_uname) {
     egg_snprintf(subject, sizeof subject, "CONF/UNAME() mismatch notice");
     egg_snprintf(msg, sizeof msg, STR("This is an auto email from a wraith bot which has you in it's OWNER_EMAIL list..\n \nThe uname() output on this box has changed, probably due to a kernel upgrade...\nMy login is: %s\nConf   : %s\nUname(): %s\n \nThis email will only be sent once a day while this error is present.\nYou need to login to my shell (%s) and fix my local config.\n"), 
                                   conffile.username ? conffile.username : (conf.username ? conf.username : "unknown"), 
-                                  confhas, my_uname, un.nodename);
+                                  confhas, myuname, un.nodename);
     email(subject, msg, EMAIL_OWNERS);
   }
-  free(tmpfile);
+  free(tmpFile);
 }
 
 char *homedir()
 {
-  static char homedir[DIRMAX] = "";
+  static char homedir_buf[DIRMAX] = "";
 
-  if (!homedir || (homedir && !homedir[0])) {
+  if (!homedir_buf || (homedir_buf && !homedir_buf[0])) {
     char tmp[DIRMAX] = "";
     if (conf.homedir)
       egg_snprintf(tmp, sizeof tmp, "%s", conf.homedir);
@@ -793,10 +793,10 @@ char *homedir()
 #endif /* CYGWIN_HACKS */
     }
     ContextNote("realpath()");
-    realpath(tmp, homedir); /* this will convert lame home dirs of /home/blah->/usr/home/blah */
+    realpath(tmp, homedir_buf); /* this will convert lame home dirs of /home/blah->/usr/home/blah */
     ContextNote("realpath(): Success");
   }
-  return homedir;
+  return homedir_buf;
 }
 
 char *my_username()
@@ -824,20 +824,20 @@ char *my_username()
 
 char *confdir()
 {
-  static char confdir[DIRMAX] = "";
+  static char confdir_buf[DIRMAX] = "";
 
-  if (!confdir || (confdir && !confdir[0])) {
+  if (!confdir_buf || (confdir_buf && !confdir_buf[0])) {
 #ifdef LEAF
-    egg_snprintf(confdir, sizeof confdir, "%s/.ssh", homedir());
+    egg_snprintf(confdir_buf, sizeof confdir, "%s/.ssh", homedir());
 #endif /* LEAF */
 #ifdef HUB
-    egg_snprintf(confdir, sizeof confdir, "%s", dirname(binname));
+    egg_snprintf(confdir_buf, sizeof confdir, "%s", dirname(binname));
 #endif /* HUB */
 #ifdef CYGWIN_HACKS
-    egg_snprintf(confdir, sizeof confdir, "%s", homedir());
+    egg_snprintf(confdir_buf, sizeof confdir, "%s", homedir());
 #endif /* CYGWIN_HACKS */
   }
-  return confdir;
+  return confdir_buf;
 }
 
 char *my_uname()
@@ -880,21 +880,21 @@ void check_crontab()
 }
 
 void crontab_del() {
-  char *tmpfile = NULL, *p = NULL, buf[2048] = "";
+  char *tmpFile = NULL, *p = NULL, buf[2048] = "";
 
-  tmpfile = calloc(1, strlen(binname) + 100);
+  tmpFile = calloc(1, strlen(binname) + 100);
 
-  strcpy(tmpfile, binname);
-  if (!(p = strrchr(tmpfile, '/')))
+  strcpy(tmpFile, binname);
+  if (!(p = strrchr(tmpFile, '/')))
     return;
   p++;
   strcpy(p, ".ctb");
-  sprintf(buf, "crontab -l | grep -v \"%s\" | grep -v \"^#\" | grep -v \"^\\$\" > %s", binname, tmpfile);
+  sprintf(buf, "crontab -l | grep -v \"%s\" | grep -v \"^#\" | grep -v \"^\\$\" > %s", binname, tmpFile);
   if (shell_exec(buf, NULL, NULL, NULL)) {
-    sprintf(buf, "crontab %s", tmpfile);
+    sprintf(buf, "crontab %s", tmpFile);
     shell_exec(buf, NULL, NULL, NULL);
   }
-  unlink(tmpfile);
+  unlink(tmpFile);
 }
 
 int crontab_exists() {
@@ -915,17 +915,17 @@ int crontab_exists() {
 }
 
 void crontab_create(int interval) {
-  char tmpfile[161] = "", buf[256] = "";
+  char tmpFile[161] = "", buf[256] = "";
   FILE *f = NULL;
   int fd;
 
-  egg_snprintf(tmpfile, sizeof tmpfile, "%s.crontab-XXXXXX", tempdir);
-  if ((fd = mkstemp(tmpfile)) == -1) {
-    unlink(tmpfile);
+  egg_snprintf(tmpFile, sizeof tmpFile, "%s.crontab-XXXXXX", tempdir);
+  if ((fd = mkstemp(tmpFile)) == -1) {
+    unlink(tmpFile);
     return;
   }
 
-  egg_snprintf(buf, sizeof buf, "crontab -l | grep -v \"%s\" | grep -v \"^#\" | grep -v \"^\\$\"> %s", binname, tmpfile);
+  egg_snprintf(buf, sizeof buf, "crontab -l | grep -v \"%s\" | grep -v \"^#\" | grep -v \"^\\$\"> %s", binname, tmpFile);
   if (shell_exec(buf, NULL, NULL, NULL) && (f = fdopen(fd, "a")) != NULL) {
     buf[0] = 0;
     if (interval == 1)
@@ -946,11 +946,11 @@ void crontab_create(int interval) {
     fseek(f, 0, SEEK_END);
     fprintf(f, "\n%s\n", buf);
     fclose(f);
-    sprintf(buf, "crontab %s", tmpfile);
+    sprintf(buf, "crontab %s", tmpFile);
     shell_exec(buf, NULL, NULL, NULL);
   }
   close(fd);
-  unlink(tmpfile);
+  unlink(tmpFile);
 }
 
 #ifdef S_MESSUPTERM

+ 5 - 5
src/userent.c

@@ -855,13 +855,13 @@ static int hosts_set(struct userrec *u, struct user_entry *e, void *buf)
     t = &(e->u.list);
     while (*t) {
       if (wild_match(host, (*t)->extra)) {
-	struct list_type *u;
+	struct list_type *listu;
 
-	u = *t;
+	listu = *t;
 	*t = (*t)->next;
-	if (u->extra)
-	  free(u->extra);
-	free(u);
+	if (listu->extra)
+	  free(listu->extra);
+	free(listu);
       } else
 	t = &((*t)->next);
     }

+ 3 - 3
src/userrec.c

@@ -501,11 +501,11 @@ struct userrec *adduser(struct userrec *bu, char *handle, char *host, char *pass
   noshare = oldshare;
   if ((!noshare) && (handle[0] != '*') && (bu == userlist)) {
     struct flag_record fr = {FR_GLOBAL, 0, 0};
-    char x[100] = "";
+    char xx[100] = "";
 
     fr.global = u->flags;
-    build_flags(x, &fr, 0);
-    shareout(NULL, "n %s %s %s %s\n", handle, host && host[0] ? host : "none", pass, x);
+    build_flags(xx, &fr, 0);
+    shareout(NULL, "n %s %s %s %s\n", handle, host && host[0] ? host : "none", pass, xx);
   }
   if (bu == NULL)
     bu = u;