[Freeciv-Dev] (PR#3706) append the capstring
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
here's small patch that allows the server or client to append tokens to the
capstring at runtime. This allows not only compile options like:
#ifdef FOO
append_capability("foo");
#endif
but also things like server commandline options:
% ser --foo
if (is_option("--foo", argv[inx])
append_capability("foo");
}
this will be nice for things like gzip compression in the server and server
authentication.
-mike
PS: is there a reason why we need a capstr.c as well as a capability.c?
diff -Nur -Xsnap/diff_ignore snap/client/civclient.c snap-cap/client/civclient.c
--- snap/client/civclient.c Sat Feb 22 11:43:21 2003
+++ snap-cap/client/civclient.c Wed Mar 12 00:00:19 2003
@@ -196,6 +196,7 @@
/* disallow running as root -- too dangerous */
dont_run_as_root(argv[0], "freeciv_client");
+ init_our_capability();
log_init(logfile, loglevel, NULL);
/* after log_init: */
diff -Nur -Xsnap/diff_ignore snap/common/capstr.c snap-cap/common/capstr.c
--- snap/common/capstr.c Tue Feb 18 09:05:33 2003
+++ snap-cap/common/capstr.c Tue Mar 11 23:51:09 2003
@@ -121,3 +121,12 @@
}
sz_strlcpy(our_capability_internal, s);
}
+
+/**************************************************************************
+ append the string to the capability string.
+**************************************************************************/
+void append_capability(const char *str)
+{
+ sz_strlcat(our_capability_internal, " ");
+ sz_strlcat(our_capability_internal, str);
+}
diff -Nur -Xsnap/diff_ignore snap/common/capstr.h snap-cap/common/capstr.h
--- snap/common/capstr.h Thu Jun 10 07:22:15 1999
+++ snap-cap/common/capstr.h Tue Mar 11 23:51:03 2003
@@ -16,5 +16,6 @@
extern const char * const our_capability;
void init_our_capability(void);
+void append_capability(const char *str);
#endif
diff -Nur -Xsnap/diff_ignore snap/common/game.c snap-cap/common/game.c
--- snap/common/game.c Sat Feb 22 11:43:42 2003
+++ snap-cap/common/game.c Tue Mar 11 23:59:42 2003
@@ -738,7 +738,6 @@
game.load_options.load_private_map = TRUE;
game.load_options.load_settings = TRUE;
- init_our_capability();
map_init();
idex_init();
diff -Nur -Xsnap/diff_ignore snap/server/srv_main.c snap-cap/server/srv_main.c
--- snap/server/srv_main.c Wed Feb 12 18:11:55 2003
+++ snap-cap/server/srv_main.c Wed Mar 12 00:00:23 2003
@@ -158,6 +158,7 @@
init_nls();
/* init server arguments... */
+ init_our_capability();
srvarg.metaserver_no_send = DEFAULT_META_SERVER_NO_SEND;
sz_strlcpy(srvarg.metaserver_info_line, default_meta_server_info_string());
- [Freeciv-Dev] (PR#3706) append the capstring,
Mike Kaufman <=
- Message not available
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Jason Short, 2003/03/12
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Mike Kaufman, 2003/03/12
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Jason Short, 2003/03/12
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Mike Kaufman, 2003/03/13
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Jason Short, 2003/03/21
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Mike Kaufman, 2003/03/21
- [Freeciv-Dev] Re: (PR#3706) append the capstring, Jason Short, 2003/03/21
|
|