Update of /cvsroot/netrek/server/Vanilla/tools In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26631/tools Modified Files: Makefile.in cambot.c keyman.c mergescores.c metaget.c newscores.c nuke.c players.c setgalaxy.c setplanet.c showgalaxy.c trimscores.c update.c xtkill.c Log Message: merge from jerub darcs 2006-05-12 Index: metaget.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/metaget.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- metaget.c 22 Apr 2006 02:16:47 -0000 1.2 +++ metaget.c 12 May 2006 03:44:50 -0000 1.3 @@ -20,16 +20,13 @@ */ -#ifndef lint -static char vcid[] = "$Id$"; -#endif /* lint */ - #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> +#include <arpa/inet.h> #include <netdb.h> int main (int argc, char *argv[]) @@ -47,7 +44,7 @@ if (argc > 2) port = atoi(argv[2]); sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock < 0) { perror("socket"); exit(1); } + if (sock < 0) { perror("socket"); return 1; } address.sin_family = AF_INET; address.sin_port = htons(port); @@ -56,7 +53,7 @@ struct hostent *hp; if ((hp = gethostbyname(host)) == NULL) { herror("gethostbyname"); - exit(2); + return 2; } else { address.sin_addr.s_addr = *(long *) hp->h_addr; } @@ -65,19 +62,20 @@ /* send query */ stat = sendto(sock, "?", 1, 0, (struct sockaddr *) &address, sizeof(struct sockaddr)); - if (stat < 0) { perror("sendto"); exit(3); } + if (stat < 0) { perror("sendto"); return 3; } /* wait for response */ len = recvfrom(sock, buf, BUFSIZ, 0, NULL, NULL); - if (len < 0) { perror("recvfrom"); exit(4); } + if (len < 0) { perror("recvfrom"); return 4; } if (len == 0) { fprintf(stderr, "%s: zero length response received\n", argv[0]); - exit(5); + return 5; } /* display response */ stat = write(STDOUT_FILENO, buf, len); - if (stat < 0) { perror("write"); exit(6); } + if (stat < 0) { perror("write"); return 6; } close(sock); + return 0; } Index: xtkill.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/xtkill.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- xtkill.c 23 Apr 2006 11:24:53 -0000 1.6 +++ xtkill.c 12 May 2006 03:44:50 -0000 1.7 @@ -9,8 +9,6 @@ static void Usage(void); static void _pmessage(char *str, int recip, int group); -static char *names[] = { "Neutral", "Fed", "Rom", "", "Kli", "", "", "", "Ori"}; - static void Usage(void) { printf("\ @@ -39,8 +37,6 @@ static void refit(struct player *me, int type) { - int i; - getship(&(me->p_ship), type); /* enable docking */ Index: update.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/update.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- update.c 28 Sep 2005 12:14:06 -0000 1.2 +++ update.c 12 May 2006 03:44:50 -0000 1.3 @@ -8,26 +8,13 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <sys/types.h> -#include <sys/socket.h> #include <time.h> -#include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <sys/wait.h> #include "defs.h" -#include INC_SYS_TIME -#include <sys/resource.h> -#include <signal.h> -#include <sys/ioctl.h> -#include <errno.h> -#include <sys/file.h> #include <sys/stat.h> -#include <fcntl.h> -#include <pwd.h> -#include INC_STRINGS #include INC_SYS_FCNTL -#include INC_SYS_PTYIO #include "struct.h" #include "data.h" #include "patchlevel.h" @@ -338,11 +325,11 @@ #endif if (exclude) execl(buf,KEYCOMP,"-c","-m",buf1,"-t",classes,"-x", - exclude,buf2,0); + exclude,buf2, (char *) NULL); else execl(buf,KEYCOMP,"-c","-m",buf1,"-t",classes, - buf2,0); + buf2, (char *) NULL); _exit(1); } @@ -378,7 +365,7 @@ #endif } while (num_written < num_read); } - fclose(keyfile); + fclose(featurefile); fprintf(stderr,"Wrote new feature file\n"); } close(sock); Index: Makefile.in =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/Makefile.in,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.in 23 Apr 2006 11:22:53 -0000 1.7 +++ Makefile.in 12 May 2006 03:44:49 -0000 1.8 @@ -78,7 +78,7 @@ $(INSTALLPROG) $(INSTALLOPTS) updated $(DESTDIR)$(LIBDIR)/updated $(INSTALLPROG) $(INSTALLOPTS) cambot $(DESTDIR)$(LIBDIR)/cambot $(INSTALLPROG) $(INSTALLOPTS) metaget $(DESTDIR)$(LIBDIR)/tools/metaget - $(INSTALLPROG) $(INSTALLOPTS) setplanet $(DESTDIR)$(LIBDIR)/tools/metaget + $(INSTALLPROG) $(INSTALLOPTS) setplanet $(DESTDIR)$(LIBDIR)/tools/setplanet cambot: cambot.o $(OBJS) $(CC) -o $@ $(CFLAGS) ${LDFLAGS} cambot.o $(OBJS) $(RSA_LIB) @@ -159,7 +159,7 @@ $(CC) -o $@ $(CFLAGS) ${LDFLAGS} conq_vert.o metaget: metaget.o - $(CC) -o $@ $(CFLAGS) ${LDFLAGS} metaget.o + $(CC) -o $@ $(CFLAGS) ${LDFLAGS} metaget.o $(EXTRALIBS) setplanet: setplanet.o $(OBJS) $(CC) -o $@ $(CFLAGS) ${LDFLAGS} setplanet.o $(OBJS) Index: cambot.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/cambot.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- cambot.c 27 Apr 2006 00:24:07 -0000 1.4 +++ cambot.c 12 May 2006 03:44:50 -0000 1.5 @@ -41,7 +41,6 @@ int debug; void message_flag(struct message *cur, char *address) {} -int check_command(struct message *mess) {return 0;} void flushSockBuf(void) {} int bounceSBStats(int from) {return 0;} int bouncePingStats(int from) {return 0;} Index: setplanet.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/setplanet.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- setplanet.c 26 Apr 2006 09:52:43 -0000 1.2 +++ setplanet.c 12 May 2006 03:44:50 -0000 1.3 @@ -1,5 +1,8 @@ #include <stdio.h> +#include <stdlib.h> #include <stdarg.h> +#include <unistd.h> +#include <ctype.h> #include "defs.h" #include "struct.h" #include "planets.h" @@ -127,6 +130,7 @@ if (verbose) say("%s made %s", pl->pl_name, name); return 1; } + return 0; } /* check for a request to clear a planet flag, and do it */ @@ -138,6 +142,7 @@ if (verbose) say("%s made %s", pl->pl_name, name); return 1; } + return 0; } /* display everything known about a planet in command line format */ Index: mergescores.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/mergescores.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mergescores.c 21 Mar 2005 05:23:47 -0000 1.1 +++ mergescores.c 12 May 2006 03:44:50 -0000 1.2 @@ -25,14 +25,10 @@ */ #include <stdio.h> -#include <sys/types.h> -#include <sys/file.h> -#include <sys/time.h> /* for time() */ +#include <time.h> #include <stdlib.h> -#include <pwd.h> #include <unistd.h> #include "defs.h" -#include INC_STRINGS #include INC_FCNTL #include "struct.h" #include "data.h" @@ -100,7 +96,7 @@ lstatus=(struct status *) malloc(sizeof(struct status)); fstatus=(struct status *) malloc(sizeof(struct status)); scanf("%10ld %10d %10d %10d %10d %10lf\n", - &fstatus->time, + (long int *) &fstatus->time, &fstatus->planets, &fstatus->armsbomb, &fstatus->kills, @@ -117,14 +113,14 @@ fprintf(stderr, " Ticks Planets Armsbomb Kills Losses Timeprod\n"); fprintf(stderr, "Loc: %10ld %10d %10d %10d %10d %10lf\n", - lstatus->time, + (long int) lstatus->time, lstatus->planets, lstatus->armsbomb, lstatus->kills, lstatus->losses, lstatus->timeprod); fprintf(stderr, "For: %10ld %10d %10d %10d %10d %10lf\n", - fstatus->time, + (long int) fstatus->time, fstatus->planets, fstatus->armsbomb, fstatus->kills, Index: players.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/players.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- players.c 6 May 2006 12:23:30 -0000 1.6 +++ players.c 12 May 2006 03:44:50 -0000 1.7 @@ -1,10 +1,8 @@ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> +#include <unistd.h> #include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> #include <arpa/inet.h> #include "defs.h" #include "struct.h" Index: newscores.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/newscores.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- newscores.c 30 Sep 2005 05:46:19 -0000 1.2 +++ newscores.c 12 May 2006 03:44:50 -0000 1.3 @@ -9,9 +9,6 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <sys/types.h> -#include <sys/file.h> -#include <pwd.h> #include "defs.h" #include INC_FCNTL #include "struct.h" @@ -60,7 +57,7 @@ } /* ARGSUSED */ -main(argc, argv) +int main(argc, argv) int argc; char **argv; { @@ -72,7 +69,7 @@ printf("Warning: If you do not know how to use this program, break it now!\n"); status=(struct status *) malloc(sizeof(struct status)); scanf("%ld %d %d %d %d %lf\n", - &status->time, + (long int *) &status->time, &status->planets, &status->armsbomb, &status->kills, Index: nuke.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/nuke.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- nuke.c 21 Mar 2005 05:23:47 -0000 1.1 +++ nuke.c 12 May 2006 03:44:50 -0000 1.2 @@ -1,5 +1,7 @@ #include <stdio.h> #include "defs.h" +#include "struct.h" +#include "proto.h" int main(int argc, char **argv) { Index: setgalaxy.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/setgalaxy.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- setgalaxy.c 23 Apr 2006 11:21:01 -0000 1.4 +++ setgalaxy.c 12 May 2006 03:44:50 -0000 1.5 @@ -12,6 +12,8 @@ */ #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> #include "defs.h" #include "struct.h" #include "planets.h" @@ -288,6 +290,7 @@ } } +#ifdef notused static void CloseUp(int i) { int m, dx, dy, t = 200; dx = (planets[i].pl_x - 50000)/t; @@ -329,6 +332,7 @@ CloseUp(20); CloseUp(30); } +#endif static void CloseUpShop() { int i, m, dx[MAXPLANETS], dy[MAXPLANETS], t = 600; Index: trimscores.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/trimscores.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- trimscores.c 30 Sep 2005 05:46:19 -0000 1.2 +++ trimscores.c 12 May 2006 03:44:50 -0000 1.3 @@ -61,7 +61,7 @@ int fd; struct player j; - int count, kept; + int count, kept = 0; char buf[MAXBUFFER]; int harsh=10; /* How strict we will be with player trimming */ const LONG currenttime = time (NULL); @@ -76,7 +76,7 @@ fprintf(stderr," you're about to lose the player database\n"); status=(struct status *) malloc(sizeof(struct status)); scanf("%10ld %10d %10d %10d %10d %10lf\n", - &status->time, + (long int *) &status->time, &status->planets, &status->armsbomb, &status->kills, Index: showgalaxy.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/showgalaxy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- showgalaxy.c 21 Mar 2005 05:23:47 -0000 1.1 +++ showgalaxy.c 12 May 2006 03:44:50 -0000 1.2 @@ -364,14 +364,13 @@ int isinput(int delay) { struct timeval timeout; - int reads, writes, excepts; + fd_set reads; - writes=excepts=0; - reads=1; - timeout.tv_sec=delay/10; - timeout.tv_usec=(delay % 10) * 100000; - return (select(1, (fd_set *)&reads, (fd_set *)&writes, (fd_set *)&excepts, - (struct timeval *)&timeout)); + FD_ZERO(&reads); + FD_SET(1, &reads); + timeout.tv_sec = delay/10; + timeout.tv_usec = (delay % 10) * 100000; + return (select(1, &reads, NULL, NULL,&timeout)); } void showPlanets(void) Index: keyman.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/tools/keyman.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- keyman.c 22 Apr 2006 02:16:47 -0000 1.3 +++ keyman.c 12 May 2006 03:44:50 -0000 1.4 @@ -9,7 +9,7 @@ #include <stdio.h> #ifdef RSA #include <stdlib.h> -#include <string.h> +#include <unistd.h> #include <time.h> #include <sys/types.h> #include <sys/file.h> @@ -18,6 +18,7 @@ #include INC_FCNTL #include "struct.h" #include "data.h" +#include "proto.h" #define CATALOG "catalog"