First, me on my MUD using it with my imm via my testing command (which is usually just send_to_char(ch, "Does Nothing!\r\n"); unless I've placed test code in it like right now)
Quote:
50000Hp 50000Ma 50000Mv> immtest boogie woogie
str_cew output: Boogie Woogie
50000Hp 50000Ma 50000Mv> immtest boogie woogie
str_cew output: Boogie Woogie
Now for the do_immtest code so you can see how its used
ACMD(do_immtest)
{
char buf[MAX_STRING_LENGTH];
str_cew(argument, buf);
send_to_char(ch, "str_cew output: %s\r\n", buf);
}
The prototype for str_cew in utils.h
I'm considering changing this from void to int and having it return either the number of words capped, OR the total length in bytes... any input on this?
void str_cew(char *argument, char *new_arg);
The function in utils.c, as I said above for the prototype, considering changing this to int and doing some type of return value.
/*
* str_cew: Function to capitalize the first letter each word in a string.
* All other letters in the string are returned returned in lower case.
*
* Does not modify original string. Returns void.
*/
void str_cew(char *argument, char *new_arg)
{
if (!argument || !*argument) {
log("SYSERR: str_cew received a NULL pointer!");
*new_arg = '{{uie-code}}';
return;
}
if (argument == '{{uie-code}}') {
log("SYSERR: str_cew received no argument!");
*new_arg = '{{uie-code}}';
return;
}
/* CircleMUD function to strip leading spaces from the string */
skip_spaces(&argument);
*(new_arg++) = UPPER(*argument);
argument++;
while (*argument) {
if (isspace(*argument)) {
*(new_arg++) = *argument;
argument++;
if (*argument != '{{uie-code}}')
*(new_arg++) = UPPER(*argument);
} else {
*(new_arg++) = LOWER(*argument);
}
if (*argument != '{{uie-code}}')
argument++;
}
*new_arg = '{{uie-code}}';
return;
}


