/* * $Id: makeopt.c,v 1.5 2002/08/23 13:38:14 howardjp Exp $ * * Copyright (c) 1990 * Jan Wolter. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jan Wolter * and his contributors. * 4. Neither the name of Jan Wolter nor the names of his contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY JAN WOLTER AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JAN WOLTER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* MAKEOPT: Program to generate opt.h file from the opttab.c file. Doing * it this way makes it easier to add options and commands. Jan Wolter. */ #include #include "party.h" main() { int i; int chn_done = 0; printf("/* Don't bother editing this file.\n"); printf(" * It is generated from opttab.c by the makeopt program.\n"); printf(" */\n\n"); /* Print the option defines */ printf("#define OPT_NONE\t-1\n"); for (i=0;opt[i].name;i++) { if (!chn_done && !(opt[i].pf & PF_CHN)) { printf("#define NCOPT\t\t%d\n",i); chn_done=1; } define("OPT",opt[i].name,i); } printf("#define NOPT\t\t%d\n",i); /* Print the command defines */ for (i=0;cmd[i].name;i++) define("CMD",cmd[i].name,i); printf("#define NCMD\t\t%d\n",i); exit(0); } define(prefix,string,val) char *prefix; char *string; int val; { char *p; printf("#define %s_",prefix); for (p=string;*p;p++) if (islower(*p)) putchar(toupper(*p)); else putchar(*p); if (strlen(string) < 4) putchar('\t'); printf("\t%d\n",val); }