do_strfry().txt

snippets · 781 B · 2010-03-30

do_strfry: fries a string and shows it to the room (a toy using a lesser-known string function).

Download   « Back to the snippets list

// Fry up a string and serve it to the room. mmm
// Has no real purpose but gives a little insight on the
// less acclaims standard string function, strfry()
void do_stringfry(CHAR_DATA *ch, char *argument) {
    char arg[MSL], buf[MSL];
    //String len of argument is checked at interp. We're okay!
    argument = one_argument(argument, arg);
    if (arg[0] == '\0') {
        send_to_char("Fry what words up?\r\n", ch);
        return;
    }
    strfry(arg);
    strcpy(buf, arg);
    while (argument[0] != '\0') {
        argument = one_argument(argument, arg);
        strfry(arg);
        strcat(buf, " ");
        strcat(buf, arg);
    }

    act ("{C$n says, '$T'{x", ch, NULL, buf, TO_ROOM);
    act ("{CYou say, '$T'{x", ch, NULL, buf, TO_CHAR);
}

Site Stats

Snippets: 1791
Codebases: 571