|
Online Bugfile Viewer [by Rasdan] |
|
|
|
Posted Wednesday, August 12th @ 11:32:41 PM, by George Greer in the Wizard dept.
Updated May 6, 1997. Click the link below to read it or download it.
From: Rasdan <rasdan@peak.org>
Subject: Changes to do_gen_vfile
Hey all,
Here's a change I put together earlier to do_gen_vfile (by Daniel Burke)
that lets you see things in your bug file while on-line).
It is a very nice little snippet, but it only let you see the last 20
lines from the file.
I set it up so that you can see as many as you want.
Here's the entire thing:
In act.other.c, below do_gen_file, add:
ACMD(do_gen_vfile)
{
char syscom[120];
FILE *pfp;
char *filename;
int number = 0;
one_argument(argument, arg);
if (!*arg || !isdigit(*arg))
number = 20;
else
number = atoi(arg);
if (number > 100)
{
send_to_char("MAX LINES AT ONE TIME CAN NOT BE GREATER THAN 100!\r\n"
, ch);
return;
}
switch (subcmd) {
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: do_gen_vfile\r\n", ch);
return;
break;
}
sprintf(syscom, "tail -%d %s", number, filename);
if ((pfp = popen(syscom, "r")) == NULL) {
send_to_char("No entries found\r\n", ch);
return;
}
sprintf(buf2, "Contents of file:\r\n");
send_to_char(buf2, ch);
while (fgets(syscom, 120, pfp) != NULL) {
sprintf(buf2, "%s\r", syscom);
send_to_char(buf2, ch);
}
pclose(pfp);
}
In interpreter.h, add:
/* do_gen_vfile */
#define SCMD_V_BUGS 0
#define SCMD_V_IDEAS 1
#define SCMD_V_TYPOS 2
In interpreter.c, with the ACMD prototypes, prototype:
ACMD(do_gen_vfile);
and then in the command list, add:
{ "vbugs" , POS_DEAD , do_gen_vfile, LVL_CODER, SCMD_V_BUGS },
{ "videa" , POS_DEAD , do_gen_vfile, LVL_CODER, SCMD_V_IDEAS },
{ "vtypo" , POS_DEAD , do_gen_vfile, LVL_CODER, SCMD_V_TYPOS },
Keep in mind, I did not write this. All I did was make it so that you can
see any number of lines you want, by doing:
videa <#> or vtypo <#> or vbugs <#>.
Hope you all enjoy this minor little improvement to this nifty bit of
code.
Rasdan
<< Object Timers [by ?] | Reply | View as text | Threaded | Online Xname Command [by David Endre] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|