[Commit] rrserver dispatch.5c,1.29,1.30 main.5c,1.5,1.6
root
commit at keithp.com
Thu Jan 1 19:40:55 PST 2004
- Previous message: [Commit] grrobot/src/svg grr_icon_svg.h, 1.7,
1.8 target_blue_circle.svg, 1.3, 1.4 target_blue_triangle.svg,
1.3, 1.4 target_green_circle.svg, 1.3,
1.4 target_green_triangle.svg, 1.3, 1.4 target_red_circle.svg,
1.3, 1.4 target_red_triangle.svg, 1.3, 1.4 target_whirl.svg,
1.2, 1.3 target_yellow_circle.svg, 1.3,
1.4 target_yellow_triangle.svg, 1.3, 1.4
- Next message: [Commit] RRClient ChangeLog, NONE, 1.1 RRMessages.java, NONE,
1.1 RRBoard.java, 1.8, 1.9 RRClient.java, 1.11,
1.12 RRController.java, 1.1, 1.2 RRNetIn.java, 1.3,
1.4 RRNetOut.java, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: root
Update of /local/src/CVS/rrserver
In directory home.keithp.com:/local/bin/rrserver
Modified Files:
dispatch.5c main.5c
Log Message:
Fix help gameinfo (quoting was busted) by removing lots of code. Add --port option and usage
Index: dispatch.5c
===================================================================
RCS file: /local/src/CVS/rrserver/dispatch.5c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- dispatch.5c 26 Jun 2003 11:20:11 -0000 1.29
+++ dispatch.5c 2 Jan 2004 03:40:53 -0000 1.30
@@ -198,7 +198,7 @@
" indicates the winner.\n"+
"<time> is valid only in BID state, else it's 0\n"+
"<bid> is valid in all but NEW state where it's 0\n"+
- "<active> is valid in SHOW and SOLVED states, else it's \"\".\n",
+ "<active> is valid in SHOW and SOLVED states, else it's \"\".\n",
f = void func (string[] w) {
string game = w[0];
assert_user ();
@@ -548,28 +548,15 @@
describe =
"Provide help for <command>.\n",
f = void func (string[] w) {
+ file f = File::string_write ();
void print_help (&Cmd cmd, bool describe)
{
- File::fprintf (c.f, "%-12.12s %s\n", cmd.command, cmd.usage);
+ File::fprintf (f, "%-12.12s %s\n", cmd.command, cmd.usage);
if (describe)
{
- int len = String::length (cmd.describe);
- bool newline = true;
- for (int i = 0; i < len; i++)
- {
- if (newline)
- {
- for (int j = 0; j < 13; j++)
- File::putc (' ', c.f);
- newline = false;
- }
- int ch = cmd.describe[i];
- File::putc (ch, c.f);
- if (ch == '\n') newline = true;
- }
+ File::fprintf (f, "\n%s\n", cmd.describe);
}
}
- File::fprintf (c.f, "HELP \"\n");
if (dim(w) > 0)
{
for (int j = 0; j < dim(w); j++)
@@ -591,7 +578,7 @@
for (int i = 0; i < dim(commands); i++)
print_help (&commands[i], false);
}
- File::fprintf (c.f, "\"\n");
+ respond ("HELP %s\n", File::string_string(f));
}
},
{
Index: main.5c
===================================================================
RCS file: /local/src/CVS/rrserver/main.5c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- main.5c 26 Jun 2003 09:18:28 -0000 1.5
+++ main.5c 2 Jan 2004 03:40:53 -0000 1.6
@@ -28,17 +28,32 @@
extend namespace Server {
public namespace Main {
+ void usage () {
+ File::fprintf (stderr, "usage: %s" +
+ " [--logfile <logfile>]" +
+ " [--port <port>]\n", argv[0]);
+ exit (1);
+ }
public void main () {
PRNG::dev_srandom (32);
- for (int i = 0; i < dim (argv); i++)
+ int port = RR::Port;
+ for (int i = 1; i < dim (argv); i++)
switch (argv[i]) {
case "--logfile":
File::reopen (argv[i+1], "a", stderr);
+ i++;
+ break;
+ case "--port":
+ port = atoi (argv[i+1]);
+ i++;
+ break;
+ default:
+ usage ();
break;
}
File::setbuffer (stderr, 1);
- file f = Net::create (RR::Port);
- File::fprintf (stderr, "RR server started on port %d.\n", RR::Port);
+ file f = Net::create (port);
+ File::fprintf (stderr, "RR server started on port %d.\n", port);
Net::listen (Dispatch::client, f);
}
}
- Previous message: [Commit] grrobot/src/svg grr_icon_svg.h, 1.7,
1.8 target_blue_circle.svg, 1.3, 1.4 target_blue_triangle.svg,
1.3, 1.4 target_green_circle.svg, 1.3,
1.4 target_green_triangle.svg, 1.3, 1.4 target_red_circle.svg,
1.3, 1.4 target_red_triangle.svg, 1.3, 1.4 target_whirl.svg,
1.2, 1.3 target_yellow_circle.svg, 1.3,
1.4 target_yellow_triangle.svg, 1.3, 1.4
- Next message: [Commit] RRClient ChangeLog, NONE, 1.1 RRMessages.java, NONE,
1.1 RRBoard.java, 1.8, 1.9 RRClient.java, 1.11,
1.12 RRController.java, 1.1, 1.2 RRNetIn.java, 1.3,
1.4 RRNetOut.java, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list