All the talk about viewing the BUG, IDEA and TYPO files, I decided to
write one, and with all the ideas being slung around for doing it,
I thought I would share my working code for it :)
It uses last, and only looks at the last 20 lines.... I eventually plan
to make the number of lines a command line switch that defaults to 10
if it isn't specified.... well, here it is :)
/* Put this anywhere, I put it in act.wizard.c
* oh, I also have a todo command to log things I need to do without
* cluttering the idea file :P */
ACMD(do_gen_vfile) {
char syscom[120];
FILE *pfp;
char *filename;
half_chop (argument,buf,buf1);
half_chop (buf1,buf2,buf1);
switch (subcmd) {
case SCMD_V_TODO:
filename = TODO_FILE;
break;
case SCMD_V_BUGS:
filename = BUG_FILE;
break;
case SCMD_V_IDEAS:
filename = IDEA_FILE;
break;
case SCMD_V_TYPOS:
filename = TYPO_FILE;
break;
default:
send_to_char("INVALID COMMAND!!: go_gen_vfile\r\n", ch);
return;
break;
}
sprintf(syscom,"tail -%d %s", 20, filename);
if ((pfp = popen(syscom,"r")) == NULL){
send_to_char("No entries found.\n\r",ch);
return;
}
sprintf(buf2,"Contents of file: \n\r");
send_to_char(buf2,ch);
while (fgets(syscom,120,pfp) != NULL){
sprintf(buf2,"%s\r",syscom);
send_to_char(buf2,ch);
}
pclose(pfp);
}
/* interpreter.c of course :) */
{ "vbugs" , POS_DEAD , do_gen_vfile, LVL_GRGOD, SCMD_V_BUGS },
{ "videas" , POS_DEAD , do_gen_vfile, LVL_GRGOD, SCMD_V_IDEAS },
{ "vtypos" , POS_DEAD , do_gen_vfile, LVL_GRGOD, SCMD_V_TYPOS },
{ "vtodo" , POS_DEAD , do_gen_vfile, LVL_GRGOD, SCMD_V_TODO },
/* interpreter.h */
/* do_gen_vfile */
#define SCMD_V_TODO 0
#define SCMD_V_BUGS 1
#define SCMD_V_IDEAS 2
#define SCMD_V_TYPOS 3
Brazil - IMP of AddictMUD tolkien.realms.org 4000 or
addict.realms.org 4000 or
206.185.33.2 4000
This archive was generated by hypermail 2b30 : 12/18/00 PST