From 96e380e90970373c8dfa3dcf860cc2e081fbfa3e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 18 Mar 2005 20:51:39 +0000 Subject: [PATCH] (_c_copyright_header, _ipglob_copyright_header, copyright_header): _c_copyright_header and _ipglob_copyright_header are almost identical. Replace by copyright_header, interpolate variable parts with printf. (wrmakesrc, wrauth, wrgamesdef): Make generated file comments match our usual style a bit more closely. (wrgamesdef): Fix generated comment on overwrite. --- src/doconfig/doconfig.c | 61 +++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/src/doconfig/doconfig.c b/src/doconfig/doconfig.c index 6cdfb32b..ff11c0ac 100644 --- a/src/doconfig/doconfig.c +++ b/src/doconfig/doconfig.c @@ -52,12 +52,39 @@ static void wripglob(char *filename); static void wrauth(char *filename); static void wrgamesdef(char *filename); -char *_c_copyright_header = - "/*\n * Empire - A multi-player, client/server Internet based war game.\n * Copyright (C) 1986-2005, 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-2005, 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 *copyright_header = +"/*\n" +" * Empire - A multi-player, client/server Internet based war game.\n" +" * Copyright (C) 1986-2005, 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" +" * %s: %s\n" +" * \n" +" * Known contributors to this file:\n" +" * Automatically generated by doconfig.c\n" +" */\n\n"; #if defined(__GLIBC__) || defined(FBSD) || defined(__APPLE_) || defined(_WIN32) #define safe_getcwd() getcwd(NULL, 0) @@ -141,9 +168,8 @@ wrmakesrc(char *pathname) printf("Cannot open %s for writing, exiting.\n", buf); exit(-1); } - fprintf(fp, "# make.src - Wolfpack, 1996-2004\n"); fprintf(fp, - "# Source tree absolute pathname - auto generated.\n\n"); + "# make.src: Source tree absolute pathname - auto generated.\n\n"); fprintf(fp, "SRCDIR = %s\n", pathname); fclose(fp); } @@ -158,7 +184,8 @@ wripglob(char *filename) printf("Cannot open %s for writing, exiting.\n", filename); exit(-1); } - fprintf(fp, _ipglob_copyright_header); + fprintf(fp, copyright_header, + strrchr(filename, '/')+1, "IP globals."); fprintf(fp, "#include \"misc.h\"\n"); fprintf(fp, "char empirehost[] = \"%s\";\n", HN); fprintf(fp, "char empireport[] = \"%d\";\n", PN); @@ -176,9 +203,10 @@ wrauth(char *filename) exit(-1); } - fprintf(fp, "# Wolfpack, 1996-2004\n#\n"); fprintf(fp, - "# Empire Authorization File - Users listed will be allowed to log in as deities.\n#\n"); + "# %s: Empire Authorization File\n" + "# Users listed will be allowed to log in as deities.\n#\n", + strrchr(filename, '/')+1); 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"); @@ -232,13 +260,10 @@ wrgamesdef(char *filename) printf("Cannot open %s for writing, exiting.\n", filename); exit(-1); } - fprintf(fp, _c_copyright_header); - fprintf(fp, "/*\n * Wolfpack, 1996-2004\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, " * this file will be overwritten again.\n"); + fprintf(fp, copyright_header, + strrchr(filename,'/')+1, "Server compile-time configuration"); + fprintf(fp, "/*\n * Feel free to change these, but if you rerun doconfig this file will\n"); + fprintf(fp, " * be overwritten again.\n"); fprintf(fp, " */\n\n"); fprintf(fp, "#ifndef _GAMESDEF_H_\n"); fprintf(fp, "#define _GAMESDEF_H_\n\n");