From 37332ca26b2303e5a29a276a94c0de5b40924b94 Mon Sep 17 00:00:00 2001 From: Rick L Bird Date: Fri, 6 May 2011 17:28:05 -0400 Subject: [PATCH] PennMUSH 1.8.3p11 Author: talvo@talvo.com Date: Mon Nov 30 02:51:16 2009 +0000 Issue 29, multiple class/restrictions for @search. Hopefully. Author: talvo@talvo.com Date: Mon Nov 30 01:34:58 2009 +0000 Minor bugfix in @search. Fixes #131 Fixes #166 --- src/command.c | 4 ++-- src/wiz.c | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/command.c b/src/command.c index ddc8437..abef43a 100644 --- a/src/command.c +++ b/src/command.c @@ -2155,9 +2155,9 @@ do_hook_list(dbref player, char *command) bp = buff; safe_str(T("The following commands have hooks: "), buff, &bp); for (i = 0; i < count; i++) { - if (gencomp((dbref) 0, ptrs[i], ptrs[i - 1], ALPHANUM_LIST) <= 0) + if (i > 0 && gencomp((dbref) 0, ptrs[i], ptrs[i - 1], ALPHANUM_LIST) <= 0) continue; - if (i == (count - 1) && i) + if (i && i == (count - 1)) safe_str(" and ", buff, &bp); else if (i) safe_str(", ", buff, &bp); diff --git a/src/wiz.c b/src/wiz.c index c06970b..96add33 100644 --- a/src/wiz.c +++ b/src/wiz.c @@ -1131,6 +1131,7 @@ do_search(dbref player, const char *arg1, char **arg3) { char tbuf[BUFFER_LEN], *arg2 = tbuf, *tbp; dbref *results = NULL; + char *s; int nresults; /* parse first argument into two */ @@ -1171,12 +1172,21 @@ do_search(dbref player, const char *arg1, char **arg3) } } { - const char *myargs[4]; + const char *myargs[MAX_ARG]; + int i; + int j = 2; myargs[0] = arg2; myargs[1] = arg3[1]; - myargs[2] = arg3[2]; - myargs[3] = arg3[3]; - nresults = raw_search(player, tbuf, 4, myargs, &results, NULL); + for (i = 2; i < INT_MAX && (arg3[i] != NULL); i++) { + if ((s = strchr(arg3[i], '='))) { + *s++ = '\0'; + myargs[j++] = arg3[i]; + myargs[j++] = s; + } else { + myargs[j++] = arg3[i]; + } + } + nresults = raw_search(player, tbuf, j, myargs, &results, NULL); } if (nresults == 0) { -- 2.30.2