-/* The following routines all take varoius arguments, and return
+/* The following routines all take various arguments, and return
* string representations of same. The string representations
* are stored in static buffers, so the next call to each function
* will destroy any old string that was there.
char *unparse_types(int type);
/* The following routines all take strings as arguments, and return
- * true iff the string is a valid representation of the appropriate type.
+ * true if the string is a valid representation of the appropriate type.
*/
int is_dbref(char const *str);
int is_objid(char const *str);
* and PE_FUNCTION_CHECK must be active for function evaluation to occur.
*
* PE_FUNCTION_MANDATORY causes an error to be reported if a function call
- * is attempted for a non-existant function. Otherwise, the function call
+ * is attempted for a non-existent function. Otherwise, the function call
* is not evaluated, but rather treated as normal text.
*
* PE_LITERAL prevents { and [ from being recognized and causing recursion.
/* These represent '\0', '}', ']', ')', ',', ';', '=', and ' ', respectively.
* If the character corresponding to a set flag is encountered, then
* process_expression() will exit, with *str pointing at the terminating
- * charater. '\0' is always a terminating character.
+ * character. '\0' is always a terminating character.
*
* PT_DEFAULT, below, is provided as syntactic sugar.
*/
cmd = command_find("ATTRIB_SET");
} else {
c = command;
- while ((*c) && (*c != '/') && (*c != ' '))
+ while ((*c) && (*c != '/'))
c++;
b = *c;
*c = '\0';
int j, per;
char mstr[BUFFER_LEN], pstr[BUFFER_LEN], *dp;
char const *sp;
- char *tbuf1;
+ char *tbuf1 = NULL;
int first = 1, found = 0, exact = 0;
if (strstr(called_as, "ALL"))
if (!(nargs & 1) && !found) {
/* Default case */
- tbuf1 = replace_string("#$", mstr, args[nargs - 1]);
- sp = tbuf1;
+ if (!exact) {
+ tbuf1 = replace_string("#$", mstr, args[nargs - 1]);
+ sp = tbuf1;
+ } else
+ sp = args[nargs - 1];
process_expression(buff, bp, &sp, executor, caller, enactor,
PE_DEFAULT, PT_DEFAULT, pe_info);
- mush_free((Malloc_t) tbuf1, "replace_string.buff");
+ if (!exact)
+ mush_free((Malloc_t) tbuf1, "replace_string.buff");
}
}
* by a : and at least one digit, and nothing else.
* In regex: ^#-?\d+(:\d+)?$
* \param str string to check.
- * \retval 1 string is a dbref.
- * \retval 0 string is not a dbref.
+ * \retval 1 string is an objid
+ * \retval 0 string is not an objid.
*/
int
is_objid(char const *str)
a = atr_get(vendor, "PRICELIST");
if (!a)
continue;
- strncpy(prices,atr_value(a),BUFFER_LEN);
- prices[BUFFER_LEN-1] = '\0';
+ strncpy(prices, atr_value(a), BUFFER_LEN);
+ prices[BUFFER_LEN - 1] = '\0';
upcasestr(prices);
count = list2arr(r, BUFFER_LEN / 2, prices, ' ');
if (!count)
notify(player, T("Did you want to give something *to* someone?"));
return;
}
- while ((s > arg) && isspace(*(s - 1))) {
+ while ((s > arg) && isspace((unsigned char) *(s - 1))) {
s--;
}
if (s == arg) {
*s++ = '\0';
s = (char *) string_match(s, "TO ");
s += 3;
- while (*s && isspace(*s))
+ while (*s && isspace((unsigned char) *s))
s++;
if (!*s) {
notify(player, T("Give to whom?"));
restriction = args[n + 1];
/* A special old-timey kludge */
if (class && !*class && restriction && *restriction) {
- if (isdigit(*restriction) || ((*restriction == '#') && *(restriction + 1)
- && isdigit(*(restriction + 1)))) {
+ if (isdigit((unsigned char) *restriction)
+ || ((*restriction == '#') && *(restriction + 1)
+ && isdigit((unsigned char) *(restriction + 1)))) {
size_t offset = 0;
if (*restriction == '#')
offset = 1;
}
if (!class || !*class || !restriction)
continue;
- if (isdigit(*class) ||
- ((*class == '#') && *(class + 1) && isdigit(*(class + 1)))) {
+ if (isdigit((unsigned char) *class) ||
+ ((*class == '#') && *(class + 1)
+ && isdigit((unsigned char) *(class + 1)))) {
+
size_t offset = 0;
if (*class == '#')
offset = 1;
spec->low = parse_integer(class + offset);
if (!GoodObject(spec->low))
spec->low = 0;
- if (isdigit(*restriction) || ((*restriction == '#') && *(restriction + 1)
- && isdigit(*(restriction + 1)))) {
+ if (isdigit((unsigned char) *restriction)
+ || ((*restriction == '#') && *(restriction + 1)
+ && isdigit((unsigned char) *(restriction + 1)))) {
offset = 0;
if (*restriction == '#')
offset = 1;