Indented with src/scripts/indent-emp.
This commit is contained in:
parent
5f263a7753
commit
9b7adfbecc
437 changed files with 52211 additions and 51052 deletions
|
@ -46,45 +46,47 @@ void wripglob(char *filename);
|
|||
void wrauth(char *filename);
|
||||
void wrgamesdef(char *filename);
|
||||
|
||||
char *_c_copyright_header = "/*\n * Empire - A multi-player, client/server Internet based war game.\n * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,\n * Ken Stevens, Steve McClure\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * ---\n *\n * See the \"LEGAL\", \"LICENSE\", \"CREDITS\" and \"README\" files for all the\n * related information and legal notices. It is expected that any future\n * projects/authors will amend these files as needed.\n *\n * ---\n *\n * gamesdef.h: This is an auto-generated file.\n * \n * Known contributors to this file:\n * Automatically generated by doconfig.c\n */\n\n";
|
||||
char *_c_copyright_header =
|
||||
"/*\n * Empire - A multi-player, client/server Internet based war game.\n * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,\n * Ken Stevens, Steve McClure\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * ---\n *\n * See the \"LEGAL\", \"LICENSE\", \"CREDITS\" and \"README\" files for all the\n * related information and legal notices. It is expected that any future\n * projects/authors will amend these files as needed.\n *\n * ---\n *\n * gamesdef.h: This is an auto-generated file.\n * \n * Known contributors to this file:\n * Automatically generated by doconfig.c\n */\n\n";
|
||||
|
||||
char *_ipglob_copyright_header = "/*\n * Empire - A multi-player, client/server Internet based war game.\n * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,\n * Ken Stevens, Steve McClure\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * ---\n *\n * See the \"LEGAL\", \"LICENSE\", \"CREDITS\" and \"README\" files for all the\n * related information and legal notices. It is expected that any future\n * projects/authors will amend these files as needed.\n *\n * ---\n *\n * ipglob.c: This is an auto-generated file.\n * \n * Known contributors to this file:\n * Automatically generated by doconfig.c\n */\n\n";
|
||||
char *_ipglob_copyright_header =
|
||||
"/*\n * Empire - A multi-player, client/server Internet based war game.\n * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,\n * Ken Stevens, Steve McClure\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * ---\n *\n * See the \"LEGAL\", \"LICENSE\", \"CREDITS\" and \"README\" files for all the\n * related information and legal notices. It is expected that any future\n * projects/authors will amend these files as needed.\n *\n * ---\n *\n * ipglob.c: This is an auto-generated file.\n * \n * Known contributors to this file:\n * Automatically generated by doconfig.c\n */\n\n";
|
||||
|
||||
#if defined(_WIN32)
|
||||
char *
|
||||
rindex(char *path, char c)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
i = strlen(path);
|
||||
cp = &path[i - 1];
|
||||
i = strlen(path);
|
||||
cp = &path[i - 1];
|
||||
|
||||
while (i) {
|
||||
if (*cp == c)
|
||||
return cp;
|
||||
i--;
|
||||
cp--;
|
||||
}
|
||||
return (char *)0;
|
||||
while (i) {
|
||||
if (*cp == c)
|
||||
return cp;
|
||||
i--;
|
||||
cp--;
|
||||
}
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
char *
|
||||
index(char *path, char c)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
cp = &path[0];
|
||||
cp = &path[0];
|
||||
|
||||
i = 0;
|
||||
while (path[i]) {
|
||||
if (*cp == c)
|
||||
return cp;
|
||||
i++;
|
||||
cp++;
|
||||
}
|
||||
return (char *)0;
|
||||
i = 0;
|
||||
while (path[i]) {
|
||||
if (*cp == c)
|
||||
return cp;
|
||||
i++;
|
||||
cp++;
|
||||
}
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -94,13 +96,12 @@ main()
|
|||
{
|
||||
char buf[256];
|
||||
char *cp;
|
||||
char *pathname;
|
||||
char *pathname;
|
||||
|
||||
if ((pathname = getcwd(NULL, 255)) == NULL) {
|
||||
printf("Can't get current path!\n");
|
||||
exit(-1);
|
||||
printf("Can't get current path!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
cp = (char *)rindex(pathname, '/');
|
||||
*cp = '\0';
|
||||
|
@ -120,19 +121,19 @@ main()
|
|||
wripglob(buf);
|
||||
|
||||
if (access(EP, 0)) {
|
||||
printf("making directory %s\n", EP);
|
||||
if (mkdir(EP, 493)) {
|
||||
printf("mkdir failed on %s, exiting.\n", EP);
|
||||
exit(-1);
|
||||
}
|
||||
printf("making directory %s\n", EP);
|
||||
if (mkdir(EP, 493)) {
|
||||
printf("mkdir failed on %s, exiting.\n", EP);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
sprintf(buf, "%s/data", EP);
|
||||
if (access(buf, 0)) {
|
||||
printf("making directory %s\n", buf);
|
||||
if (mkdir(buf, 493)) {
|
||||
printf("mkdir failed on %s, exiting.\n", buf);
|
||||
exit(-1);
|
||||
}
|
||||
printf("making directory %s\n", buf);
|
||||
if (mkdir(buf, 493)) {
|
||||
printf("mkdir failed on %s, exiting.\n", buf);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
sprintf(buf, "%s/data/auth", EP);
|
||||
wrauth(buf);
|
||||
|
@ -144,14 +145,15 @@ wrmakesrc(char *pathname)
|
|||
{
|
||||
FILE *fp;
|
||||
char buf[256];
|
||||
|
||||
|
||||
sprintf(buf, "%s/src/make.src", pathname);
|
||||
if ((fp = fopen(buf, "w")) == NULL) {
|
||||
printf("Cannot open %s for writing, exiting.\n", buf);
|
||||
exit(-1);
|
||||
printf("Cannot open %s for writing, exiting.\n", buf);
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(fp, "# make.src - Wolfpack, 1996-2000\n");
|
||||
fprintf(fp, "# Source tree absolute pathname - auto generated.\n\n");
|
||||
fprintf(fp,
|
||||
"# Source tree absolute pathname - auto generated.\n\n");
|
||||
fprintf(fp, "SRCDIR = %s\n", pathname);
|
||||
fclose(fp);
|
||||
}
|
||||
|
@ -163,10 +165,10 @@ wripglob(char *filename)
|
|||
|
||||
printf("Writing %s\n", filename);
|
||||
if ((fp = fopen(filename, "w")) == NULL) {
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(fp, _ipglob_copyright_header);
|
||||
fprintf(fp, _ipglob_copyright_header);
|
||||
fprintf(fp, "#include <stdio.h>\n");
|
||||
fprintf(fp, "#include <setjmp.h>\n");
|
||||
fprintf(fp, "#include \"misc.h\"\n");
|
||||
|
@ -184,12 +186,13 @@ wrauth(char *filename)
|
|||
|
||||
printf("Writing %s\n", filename);
|
||||
if ((fp = fopen(filename, "w")) == NULL) {
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
fprintf(fp, "# Wolfpack, 1996-2000\n#\n");
|
||||
fprintf(fp, "# Empire Authorization File - Users listed will be allowed to log in as deities.\n#\n");
|
||||
fprintf(fp,
|
||||
"# Empire Authorization File - Users listed will be allowed to log in as deities.\n#\n");
|
||||
fprintf(fp, "# Format is:\n");
|
||||
fprintf(fp, "# hostname that authorized user uses on a line\n");
|
||||
fprintf(fp, "# username that authorized user uses on a line\n#\n");
|
||||
|
@ -206,62 +209,67 @@ void
|
|||
wrgamesdef(char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
char path[512];
|
||||
char *cp;
|
||||
unsigned int i;
|
||||
char path[512];
|
||||
char *cp;
|
||||
unsigned int i;
|
||||
int s_p_etu;
|
||||
char buf[40];
|
||||
char c = 'b';
|
||||
|
||||
cp = &path[0];
|
||||
for (i = 0; i < strlen(EP); i++) {
|
||||
*cp++ = EP[i];
|
||||
if (EP[i] == '\\')
|
||||
*cp++ = '\\';
|
||||
}
|
||||
*cp = 0;
|
||||
cp = &path[0];
|
||||
for (i = 0; i < strlen(EP); i++) {
|
||||
*cp++ = EP[i];
|
||||
if (EP[i] == '\\')
|
||||
*cp++ = '\\';
|
||||
}
|
||||
*cp = 0;
|
||||
|
||||
strcpy(buf, EF);
|
||||
if (strlen(buf) > 0)
|
||||
c = buf[strlen(buf) - 1];
|
||||
c = buf[strlen(buf) - 1];
|
||||
if (index("dhm", c) && strlen(buf) > 0) {
|
||||
s_p_etu = atoi(buf);
|
||||
if (c == 'd')
|
||||
s_p_etu = (((double)s_p_etu * 60.0 * 60.0 * 24.0) / (double)ET);
|
||||
else if (c == 'h')
|
||||
s_p_etu = (((double)s_p_etu * 60.0 * 60.0) / (double)ET);
|
||||
else if (c == 'm')
|
||||
s_p_etu = (((double)s_p_etu * 60.0) / (double)ET);
|
||||
s_p_etu = atoi(buf);
|
||||
if (c == 'd')
|
||||
s_p_etu =
|
||||
(((double)s_p_etu * 60.0 * 60.0 * 24.0) / (double)ET);
|
||||
else if (c == 'h')
|
||||
s_p_etu = (((double)s_p_etu * 60.0 * 60.0) / (double)ET);
|
||||
else if (c == 'm')
|
||||
s_p_etu = (((double)s_p_etu * 60.0) / (double)ET);
|
||||
} else {
|
||||
printf("ETU frequency is bad - using 10 minutes.\n");
|
||||
s_p_etu = 600 / ET;
|
||||
printf("ETU frequency is bad - using 10 minutes.\n");
|
||||
s_p_etu = 600 / ET;
|
||||
}
|
||||
|
||||
printf("Writing %s\n", filename);
|
||||
if ((fp = fopen(filename, "w")) == NULL) {
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(fp, _c_copyright_header);
|
||||
fprintf(fp, "/*\n * Wolfpack, 1996-2000\n *\n");
|
||||
fprintf(fp, " * gamesdef.h - generated automatically by doconfig. Feel\n");
|
||||
fprintf(fp, " * free to change these, but if you rebuild with overwrite on\n");
|
||||
fprintf(fp,
|
||||
" * gamesdef.h - generated automatically by doconfig. Feel\n");
|
||||
fprintf(fp,
|
||||
" * free to change these, but if you rebuild with overwrite on\n");
|
||||
fprintf(fp, " * this file will be overwritten again.\n");
|
||||
fprintf(fp, " */\n\n");
|
||||
fprintf(fp, "#ifndef _GAMESDEF_H_\n");
|
||||
fprintf(fp, "#define _GAMESDEF_H_\n\n");
|
||||
fprintf(fp, "#if !defined(_WIN32)\n");
|
||||
fprintf(fp, "#if !defined(_WIN32)\n");
|
||||
fprintf(fp, "#ifdef __STDC__\n");
|
||||
fprintf(fp, "#define EMPPATH(xyz) \"%s/\" #xyz /* ANSI C */\n", EP);
|
||||
fprintf(fp, "#else\n");
|
||||
fprintf(fp, "#define EMPPATH(xyz) \"%s/xyz\" /* traditional */\n", EP);
|
||||
fprintf(fp, "#endif /* __STDC__ */\n");
|
||||
fprintf(fp, "#else\n");
|
||||
fprintf(fp, "#define EMPPATH(xyz) \"%s\\\\\" #xyz /* ANSI C */\n", path);
|
||||
fprintf(fp, "#else\n");
|
||||
fprintf(fp, "#define EMPPATH(xyz) \"%s\\\\\" #xyz /* ANSI C */\n",
|
||||
path);
|
||||
fprintf(fp, "#endif /* _WIN32 */\n\n");
|
||||
fprintf(fp, "#define PRVNAM \"%s\"\n", PV);
|
||||
fprintf(fp, "#define PRVLOG \"%s\"\n", EM);
|
||||
fprintf(fp, "#define GET_SOURCE \"using:\\n ftp://ftp.wolfpackempire.com/pub/empire/server or \\n http://www.wolfpackempire.com/\"\n");
|
||||
fprintf(fp,
|
||||
"#define GET_SOURCE \"using:\\n ftp://ftp.wolfpackempire.com/pub/empire/server or \\n http://www.wolfpackempire.com/\"\n");
|
||||
fprintf(fp, "#define EMP_HOST \"%s\"\n", IP);
|
||||
fprintf(fp, "#define EMP_PORT \"%d\"\n\n", PN);
|
||||
fprintf(fp, "#define MAXNOC %d\n\n", MC);
|
||||
|
@ -270,7 +278,7 @@ wrgamesdef(char *filename)
|
|||
fprintf(fp, "#define DEF_S_P_ETU %d\n", s_p_etu);
|
||||
fprintf(fp, "#define ETUS %d\n\n", ET);
|
||||
if (BL)
|
||||
fprintf(fp, "#define BLITZ 1\n\n");
|
||||
fprintf(fp, "#define BLITZ 1\n\n");
|
||||
fprintf(fp, "#endif /* _GAMESDEF_H_ */\n");
|
||||
fclose(fp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue