/*
// file: /bin/adm/_commands.c:
// author: Truilkan@TMI
// last modified 1992/03/08
// description: automatically generates /usr/include/commands.h
*/
#define COMMANDS_H "/include/ncommands.h"
#include <std.h>
#include <dirs.h>
inherit DAEMON;
void header()
{
string this_file;
rm(COMMANDS_H);
sscanf(file_name(this_object()),"%s#%*d",this_file);
write_file(COMMANDS_H,
"# commands.h: automatically generated by " + this_file + ".\n");
write_file(COMMANDS_H,
"# created: " + ctime(time()) + "\n");
}
void process(string *files)
{
int j;
string filename, commandname, macro;
for (j = 0; j < sizeof(files); j++) {
sscanf(files[j],"%s.c",commandname);
sscanf(files[j],"%*s/*s/_%s.c",filename);
write_file(COMMANDS_H,"#define " + filename + " " + commandname + "\n");
}
}
int cmd_commands(string str)
{
process(get_dir(DIR_CREATOR_CMDS));
process(get_dir(DIR_ADMIN_CMDS));
process(get_dir(DIR_MORTAL_CMDS));
return 1;
}