From b4000200e31b3bb7c652030eecd8a1fdaed65428 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 12 Feb 2002 17:44:41 +0000 Subject: [PATCH] move the getopt files from qfcc/source to libs/util, link qw-master against libQFutil and enable the option parsting in qw-master for win32. --- include/Makefile.am | 2 +- {tools/qfcc/include => include}/getopt.h | 0 libs/util/Makefile.am | 2 +- {tools/qfcc/source => libs/util}/getopt.c | 0 {tools/qfcc/source => libs/util}/getopt1.c | 0 qw/source/Makefile.am | 4 ++-- qw/source/master.c | 9 +++------ tools/qfcc/include/Makefile.am | 2 +- tools/qfcc/source/Makefile.am | 2 +- 9 files changed, 9 insertions(+), 12 deletions(-) rename {tools/qfcc/include => include}/getopt.h (100%) rename {tools/qfcc/source => libs/util}/getopt.c (100%) rename {tools/qfcc/source => libs/util}/getopt1.c (100%) diff --git a/include/Makefile.am b/include/Makefile.am index ccbc1c790..001bb11d9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS= foreign SUBDIRS = QF EXTRA_DIST = asm_i386.h adivtab.h anorm_dots.h anorms.h asm_draw.h block16.h \ block8.h buildnum.h compat.h context_x11.h d_iface.h d_ifacea.h \ - d_local.h dga_check.h fbset.h gl_warp_sin.h \ + d_local.h dga_check.h fbset.h getopt.h gl_warp_sin.h \ in_win.h logos.h menu.h old_keys.h qstring.h quakeasm.h r_cvar.h \ r_dynamic.h r_local.h r_shared.h sbar.h skin_stencil.h stamp-h.in \ varrays.h vgamodes.h view.h vregset.h winquake.h world.h \ diff --git a/tools/qfcc/include/getopt.h b/include/getopt.h similarity index 100% rename from tools/qfcc/include/getopt.h rename to include/getopt.h diff --git a/libs/util/Makefile.am b/libs/util/Makefile.am index f7ed2b28c..a56f9ad10 100644 --- a/libs/util/Makefile.am +++ b/libs/util/Makefile.am @@ -26,7 +26,7 @@ libQFutil_la_LDFLAGS= -version-info 1:0:0 libQFutil_la_LIBADD= libasm.la $(Z_LIBS) $(DL_LIBS) libQFutil_la_DEPENDENCIES= libasm.la libQFutil_la_SOURCES= \ - checksum.c cmd.c crc.c cvar.c fendian.c hash.c \ + checksum.c cmd.c crc.c cvar.c fendian.c getopt.c getopt1.c hash.c \ info.c link.c mathlib.c mdfour.c msg.c pcx.c plugin.c qargs.c \ qendian.c qfplist.c quakefs.c quakeio.c sizebuf.c string.c sys.c \ tga.c va.c ver_check.c wad.c zone.c $(fnmatch) diff --git a/tools/qfcc/source/getopt.c b/libs/util/getopt.c similarity index 100% rename from tools/qfcc/source/getopt.c rename to libs/util/getopt.c diff --git a/tools/qfcc/source/getopt1.c b/libs/util/getopt1.c similarity index 100% rename from tools/qfcc/source/getopt1.c rename to libs/util/getopt1.c diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index 60c523740..5b0a5c913 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -95,8 +95,8 @@ qw_server_LDFLAGS= $(common_ldflags) qw_server_DEPENDENCIES= libqfnet.la libasm.la $(qf_server_LIBS) qw_master_SOURCES= master.c -qw_master_LDADD= $(NET_LIBS) -qw_master_LDFLAGS= $(common_ldflags) +qw_master_LDADD= $(top_builddir)/libs/util/libQFutil.la $(NET_LIBS) +qw_master_LDFLAGS= $(common_ldflags) -static cl_plugin_LIBS= \ $(CLIENT_PLUGIN_STATIC_LIBS) \ diff --git a/qw/source/master.c b/qw/source/master.c index b86513348..25e282e80 100644 --- a/qw/source/master.c +++ b/qw/source/master.c @@ -59,6 +59,7 @@ static const char rcsid[] = #include #include #include +#include #include "protocol.h" @@ -337,7 +338,6 @@ make_host_addr (const char *host, int port, struct sockaddr_in *host_addr) return 0; } -#ifndef WIN32 static void read_hosts (const char *fname) { @@ -372,19 +372,16 @@ read_hosts (const char *fname) } fclose (host_file); } -#endif int main (int argc, char **argv) { struct sockaddr_in addr; short port = htons (PORT_MASTER); -#ifndef WIN32 //FIXME int c; -#endif servers = calloc (sizeof (server_t), serverlen); -#ifndef WIN32 //FIXME + while ((c = getopt (argc, argv, "p:f:")) != -1) { switch (c) { case 'p': @@ -395,7 +392,7 @@ main (int argc, char **argv) break; } } -#endif + addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = port; diff --git a/tools/qfcc/include/Makefile.am b/tools/qfcc/include/Makefile.am index 3acb35a6f..74869d62e 100644 --- a/tools/qfcc/include/Makefile.am +++ b/tools/qfcc/include/Makefile.am @@ -1,4 +1,4 @@ AUTOMAKE_OPTIONS= foreign -EXTRA_DIST= cmdlib.h config.h.in expr.h getopt.h scope.h struct.h switch.h \ +EXTRA_DIST= cmdlib.h config.h.in expr.h scope.h struct.h switch.h \ qfcc.h type.h diff --git a/tools/qfcc/source/Makefile.am b/tools/qfcc/source/Makefile.am index 21a60f5f2..35ba907d7 100644 --- a/tools/qfcc/source/Makefile.am +++ b/tools/qfcc/source/Makefile.am @@ -37,7 +37,7 @@ YFLAGS = -d bin_PROGRAMS= qfcc -qfcc_SOURCES= cmdlib.c debug.c pr_comp.c pr_def.c pr_imm.c pr_lex.c pr_opcode.c qfcc.c qc-parse.y qc-lex.l emit.c expr.c struct.c switch.c getopt.c getopt1.c type.c +qfcc_SOURCES= cmdlib.c debug.c pr_comp.c pr_def.c pr_imm.c pr_lex.c pr_opcode.c qfcc.c qc-parse.y qc-lex.l emit.c expr.c struct.c switch.c type.c qfcc_LDADD= $(QFCC_LIBS) qfcc_DEPENDENCIES= $(QFCC_DEPS) EXTRA_DIST= qc-parse.h