X-Git-Url: http://git.shiar.net/netris.git/blobdiff_plain/647a237119ca10b9c3039c157594599e7ff50411..eb820d60637feceb84f559675344cf24a2c2f1cd:/util.c diff --git a/util.c b/util.c index 94a87f3..e3018f9 100644 --- a/util.c +++ b/util.c @@ -15,8 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: util.c,v 1.29 1999/05/16 06:56:33 mhw Exp $ */ #include "netris.h" @@ -33,8 +31,9 @@ #include "util.h" static MyEventType AlarmGenFunc(EventGenRec *gen, MyEvent *event); -static EventGenRec alarmGen = - { &alarmGen, 0, FT_read, -1, AlarmGenFunc, EM_alarm }; +static EventGenRec alarmGen = { + &alarmGen, 0, FT_read, -1, AlarmGenFunc, EM_alarm +}; static EventGenRec *nextGen = &alarmGen; static int myRandSeed = 1; @@ -58,35 +57,8 @@ void Header(void) fprintf(stderr, "NETRIS %s\t(c) 1994-1996,1999 Mark H. Weaver \n" " \t(c) 2002 Shiar \n\n", - version_string); -} - -void Usage(void) -{ - Header(); - fprintf(stderr, - "Usage: netris \n" - "\n" - " -h, --help\t\tPrint this usage information\n" - " -H, --info\t\tShow distribution and warranty information\n" - " -R, --rules\t\tShow game rules\n" - "\n" - " -S, --slowterm\tDisable inverse/bold/color for slow terminals\n" - " -a, --ascii\t\tUse ascii characters\n" - " -C, --color=0\t\tDisable color\n" - "\n" - " -c, --connect \tInitiate connection\n" - " -p, --port \tSet port number (default is %d)\n" - "\n" - " -t, --team \tJoin a team (don't receive lines from your teammates)\n" - " -l, --level \tBegin at a higher level (can be used as handicap)\n" - " -k, --keys \tRemap keys (default is \"%s\" for cursors)\n" - " -d, --dropmode\tDrops go into drop mode\n" - " -D, --instadrop\tInstant drop\n" - "\n" - " -r, --robot \tExecute program to control the game instead of keyboard\n" - " -F, --fair-robot\tUse fair robot interface\n" - "\n", DEFAULT_PORT, DEFAULT_KEYS); + version_string + ); } void DistInfo(void) @@ -105,7 +77,8 @@ void DistInfo(void) "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., 675 Mass Ave, Cambridge, MA 02139, USA.\n" - "\n"); + "\n" + ); } void Rules(void) @@ -129,7 +102,8 @@ void Rules(void) "multiple rows.\n" "\n" "The longest surviving player wins the game.\n" - "\n"); + "\n" + ); } ///////////// RANDOM ///////////// @@ -186,6 +160,24 @@ int MyWrite(int fd, void *data, int len) return len; } +///////////// CONFIG ///////////// + +void WriteConf(void) +{ + FILE *file_out; + + file_out = fopen(CONFIG_FILE, "w"); + if (file_out == NULL) { + perror("Error writing config file"); + exit(1); + } + + fprintf(file_out, "### NETRIS %s Config file ###\n\n", version_string); + + fclose(file_out); + fprintf(stderr, "Wrote new game configuration to %s\n", CONFIG_FILE); +} + ///////////// TIME ///////////// void NormalizeTime(struct timeval *tv) @@ -400,7 +392,3 @@ MyEventType WaitMyEvent(MyEvent *event, int mask) } } -/* - * vi: ts=4 ai - * vim: noai si - */