[srvx-commits] CVS: services/src modcmd.c,1.10,1.11 tools.c,1.109,1.110
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-08-05 01:46:31
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12720/src
Modified Files:
modcmd.c tools.c
Log Message:
kludge around what happens when you unsplit_string() when parts of argv are alias-substituted
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** modcmd.c 5 Aug 2002 01:26:56 -0000 1.10
--- modcmd.c 5 Aug 2002 01:46:27 -0000 1.11
***************
*** 593,597 ****
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
! unsigned int pos, ii, jj;
char logbuf[2*MAXLEN];
--- 593,597 ----
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
! unsigned int pos;
char logbuf[2*MAXLEN];
***************
*** 607,617 ****
}
pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
! for (ii=0; ii<argc; ii++) {
! for (jj=0; argv[ii][jj]; ) {
! logbuf[pos++] = argv[ii][jj++];
! }
! logbuf[pos++] = ' ';
! }
! logbuf[--pos] = 0;
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
--- 607,612 ----
}
pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
! unsplit_string(argv, argc);
! strcpy(logbuf+pos, argv[0]);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
***************
*** 629,644 ****
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
! char display[MAXLEN], *word;
! unsigned int pos, len;
!
! for (nn = pos = 0; nn < cmd->alias.used; ++nn) {
! word = cmd->alias.list[nn];
! len = strlen(word);
! memcpy(display+pos, word, len);
! pos += len;
! display[pos++] = ' ';
! }
! display[--pos] = 0;
! send_message(user, bot, MCMSG_COMMAND_ALIASES, cmd->name, display);
}
/* Show the help entry for the underlying command. */
--- 624,631 ----
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
! char *arg0 = cmd->alias.list[0];
! unsplit_string((unsigned char**)cmd->alias.list, cmd->alias.used);
! send_message(user, bot, MCMSG_COMMAND_ALIASES, cmd->name, cmd->alias.list[0]);
! cmd->alias.list[0] = arg0;
}
/* Show the help entry for the underlying command. */
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -C2 -r1.109 -r1.110
*** tools.c 30 Jul 2002 02:15:10 -0000 1.109
--- tools.c 5 Aug 2002 01:46:27 -0000 1.110
***************
*** 879,891 ****
unsplit_string(unsigned char *set[], unsigned int max)
{
! unsigned char *str = set[0];
! if (!max) return;
! while (1) {
! while (*str++) ;
! str--;
! if (!--max) break;
! while (!*str) *str++ = ' ';
}
! *str = 0;
}
--- 879,893 ----
unsplit_string(unsigned char *set[], unsigned int max)
{
! static unsigned char unsplit_buffer[MAXLEN*2];
! unsigned int ii, jj, pos;
!
! for (ii=pos=0; ii<max; ii++) {
! for (jj=0; set[ii][jj]; jj++) {
! unsplit_buffer[pos++] = set[ii][jj];
! }
! unsplit_buffer[pos++] = ' ';
}
! unsplit_buffer[--pos] = 0;
! set[0] = unsplit_buffer;
}
|