_commands.c

nightmare3_mudos_v1/lib/cmds/adm/_commands.c · 911 B

From the archive nightmare3_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/*
// 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>

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(WIZ_CMDS));
	process(get_dir(ADM_CMDS));
	process(get_dir(USER_CMDS));
	return 1;
}

Site Stats

Snippets: 1791
Codebases: 571