processck.txt
snippets · 814 B · 2010-03-30
processck: peek at the MUD's processes from in-game.
Download « Back to the snippets list
This is a kooky little snippet which will let MUD coders take a quick peek
at their processes while in the MUD. I wrote this up real quick to help keep
an eye on an errant process. Customize as you see fit.
if ( !str_prefix( arg1, "Process" ) )
{
FILE *fp;
char proc[24];
char line[80];
char buf[MAX_STRING_LENGTH];
BUFFER *output;
output = new_buf();
sprintf( proc, "ps xu > ../data/ps.txt" );
system( proc );
/* open file */
fclose( fpReserve );
fp = fopen( "../data/ps.txt","r" );
while( fgets( line, 80, fp ) != NULL )
{
sprintf(buf, "%s\n\r", line);
add_buf(output,buf);
}
fclose(fp);
fpReserve = fopen( NULL_FILE, "r" );
page_to_char( buf_string(output), ch );
free_buf(output);
return;
}