Try something like this:
void do_objroom( CHAR_DATA *ch, char *argument )
{
char buf[MSL];
OBJ_DATA *obj;
int count = 0;
if ( IS_NPC(ch) ) /* This check really isn't even necessary since this
function doesn't reference pcdata */
{
send_to_char("Yeah, whatever.\n\r", ch);
return;
}
if ( argument[0] == '\0' )
{
send_to_char("You can't count nothing.\n\r", ch);
return;
}
for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content )
{
if ( !str_prefix(argument,obj->name) )
count++;
}
sprintf(buf,"This room has (%d)%s in it.\n\r", count, argument);
send_to_char(buf,ch);
return;
}