dicey-cvs Mailing List for Dicey
Brought to you by:
christhecat,
w0nderd0g
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(11) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(16) |
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mad...@us...> - 2004-03-06 23:41:28
|
Update of /cvsroot/dicey/dicey/random In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1840 Added Files: Makefile Log Message: builds the library and the two dicey functions - the dicey functions are written as both a standalone program and as library functions. --- NEW FILE: Makefile --- CC = gcc EXES = techroll combatroll all : libdicerand.a $(EXES) libdicerand.a : techroll.o combatroll.o r250.o ar cr libdicerand.a $? techroll : techroll.c $(CC) -o techroll -DTECH_ROLL_MAIN techroll.c -o techroll -L. -ldicerand combatroll : combatroll.c $(CC) -o combatroll -DCOMBAT_ROLL_MAIN combatroll.c -o combatroll -L. -ldicerand clean : rm -f *~ *.o $(EXES) libdicerand.a |
From: <mad...@us...> - 2004-03-06 23:40:21
|
Update of /cvsroot/dicey/dicey/random In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1652 Added Files: Readme Log Message: describes the API for the RNG and the interface to the dicey functions. --- NEW FILE: Readme --- This document purports to tell you how to use the r250 random number generator in your code. The first thing that you need to do is to call r250_srand() and pass it a seed value. If you do not call this function first then the default seed will be used to initialize the system. The other available functions are: int r250_rand(void) this returns a random integer 0 <= k < 65536 int r250_randn(unsigned n) this returns a random integer 0 <= k < n double r250_flat(void) this returns a random double 0 <= z < 1 There are two dicey related functions in the library: techroll and combatroll. techroll takes 3 parameters: number of dice to roll, a list of the available techs, and a list of the techs the player already has. Both of the tech lists are formatted the same: tech1/tech2/tech3.... It is up to the calling program to ensure that the case and spelling of the techs in both lists are the same. The return is in string form to facilitate use in online forms. There are at most 3 sections, but there will always be two sections of the response. The first section is the number of successful rolls, the second is the dice roll, and the third (which may be empty) is a list of the techs received. The hits in the second section are denoted by the asterisk character. Here are a couple of examples: techroll 3 "jet/rkt/ssb/lrg/ind/bmb" "ssb/lrg" 0:215: Result: no new techs techroll 3 "jet/rkt/ssb/lrg/ind/bmb" "ssb/lrg" 1:6*12:ind/ Result: 1 new tech, industry given techroll 3 "jet/rkt/ssb/lrg/ind/bmb" "ssb/lrg" 2:6*26*:ind/jet/ Result: 2 new techs, industry and jet power given Combatroll takes 2 arguments, the number of dice to roll and the highest dice value that constitutes a hit. The return is in string form and consists of two parts separated by the colon character. The first part is the number of hits and the second is the dice roll. Hits in the second section are denoted by the asterisk character. Here are some examples: combatroll 10 3 10:1*1*1*2*2*3*3*2*3*3* Result: 10 hits combatroll 10 3 4:1*1*6561*61*65 Result: 4 hits combatroll 10 1 1:346421*2552 Result: 1 hit |
From: <mad...@us...> - 2004-03-06 23:39:39
|
Update of /cvsroot/dicey/dicey/random In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1026 Added Files: combatroll.c Log Message: This is a combat roller for dicey. it takes as input the number of dice to roll and the highest value that would be a hit. it returns a string of 2 fields, separated by a :, the first is the number of hits, the second is the dice that were rolled. --- NEW FILE: combatroll.c --- #include <time.h> #include <string.h> #include "r250.h" char* combatroll(int die, int hit) { static int initialized = 0; static char retval[1024]; char hits[1024]; char this_roll[3]; char hits_prefix[8]; int nbr_rolls; int nbr_hits; int roll; /* ensure the random number generator is seeded */ if (!initialized) { r250_srand(time(NULL)); initialized = 1; } /* initialize the return value */ hits[0] = '\0'; nbr_hits = 0; /* ok, die rolling time */ for (nbr_rolls = 0; nbr_rolls < die; nbr_rolls++) { roll = r250_randn(6) + 1; memset(this_roll, '\0', 3); if (roll <= hit) { this_roll[1] = '*'; nbr_hits++; } this_roll[0] = '0' + roll; strcat(hits, this_roll); } sprintf(retval, "%d:%s", nbr_hits, hits); return retval; } #if defined(COMBAT_ROLL_MAIN) int main(int argc, char* argv[]) { printf("%s\n", combatroll(atoi(argv[1]), atoi(argv[2]))); } #endif |
From: <mad...@us...> - 2004-03-06 23:36:08
|
Update of /cvsroot/dicey/dicey/random In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32204 Added Files: techroll.c Log Message: generates tech rolls for dicey. it takes number of die to roll, list of available techs, and the techs the player already has as input. it returns a : separated set of 2 or 3 fields, the first the number of hits, the second is the dice themselves, the third (if present) is the techs the player received. --- NEW FILE: techroll.c --- #include <time.h> #include <string.h> #include "r250.h" enum limits { owned_tech_len = 2048, nbr_avail_techs = 64}; char* techroll(int die, char* tech_list, char* owned_techs) { static int initialized = 0; static char retval[1024]; char l_owned_techs[owned_tech_len]; char* ptr; int nbr_rolls; int tech_rolls = 0; int available_techs = 0; int nbr_owned_techs = 0; int offset[nbr_avail_techs]; int roll; /* ensure the random number generator is seeded */ if (!initialized) { r250_srand(time(NULL)); initialized = 1; } /* initialize the return value */ retval[0] = '\0'; /* determine how many techs there are to choose from. We also keep * track of the offset into the list so we can find the name of * the tech for comparison */ ptr = strtok(tech_list, "/"); while (ptr) { offset[available_techs] = ptr - tech_list; available_techs++; if (available_techs > nbr_avail_techs-1) return "*ERROR* Internal program error tr001"; ptr = strtok(NULL, "/"); } /* determine how many techs the player already owns */ if (strlen(owned_techs) > owned_tech_len) return "*ERROR* Internal program error tr002"; strcpy(l_owned_techs, owned_techs); ptr = strtok(owned_techs, "/"); while (ptr) { nbr_owned_techs++; ptr = strtok(NULL, "/"); } /* ok, now we roll the number of die to see how many techs the * player will get */ for (nbr_rolls = 0; nbr_rolls < die; nbr_rolls++) { roll = r250_randn(6) + 1; switch(roll) { case 1: strcat(retval, "1"); break; case 2: strcat(retval, "2"); break; case 3: strcat(retval, "3"); break; case 4: strcat(retval, "4"); break; case 5: strcat(retval, "5"); break; case 6: strcat(retval, "6*"); tech_rolls++; break; } } strcat(retval, ":"); for (nbr_rolls = 0; nbr_rolls < tech_rolls && nbr_owned_techs < available_techs; nbr_rolls++) { while (1) { roll = r250_randn(available_techs); if (strstr(l_owned_techs, &tech_list[offset[roll]]) == NULL) { strcat(l_owned_techs, "/"); strcat(l_owned_techs, &tech_list[offset[roll]]); strcat(retval, &tech_list[offset[roll]]); strcat(retval, "/"); nbr_owned_techs++; break; } } } return retval; } #if defined(TECH_ROLL_MAIN) int main(int argc, char* argv[]) { printf("%s\n", techroll(atoi(argv[1]), argv[2], argv[3])); } #endif |
From: <mad...@us...> - 2004-03-06 23:27:15
|
Update of /cvsroot/dicey/dicey/random In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31792 Added Files: r250.c r250.h Log Message: Random number generator by Ed Hill, put in the public domain --- NEW FILE: r250.c --- // // Ed Hill // Fri May 23 14:43:15 EDT 1997 // // CMRRGenerator : // // A virtual psuedo-random generator class for wrapping // simple low-level integer and double-precision RNGs. // #include "r250.h" static unsigned long _r250_seed = 1; static int _r250_index = -1; static unsigned int _r250_buffer[250]; static void _r250_init_buffer(void); static unsigned int _r250_myrand(void); void r250_srand(int seed) { int j, k; unsigned int mask; unsigned int msb; _r250_seed = (unsigned long)seed; _r250_init_buffer(); // The following is from r250_init(int seed) code. // mysrand(seed); This simply set seed to value from the arg newseed. _r250_index = 0; for (j = 0; j < 250; j++) /* Fill the r250 buffer with 15-bit values */ _r250_buffer[j] = _r250_myrand(); for (j = 0; j < 250; j++) /* Set some of the MS bits to 1 */ if (_r250_myrand() > 16384) _r250_buffer[j] |= 0x8000; msb = 0x8000; /* To turn on the diagonal bit */ mask = 0xffff; /* To turn off the leftmost bits */ for (j = 0; j < 16; j++) { k = 11 * j + 3; /* Select a word to operate on */ _r250_buffer[k] &= mask; /* Turn off bits left of the diagonal */ _r250_buffer[k] |= msb; /* Turn on the diagonal bit */ mask >>= 1; msb >>= 1; } } static void _r250_init_buffer() { unsigned int* b = _r250_buffer; b[ 0]=15301; b[ 1]=57764; b[ 2]=10921; b[ 3]=56345; b[ 4]=19316; b[ 5]=43154; b[ 6]=54727; b[ 7]=49252; b[ 8]=32360; b[ 9]=49582; b[ 10]=26124; b[ 11]=25833; b[ 12]=34404; b[ 13]=11030; b[ 14]=26232; b[ 15]=13965; b[ 16]=16051; b[ 17]=63635; b[ 18]=55860; b[ 19]= 5184; b[ 20]=15931; b[ 21]=39782; b[ 22]=16845; b[ 23]=11371; b[ 24]=38624; b[ 25]=10328; b[ 26]= 9139; b[ 27]= 1684; b[ 28]=48668; b[ 29]=59388; b[ 30]=13297; b[ 31]= 1364; b[ 32]=56028; b[ 33]=15687; b[ 34]=63279; b[ 35]=27771; b[ 36]= 5277; b[ 37]=44628; b[ 38]=31973; b[ 39]=46977; b[ 40]=16327; b[ 41]=23408; b[ 42]=36065; b[ 43]=52272; b[ 44]=33610; b[ 45]=61549; b[ 46]=58364; b[ 47]= 3472; b[ 48]=21367; b[ 49]=56357; b[ 50]=56345; b[ 51]=54035; b[ 52]= 7712; b[ 53]=55884; b[ 54]=39774; b[ 55]=10241; b[ 56]=50164; b[ 57]=47995; b[ 58]= 1718; b[ 59]=46887; b[ 60]=47892; b[ 61]= 6010; b[ 62]=29575; b[ 63]=54972; b[ 64]=30458; b[ 65]=21966; b[ 66]=54449; b[ 67]=10387; b[ 68]= 4492; b[ 69]= 644; b[ 70]=57031; b[ 71]=41607; b[ 72]=61820; b[ 73]=54588; b[ 74]=40849; b[ 75]=54052; b[ 76]=59875; b[ 77]=43128; b[ 78]=50370; b[ 79]=44691; b[ 80]= 286; b[ 81]=12071; b[ 82]= 3574; b[ 83]=61384; b[ 84]=15592; b[ 85]=45677; b[ 86]= 9711; b[ 87]=23022; b[ 88]=35256; b[ 89]=45493; b[ 90]=48913; b[ 91]= 146; b[ 92]= 9053; b[ 93]= 5881; b[ 94]=36635; b[ 95]=43280; b[ 96]=53464; b[ 97]= 8529; b[ 98]=34344; b[ 99]=64955; b[100]=38266; b[101]=12730; b[102]= 101; b[103]=16208; b[104]=12607; b[105]=58921; b[106]=22036; b[107]= 8221; b[108]=31337; b[109]=11984; b[110]=20290; b[111]=26734; b[112]=19552; b[113]= 48; b[114]=31940; b[115]=43448; b[116]=34762; b[117]=53344; b[118]=60664; b[119]=12809; b[120]=57318; b[121]=17436; b[122]=44730; b[123]=19375; b[124]= 30; b[125]=17425; b[126]=14117; b[127]= 5416; b[128]=23853; b[129]=55783; b[130]=57995; b[131]=32074; b[132]=26526; b[133]= 2192; b[134]=11447; b[135]= 11; b[136]=53446; b[137]=35152; b[138]=64610; b[139]=64883; b[140]=26899; b[141]=25357; b[142]= 7667; b[143]= 3577; b[144]=39414; b[145]=51161; b[146]= 4; b[147]=58427; b[148]=57342; b[149]=58557; b[150]=53233; b[151]= 1066; b[152]=29237; b[153]=36808; b[154]=19370; b[155]=17493; b[156]=37568; b[157]= 3; b[158]=61468; b[159]=38876; b[160]=17586; b[161]=64937; b[162]=21716; b[163]=56472; b[164]=58160; b[165]=44955; b[166]=55221; b[167]=63880; b[168]= 1; b[169]=32200; b[170]=62066; b[171]=22911; b[172]=24090; b[173]=10438; b[174]=40783; b[175]=36364; b[176]=14999; b[177]= 2489; b[178]=43284; b[179]= 9898; b[180]=39612; b[181]= 9245; b[182]= 593; b[183]=34857; b[184]=41054; b[185]=30162; b[186]=65497; b[187]=53340; b[188]=27209; b[189]=45417; b[190]=37497; b[191]= 4612; b[192]=58397; b[193]=52910; b[194]=56313; b[195]=62716; b[196]=22377; b[197]=40310; b[198]=15190; b[199]=34471; b[200]=64005; b[201]=18090; b[202]=11326; b[203]=50839; b[204]=62901; b[205]=59284; b[206]= 5580; b[207]=15231; b[208]= 9467; b[209]=13161; b[210]=58500; b[211]= 7259; b[212]= 317; b[213]=50968; b[214]= 2962; b[215]=23006; b[216]=32280; b[217]= 6994; b[218]=18751; b[219]= 5148; b[220]=52739; b[221]=49370; b[222]=51892; b[223]=18552; b[224]=52264; b[225]=54031; b[226]= 2804; b[227]=17360; b[228]= 1919; b[229]=19639; b[230]= 2323; b[231]= 9448; b[232]=43821; b[233]=11022; b[234]=45500; b[235]=31509; b[236]=49180; b[237]=35598; b[238]=38883; b[239]=19754; b[240]= 987; b[241]=11521; b[242]=55494; b[243]=38056; b[244]=20664; b[245]= 2629; b[246]=50986; b[247]=31009; b[248]=54043; b[249]=59743; } static unsigned int _r250_myrand() { if (_r250_index == -1) { r250_srand(42); } _r250_seed = _r250_seed*0x015a4e35L + 1; return (_r250_seed>>16)&0x7fff; } int r250_seed() { return _r250_seed; } int r250_rand() { // This code is taken from the function r250() and it returns a // random unsigned integer k uniformly distributed in the interval 0 // <= k < 65536. register int j; register unsigned int new_rand; if (_r250_index == -1) { r250_srand(42); } if (_r250_index >= 147) j = _r250_index - 147; /* Wrap pointer around */ else j = _r250_index + 103; new_rand = _r250_buffer[_r250_index] ^= _r250_buffer[j]; if (_r250_index >= 249) /* Increment pointer for next time */ _r250_index = 0; else _r250_index++; return new_rand; } int r250_imax() { return 65536; } int r250_randn(unsigned n) { // This code is taken from the function r250n() and it returns a // random unsigned integer k uniformly distributed in the interval 0 // <= k < n. register int j; register unsigned int new_rand, limit; if (_r250_index == -1) { r250_srand(42); } limit = (65535U/n)*n; do { new_rand = r250_rand(); if (_r250_index >= 147) j = _r250_index - 147; /* Wrap pointer around */ else j = _r250_index + 103; new_rand = _r250_buffer[_r250_index] ^= _r250_buffer[j]; if (_r250_index >= 249) /* Increment pointer for next time */ _r250_index = 0; else _r250_index++; } while(new_rand >= limit); return new_rand%n; } double r250_flat() { // This code is taken from the function dr250() and it returns a // random double z uniformly distributed in the interval 0 <= z < 1. register int j; register unsigned int new_rand; if (_r250_index == -1) { r250_srand(42); } if (_r250_index >= 147) j = _r250_index - 147; /* Wrap pointer around */ else j = _r250_index + 103; new_rand = _r250_buffer[_r250_index] ^= _r250_buffer[j]; if (_r250_index >= 249) /* Increment pointer for next time */ _r250_index = 0; else _r250_index++; return new_rand / 65536.; /* Return a number in [0.0 to 1.0) */ } --- NEW FILE: r250.h --- // // Ed Hill // Fri May 23 14:43:15 EDT 1997 // // CMRRGenerator : // // A virtual psuedo-random generator class for wrapping // simple low-level integer and double-precision RNGs. // #ifndef R250_H #define R250_H void r250_srand(int seed); int r250_seed(); // return current seed value int r250_rand(); // return UDI in 0 <= k < 65536 int r250_imax(); // return max+1 of inum() int r250_randn(unsigned n); // return UDI in 0 <= k < n double r250_flat(); // return UDD z in 0 <= z < 1 #endif |
From: <mad...@us...> - 2004-03-06 23:24:59
|
Update of /cvsroot/dicey/dicey/random In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31625/random Log Message: Directory /cvsroot/dicey/dicey/random added to the repository |
Update of /cvsroot/dicey/dicey/standard In directory sc8-pr-cvs1:/tmp/cvs-serv5314 Modified Files: como.cgi.c create.cgi.c delete.cgi.c dicey.h gamecreate.c index.cgi.c login.cgi.c logincreate.c rolls.cgi.c tech.cgi.c Log Message: intermediate save Index: como.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/como.cgi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** como.cgi.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- como.cgi.c 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 1,23 **** #include <stdio.h> #include <stdlib.h> - #include "yacgi.h" #include <string.h> #include <sys/file.h> #include <time.h> ! #define REPLYADDRESS "\"Dicey\" <di...@aa...>" ! #define FROMADDRESS "\"Dicey\" <di...@aa...>" ! enum playertypes {NOBODY=0,EMAILT,OPPT,BOTHT,GAMET}; ! static char *combattext; ! static FILE *logfile; ! static FILE *tempfile; static int playertype; - static CGI *cgi; - - static char gamenr[5]; main(int argc, char *argv[]) { --- 1,19 ---- #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/file.h> #include <time.h> ! #include "dicey.h" ! #include "cgi-util.h" ! static char* combattext; ! static FILE* logfile; ! static FILE* tempfile; static int playertype; static char gamenr[5]; + int main(int argc, char *argv[]) { *************** *** 30,37 **** register int j; ! char email[51]; ! char opp[51]; char country; ! char rd[3]; int techs; char *hiddenline; --- 26,33 ---- register int j; ! char email[EMAIL_LEN+1]; ! char opp[EMAIL_LEN+1]; char country; ! int turn_nbr; int techs; char *hiddenline; *************** *** 44,61 **** int atthits; - void er(char *,int); char syscommand[L_tmpnam+300]; - int getnr(char *); - int tid(char *); ! printf("Content-type: text/html %c%c",10,10); ! cgi = cgiOpen(); ! if(!cgi) ! exit(1); if(printf("<html><body>")<0) exit(1); ! if(!(cgiFirst(cgi))) ! er(" 710 - system error system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"d")) er(" 711 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); --- 40,59 ---- int atthits; char syscommand[L_tmpnam+300]; ! if (cgi_init() != CGIERR_NONE) { ! printf("Content-type: text/html %c%c", 10, 10); ! htmlheader(stdout, "CGI System Error"); ! printf("<p><span class=\"note\">%s</span></p>\n", ! cgi_strerror(cgi_errno)); ! printf("</body></html>\n"); ! exit(EXIT_FAILURE); ! } + printf("Content-type: text/html \n\n"); + if(printf("<html><body>")<0) exit(1); ! if(strcmp(cgiName(cgi),"d")) er(" 711 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); *************** *** 65,70 **** er(" 712 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); - if(!cgiNext(cgi)) - er(" 717 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"c")) er(" 718 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); --- 63,66 ---- *************** *** 72,130 **** - if(!cgiNext(cgi)) - er(" 713 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"i")) er(" 714 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); inf=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 715 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"a")) er(" 716 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); arm=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 719 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"g")) er(" 720 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); aa=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 721 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"f")) er(" 722 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); ftr=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 723 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"b")) er(" 724 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); bmb=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 725 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"t")) er(" 726 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); trn=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 727 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"s")) er(" 728 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); sub=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 729 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"v")) er(" 730 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); ac=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 731 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"k")) er(" 732 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); bb=getnr(cgiValue(cgi)); ! if(!cgiNext(cgi)) ! er(" 798 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"z")) er(" 799 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); ic=getnr(cgiValue(cgi)); - - - if(!cgiNext(cgi)) - er(" 733 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); if(strcmp(cgiName(cgi),"m")) er(" 734 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); --- 68,111 ---- if(strcmp(cgiName(cgi),"i")) er(" 714 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); inf=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"a")) er(" 716 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); arm=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"g")) er(" 720 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); aa=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"f")) er(" 722 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); ftr=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"b")) er(" 724 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); bmb=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"t")) er(" 726 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); trn=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"s")) er(" 728 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); sub=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"v")) er(" 730 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); ac=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"k")) er(" 732 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); bb=getnr(cgiValue(cgi)); ! if(strcmp(cgiName(cgi),"z")) er(" 799 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); ic=getnr(cgiValue(cgi)); if(strcmp(cgiName(cgi),"m")) er(" 734 - a system error occurred:<br>Try again, if that doesn\'t work try logging in again",0); *************** *** 139,143 **** if(total>cash) ! er(" 735 - You haven\'t got enough cash to buy that many units",0); if(*combattext=='\0') --- 120,124 ---- if(total>cash) ! er(" 735 - You haven't got enough cash to buy that many units",0); if(*combattext=='\0') *************** *** 699,701 **** return 0; } ! \ No newline at end of file --- 680,682 ---- return 0; } ! Index: create.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/create.cgi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** create.cgi.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- create.cgi.c 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 5,15 **** #include <ctype.h> ! #include "yacgi.h" #include "dicey.h" static FILE *fp; FILE* logfile = NULL; - - CGI *cgi; /* This script creates a new game between two A&A players. Input --- 5,13 ---- #include <ctype.h> ! #include "cgi-util.h" #include "dicey.h" static FILE *fp; FILE* logfile = NULL; /* This script creates a new game between two A&A players. Input Index: delete.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/delete.cgi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** delete.cgi.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- delete.cgi.c 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 2,6 **** #include <stdlib.h> #include <string.h> ! #include "yacgi.h" #include <sys/file.h> #include <ctype.h> --- 2,6 ---- #include <stdlib.h> #include <string.h> ! #include "cgi-util.h" #include <sys/file.h> #include <ctype.h> *************** *** 9,13 **** static FILE *fp; - static CGI *cgi; /* This script deletes a game of A&A between two players. Input data is: --- 9,12 ---- *************** *** 157,159 **** cgiClose(cgi); exit(1); ! } \ No newline at end of file --- 156,158 ---- cgiClose(cgi); exit(1); ! } Index: dicey.h =================================================================== RCS file: /cvsroot/dicey/dicey/standard/dicey.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dicey.h 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- dicey.h 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 4,7 **** --- 4,8 ---- #define REPLYADDRESS "\"Dicey\" <di...@aa...>" #define FROMADDRESS "\"Dicey\" <di...@aa...>" + #define ENTITY "AAMC" #include "diceydefs.h" Index: gamecreate.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/gamecreate.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gamecreate.c 13 Nov 2003 03:07:23 -0000 1.2 --- gamecreate.c 11 Jan 2004 05:51:10 -0000 1.3 *************** *** 1,4 **** #include "dicey.h" ! #include "yacgi.h" void --- 1,6 ---- + #include <stdlib.h> + #include "dicey.h" ! #include "cgi-util.h" void Index: index.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/index.cgi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.cgi.c 9 Jan 2004 23:26:59 -0000 1.2 --- index.cgi.c 11 Jan 2004 05:51:10 -0000 1.3 *************** *** 42,46 **** long game_nbr; char country[COUNTRY_LEN+1]; ! long turn_nbr; char send_mail[4]; int techs=0; --- 42,46 ---- long game_nbr; char country[COUNTRY_LEN+1]; ! int turn_nbr; char send_mail[4]; int techs=0; *************** *** 137,785 **** logincreate(0, "", "", errors, form_techs, 0); exit (0); - - if(game_nbr >= 0) { - if (own_dogtag[0] == '\0') - er(" 13 - When playing a game with a game number you must " - "also supply your dogtag.", 0); - - if(opp_dogtag[0] == '\0') - er(" 14 - When playing a game with a game number you must " - "also supply your opponents dogtag.", 0); - - sprintf(filename,"./aamc/l%08ld.txt", game_nbr); - - if((fp = fopen(filename,"r")) == NULL) { - gamecreate(game_nbr, own_dogtag, "", opp_dogtag, "", 0); - cgi_quit(); - fp = fopen(filename, "r"); - } - - /* The file with login data is now open */ - - if (fgets(own_email, sizeof(char)*EMAIL_LEN, fp) == NULL) - er(" 19 - a system error occured. Try again.",0); - - if (fgets(opp_email, sizeof(char)*EMAIL_LEN, fp) == NULL) - er(" 19 - a system error occured. Try again.",0); - - if(fclose(fp)) - er(" 18 - a system error occured. Try again.",0); - - verified = 0; - if (strncasecmp(own_email, own_dogtag, strlen(own_dogtag)) == 0) { - verified++; - } - - if (verified != 1) - emer("Your dogtag was not recognized. " - "Please check that the data was entered correctly."); - - if (strncasecmp(opp_email, opp_dogtag, strlen(opp_dogtag)) == 0) { - verified++; - } - - if (verified != 2) { - emer("Your opponents dogtag was not recognized. " - "Please check that the data was entered correctly."); - } - - playertype=GAMET; - } - else if(own_email == NULL) - playertype = ((opp_email == NULL) ? NOBODY : OPPT); - else - playertype = ((opp_email == NULL) ? EMAILT : BOTHT); - - if(playertype != GAMET) - game_nbr = -1; - - /* The players have now been identified and accepted */ - - if(turn_nbr == -2) - er(" 25 - The turn number must consist of one or two digits.", 0); - - /* Since techs have already been loaded everything is now ready */ - - /* We now roll for techs if that is needed. */ - - if(mailsend == 1) { - if(batmat[0][TECH]) { - dicepoint = dicerolls; - if(techs == AllTechs) - er(" 90 - no need to roll for technologies. " - "You already have all of them.", 0); - - j = 2 * batmat[0][TECH] + 12; - - if(dice(dicepoint,j)) - er(" 26 - a system error occurred while rolling the dice <br />" - "Try again, if that doesn't work try logging in again", 0); - - *(dicepoint+j)='\0'; - - techcount = 0; - - atttext += sprintf(atttext, "Already have: %s%s%s%s%s%s%s", - (techs & JetPowerTech) ? "Jet Power, " : "", - (techs & RocketTech) ? "Rockets, " : "", - (techs & SuperSubTech) ? "Super Submarines, " : "", - (techs & LongRangeTech) ? "Long Range Aircraft, " : "", - (techs & IndTech) ? "Industrial Technology, " : "", - (techs & HvyBomberTech) ? "Heavy Bombers, " : "", - (!techs) ? "No technologies, " : ""); - atttext-=2; - *atttext++ = '\n'; - atttext += sprintf(atttext, "%i Tech rolls: ", batmat[0][TECH]); - if(techs & JetPowerTech) - techcount++; - if(techs & RocketTech) - techcount++; - if(techs & SuperSubTech) - techcount++; - if(techs & LongRangeTech) - techcount++; - if(techs & IndTech) - techcount++; - if(techs & HvyBomberTech) - techcount++; - techcount = 6 - techcount; - - for(j = 0;j < batmat[0][TECH];j++) { - if(hits < techcount) { - if((*atttext++ = *dicepoint++) == '6') { - *atttext++ = '*'; - hits++; - } - } - else - *atttext++ = '-'; - } - - atttext += sprintf(atttext,"\n%i New techs obtained: ", hits); - if(!hits) - sprintf(atttext,"None"); - - if(hits == techcount) { - sprintf(atttext, "You now have all technologies"); - techs = AllTechs; - hits = 0; - } - - techcount = 0; - while(hits) { - switch(*atttext++ = *dicepoint++) { - case '1': - j = JetPowerTech; - break; - - case '2': - j = RocketTech; - break; - - case '3': - j = SuperSubTech; - break; - - case '4': - j = LongRangeTech; - break; - - case '5': - j = IndTech; - break; - - default: - j = HvyBomberTech; - } - - if(!(techs & j)) { - techcount |= j; - techs |= j; - hits--; - } - - if(*dicepoint == '\0') { - dicepoint = dicerolls; - if(dice(dicepoint,49)) - er(" 28 - a system error occurred while rolling the dice <br />" - "Try again, if that doesn't work try logging in again", 0); - dicerolls[49] = '\0'; - } - } - - if(techcount) { - atttext += sprintf(atttext, "\nYou gained: "); - if(techcount & JetPowerTech) - atttext += sprintf(atttext, "Jet Power, "); - - if(techcount & RocketTech) - atttext += sprintf(atttext, "Rockets, "); - - if(techcount & SuperSubTech) - atttext += sprintf(atttext, "Super Submarines, "); - - if(techcount & LongRangeTech) - atttext += sprintf(atttext, "Long Range Aircraft, "); - - if(techcount & IndTech) - atttext += sprintf(atttext, "Industrial Technology, "); - - if(techcount & HvyBomberTech) - atttext += sprintf(atttext, "Heavy Bombers, "); - - *(atttext-2) = '\0'; - } - - if(tid(presenttime)) - er(" 150 - a system error occurred.<br />" - "Try again, and if that doesn't work try logging in again.", - 0); - - atttext = atttextback; - - if(playertype != NOBODY) { - tempname = tmpnam(NULL); - if((tempfile = fopen(tempname,"w")) == NULL) - er(" 29 - a system error occurred while opening a file <br />" - "Try again, if that doesn't work try logging in again", - 0); - - if(fprintf(tempfile, "Subject:%s%ld %s %ld: %i %s\n" - "Reply-To: %s\n" - "From: %s\n", - (playertype == GAMET) ? " Game # " : "A&A Rolls", - (playertype == GAMET) ? game_nbr : -1, - country, turn_nbr, batmat[0][TECH], - "Tech Rolls", REPLYADDRESS, FROMADDRESS)<0) - er(" 162 - a system error occurred.<br />" - "Try again, and if that doesn't work try logging in again.",0); - if(fprintf(tempfile, "Game # %ld %s vs %s - %s %ld - %s\n", - game_nbr, own_email, opp_email, country, turn_nbr, - presenttime) < 0) - er(" 31 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 0); - - if(fprintf(tempfile, "\n%s", atttext) < 0) - er(" 130 - a system error occurred <br />" - "Try again, if that doesn't work try logging in again", - 0); - } - - if(playertype==GAMET) { - sprintf(logname,"./aamc/g%08ld.html",game_nbr); - - if((logfile = fopen(logname,"r+b")) == NULL) - er(" 37 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 0); - - if(flock(logfile->_fileno, LOCK_EX)) { - fclose(logfile); - er(" 38 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 0); - } - - if(fseek(logfile, -14L, SEEK_END)) - er(" 39 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 2); - - if(fprintf(logfile,"<br /><br />") < 0) - er(" 40 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 2); - - if(fprintf(logfile,"<p>Game #%ld ", game_nbr) < 0) - er(" 153 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 2); - - if (own_email) - fprintf(logfile, "%s", htmlize(own_email)); - else - fputc('-',logfile); - - fprintf(logfile," vs "); - - if(opp_email) - fprintf(logfile, "%s", htmlize(opp_email)); - else - fputc('-',logfile); - - if(fprintf(logfile," - %s %ld - %s</p>", country, - turn_nbr, presenttime) < 0) - er(" 130 - a system error occurred.<br />" - "Try again, if that doesn't work try logging in again", - 2); - - fprintf(logfile,"<p>"); - - for(j = 0;*(atttext+j) != '\0';j++) { - if(*(atttext+j) == '\n') - fprintf(logfile,"<br />\n"); - else - fputc(*(atttext+j),logfile); - } - - fprintf(logfile,"</p></body></html>"); - - if(flock(logfile->_fileno, LOCK_UN)) { - fclose(logfile); - er(" 42 - a system error occurred while unlocking a file <br />" - "Try again, if that doesn't work try logging in again", - 2); - } - - if(fclose(logfile)) - er(" 43 - a system error occurred while closing a file <br />" - "Try again, if that doesn't work try logging in again", - 1); - } - - atttext = atttextback; - } - - /* 480 we have now created both the log and the e-mails - * according to the tech rolls */ - - /* email, opp, game_nbr, turn_nbr, country, techs contains all - * necessary information */ - /* We start creating the battle page */ - - printf("<body><form method=post action=\"bat.cgi\"><p>Game # %ld ", - game_nbr); - - if(own_email) - printf("%s", htmlize(own_email)); - else - putchar('-'); - - printf(" vs "); - - - if(opp_email) - printf("%s", htmlize(opp_email)); - else - putchar('-'); - - printf(" - %s %ld", country, turn_nbr); - printf("<input name=\"d\" type=hidden value=\"%i %ld ", playertype, - game_nbr); - - if(own_email) - printf("%s", htmlize(own_email)); - else - putchar('-'); - - putchar(' '); - - if(opp_email) - printf("%s", htmlize(opp_email)); - else - putchar('-'); - - printf(" %c %ld %x 0\"></p>", (char)tolower(*country), turn_nbr, techs); - - if(batmat[0][TECH]) { - printf("<p>"); - for(j = 0;*(atttext+j) != '\0';j++) { - if(*(atttext+j) == '\n') - printf("<br />\n"); - else - putchar(*(atttext+j)); - } - - printf("<br /></p>"); - } - - printf("<p>Area: <input type=\"text\" name=\"a\" maxlength=\"17\" size=\"7\"> " - "Roll: <select name=\"t\">" - "<option selected>Both attacker and defender" - "<option>Attacker only" - "<option>Defender only" - "<option>Attacking Subs only" - "<option>Attacking units but not Subs" - "<option>AntiAircraft Gun only" - "<option>KAAC" - "<option>RIO" - "<option>Save Air" - "</select> " - "Comment: <input type=\"text\" name=\"c\" maxlength=\"80\" size=\"20\"></p>"); - - printf("<table><tr>" - "<td>Unit</td>" - "<td>Inf</td>" - "<td>Arm</td>" - "<td>Ftr</td>" - "<td>Jet</td>" - "<td>Bmb/HB</td>" - "<td>Trn</td>" - "<td>Sub/SS</td>" - "<td>AC</td>" - "<td>BB</td>" - "<td>%s</td></tr>", - (techs & RocketTech) ? "Rocket attack?</td><td><select name=\"r\"><option selected>NO<option>YES</select>":"</td><td>"); - printf("<tr>" - "<td>Attacker</td>" - "<td><input type=\"text\" name=\"ai\" maxlength=\"3\" size=\"3\"></td>" - "<td><input type=\"text\" name=\"aa\" maxlength=\"2\" size=\"2\"></td>"); - - if(!(techs & JetPowerTech)) - printf("<td><input type=\"text\" name=\"af\" maxlength=\"2\" size=\"2\"></td><td>"); - else - printf("<td></td><td><input type=\"text\" name=\"aj\" maxlength=\"2\" size=\"2\">"); - - printf("</td>" - "<td><input type=\"text\" name=\"ab\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"at\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"as\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"ac\" maxlength=\"1\" size=\"1\"></td>" - "<td><input type=\"text\" name=\"abb\" maxlength=\"1\" size=\"1\"></td>"); - printf("<td>Strategic bombing?</td>" - "<td><select name=\"s\">" - "<option selected>NO" - "<option>YES" - "</select></td></tr>"); - printf("<tr>" - "<td>Defender</td>" - "<td><input type=\"text\" name=\"di\" maxlength=\"3\" size=\"3\"></td>" - "<td><input type=\"text\" name=\"da\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"df\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"dj\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"db\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"dt\" maxlength=\"2\" size=\"2\"></td>"); - printf("<td><input type=\"text\" name=\"ds\" maxlength=\"2\" size=\"2\"></td>" - "<td><input type=\"text\" name=\"dc\" maxlength=\"1\" size=\"1\"></td>" - "<td><input type=\"text\" name=\"dbb\" maxlength=\"1\" size=\"1\"></td>" - "<td>Is an AA gun firing?</td>" - "<td><select name=\"ag\"><option selected>NO<option>YES</select></td></tr></table>"); - - printf("<p><input type=submit><input type=reset><a href=\"help.html\">HELP</a></p></form></body></html>"); - - /* Html pages have been constructed, now send mail */ - - if(playertype != NOBODY && batmat[0][TECH]) { - fclose(tempfile); - sprintf(syscommand,"/usr/sbin/sendmail %s%c%s < %s > unerr.txt &", - (playertype == EMAILT || - playertype == BOTHT || - playertype == GAMET) ? own_email : "", - (playertype == BOTHT || - playertype == GAMET) ? ',' : ' ', - (playertype == OPPT || - playertype == BOTHT || - playertype == GAMET) ? opp_email : "", tempname); - system(syscommand); - } - - /* Mail has now been sent, let us close down */ - - cgi_quit(); - exit(0); - } - else { - if(tech) { - techcount=0; - if(techs & JetPowerTech) - techcount++; - if(techs & RocketTech) - techcount++; - if(techs & SuperSubTech) - techcount++; - if(techs & LongRangeTech) - techcount++; - if(techs & IndTech) - techcount++; - if(techs & HvyBomberTech) - techcount++; - - if(techcount == 6) - er(" 500 - you already have all technologies. " - "It doesn't make sense to make more technology rolls.", 0); - - /* email, opp, nr, rd, country, techs contains all - * necessary information */ - /* We start creating the technology page */ - - htmlheader(stdout, "Tech.cgi"); - printf("<form method=post action=\"tech.cgi\"><p>Game # %ld ", - game_nbr); - - if(own_email) - printf("%s", htmlize(own_email)); - else - putchar('-'); - - printf(" vs "); - - if(opp_email) - printf("%s", htmlize(opp_email)); - else - putchar('-'); - - printf(" - %s %ld",country, turn_nbr); - printf("<input name=\"d\" type=hidden value=\"%i %ld ", - playertype, game_nbr); - - if(own_email) - printf("%s", htmlize(own_email)); - else - putchar('-'); - - putchar(' '); - - if(opp_email) - printf("%s", htmlize(opp_email)); - else - putchar('-'); - - printf(" %c %ld %x 0\"></p>", - (char)tolower(*country), turn_nbr, techs); - - printf("<p>Cash the country has at the start of the turn: " - "<input type=\"text\" name=\"c\" maxlength=\"3\" size=\"2\"> I.P.C</p>"); - printf("<span class=\"note\">Weapons Development</span>"); - printf("<p>Already have: "); - if(techs == 0) - printf("No technologies"); - if(techs & JetPowerTech) - printf("Jet Power"); - if(techs & RocketTech) { - if(techs & JetPowerTech) - printf(", "); - printf("Rockets"); - } - - if(techs & SuperSubTech) { - if(techs & 0x30) - printf(", "); - printf("Super Submarines"); - } - - if(techs & LongRangeTech) { - if(techs & 0x38) - printf(", "); - printf("Long Range Aircraft"); - } - - if(techs & IndTech) { - if(techs & 0x3c) - printf(", "); - printf("Industrial Technology"); - } - - if(techs & HvyBomberTech) { - if(techs & 0x3e) - printf(", "); - printf("Heavy Bombers"); - } - - printf("</p><p>Number of technology rolls you wish to purchase: " - "<input type=\"text\" name=\"n\" maxlength=\"2\" size=\"1\" value=\"%d\"></p>", tech); - printf("<p>Comment: <input type=\"text\" name=\"r\" maxlength=\"100\" size=\"80\"></p>"); - printf("<p><input type=submit><input type=reset><a href=\"techhelp.html\">HELP</a></p></form></body></html>"); - } - else { - htmlheader(stdout, "Combat Movement"); - printf("<form method=post action=\"como.cgi\">\n<p>"); - - if (game_nbr >= 0) - printf("Game #%ld ", game_nbr); - - if ((own_email[0] == '\0') && (opp_email[0] == '\0')) { - printf("<span class=\"note\">Warning: you didn't enter a game number. Combat will not be logged.</span>"); - } else if ((own_email[0] != '\0') && (opp_email[0] != '\0')) { - printf("%s - ", htmlize(own_email)); - printf("%s ", htmlize(opp_email)); - printf(" - %s ", country); - } - else { - if(own_email[0] != '\0') - printf("%s", htmlize(own_email)); - else - putchar('-'); - - printf(" vs "); - - if (opp_email[0] != '\0') - printf("%s", htmlize(opp_email)); - else - putchar('-'); - - printf(" - %s ", country); - } - - if (turn_nbr >= 0) - printf("%ld", turn_nbr); - - printf("\n"); - - printf("<input name=\"playertype\" type=\"hidden\" value=\"%i\">\n", - playertype); - printf("<input name=\"turn_nbr\" type=\"hidden\" value=\"%ld\">\n", - turn_nbr); - - printf("<input name=\"own_email\" type=\"hidden\" value=\""); - if(own_email) - printf("%s\">\n", htmlize(own_email)); - else - printf("-\">\n"); - - - printf("<input name=\"opp_email\" type=\"hidden\" value=\""); - if(opp_email) - printf("%s\">\n", htmlize(opp_email)); - else - printf("-\">\n"); - - printf("<input name=\"country\" type=\"hidden\" value=\"%c\">\n", - (char)tolower(*country)); - - printf("<input name=\"techs\" type=\"hidden\" value=\"%x\">\n", - techs); - - printf("</p>\n"); - printf("<p>Cash the country has at the start of the turn: " - "<input type=\"text\" name=\"c\" maxlength=\"3\" size=\"2\"></p>\n"); - printf("<span class=\"note\">Purchase</span>"); - printf("<table><tr>" - "<td>Inf</td>" - "<td>Arm</td>" - "<td>AA</td>" - "<td>%s%s</td>" - "<td>%s%s</td>" - "<td>Trn</td>" - "<td>%s</td>" - "<td>AC</td>" - "<td>BB</td>" - "<td>IC</td></tr>\n", - (techs & LongRangeTech) ? "LR" : "", - (techs & JetPowerTech) ? "Jet" : "Ftr", - (techs & LongRangeTech) ? "LR" : "", - (techs & HvyBomberTech) ? "Hbmb" : "Bmb", - (techs & SuperSubTech) ? "Ssub" : "Sub"); - printf("<tr><td><input type=\"text\" name=\"i\" maxlength=\"2\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"a\" maxlength=\"2\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"g\" maxlength=\"1\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"f\" maxlength=\"1\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"b\" maxlength=\"1\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"t\" maxlength=\"1\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"s\" maxlength=\"1\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"v\" maxlength=\"1\" size=\"2\"></td>\n"); - printf("<td><input type=\"text\" name=\"k\" maxlength=\"1\" size=\"2\"></td>\n" - "<td><input type=\"text\" name=\"z\" maxlength=\"1\" size=\"2\"></td></tr></table>\n"); - printf("<span class=\"note\">Combat Movement</span>\n"); - printf("NOTE: Don't use the character = in the text<p>\n"); - printf("<textarea name=\"m\" rows=\"40\" cols=\"80\"></textarea>\n"); - printf("<p><input type=submit> <input type=reset>" - " <a href=\"comohelp.html\">HELP</a></p>" - "</form></body></html>\n"); - } - - cgi_quit(); - exit(0); - } } --- 137,140 ---- Index: login.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/login.cgi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** login.cgi.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- login.cgi.c 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 6,22 **** #include <time.h> ! #include "yacgi.h" #include "dicey.h" ! static char *atttext; /* attack text pointer */ ! static char atttextback[500]; /* attack text buffer */ ! static char *dicepoint; /* dice rolls pointer */ ! static char dicerolls[250]; /* dice rolls buffer */ ! FILE *logfile; /* logging information */ ! static FILE *tempfile; /* for sending email */ ! static FILE *fp; /* for sending email */ ! - CGI *cgi; /* interface to CGI data */ /* This program enables one to login to an A&A game. Possible input data are: --- 6,20 ---- #include <time.h> ! #include "cgi-util.h" #include "dicey.h" ! static char* atttext; /* attack text pointer */ ! static char atttextback[500]; /* attack text buffer */ ! static char* dicepoint; /* dice rolls pointer */ ! static char dicerolls[250]; /* dice rolls buffer */ ! FILE* logfile; /* logging information */ ! static FILE* tempfile; /* for sending email */ ! static FILE* fp; /* for sending email */ /* This program enables one to login to an A&A game. Possible input data are: *************** *** 38,43 **** main(int argc, char *argv[]) { ! int playertype; ! int j; char own_dogtag[EMAIL_LEN/4+1]; char opp_dogtag[EMAIL_LEN/4+1]; --- 36,41 ---- main(int argc, char *argv[]) { ! int playertype; ! int j; char own_dogtag[EMAIL_LEN/4+1]; char opp_dogtag[EMAIL_LEN/4+1]; *************** *** 52,55 **** --- 50,54 ---- char logname[30]; char* tempname; + const char* ptr; char syscommand[L_tmpnam+300]; int techcount; *************** *** 58,128 **** int verified; memset(batmat, 0, sizeof(int)*UNITNR*2); atttext = atttextback; ! printf("Content-type: text/html %c%c", 10, 10); ! ! cgi = cgiOpen(); ! if(!cgi) { htmlheader(stdout, "CGI System Error"); ! printf("<p><span class=\"note\">%s</span></p>\n", cgiStateMsg()); printf("</body></html>\n"); exit(EXIT_FAILURE); } - if(!(cgiFirst(cgi))) - er(" 1 - a system error occured (CGI subsystem failure). " - "Please try again.", 0); - /* get values from CGI interface */ ! cgiValueString(cgi, "own_dogtag", own_dogtag, EMAIL_LEN/4); ! ! cgiValueString(cgi, "opp_dogtag", opp_dogtag, EMAIL_LEN/4); ! cgiValueInteger(cgi, "game_nbr", &game_nbr, -1); ! ! cgiValueString(cgi, "country", country, COUNTRY_LEN); ! switch(cgiValueInteger(cgi, "turn", &turn_nbr, -1)) { ! case CGI_OK: break; ! case CGI_VAL_EMPTY: turn_nbr = -1; break; - - case CGI_VAL_INVALID: - turn_nbr = -2; - break; } ! cgiValueString(cgi, "send_mail", send_mail, 3); ! if(cgiValueFirst(cgi,"jet_power")) techs += JetPowerTech; ! if (cgiValueFirst(cgi,"rockets")) techs += RocketTech; ! if(cgiValueFirst(cgi,"super_sub")) techs += SuperSubTech; ! if(cgiValueFirst(cgi,"long_range")) techs += LongRangeTech; ! if(cgiValueFirst(cgi,"ind_tech")) techs += IndTech; ! if(cgiValueFirst(cgi,"hvy_bomber")) techs += HvyBomberTech; ! cgiValueInteger(cgi, "tech_roll", &tech, 0); ! batmat[0][TECH] = (int)tech; ! ! if(strcmp(send_mail,"NO")) ! mailsend = 0; ! else ! mailsend = 1; /* 162 The data has now been loaded from the login form */ --- 57,129 ---- int verified; + memset(own_dogtag, '\0', EMAIL_LEN/4+1); + memset(opp_dogtag, '\0', EMAIL_LEN/4+1); + memset(country, '\0', COUNTRY_LEN+1); + memset(send_mail, '\0', 4); + memset(filename, '\0', 30); + memset(presenttime, '\0', 51); + memset(logname, '\0', 30); + memset(syscommand, '\0', L_tmpnam+300); memset(batmat, 0, sizeof(int)*UNITNR*2); atttext = atttextback; ! printf("Content-type: text/html\n\n"); ! ! if(cgi_init() != CGIERR_NONE) { htmlheader(stdout, "CGI System Error"); ! printf("<p><span class=\"note\">%s</span></p>\n", ! cgi_strerror(cgi_errno)); printf("</body></html>\n"); exit(EXIT_FAILURE); } /* get values from CGI interface */ ! if ((ptr = cgi_getentrystr("own_dogtag")) != NULL) ! strncpy(own_dogtag, ptr, EMAIL_LEN/4); ! if ((ptr = cgi_getentrystr("opp_dogtag")) != NULL) ! strncpy(opp_dogtag, ptr, EMAIL_LEN/4); ! game_nbr = cgi_getentryint("game_nbr"); ! if (cgi_errno == CGIERR_NOT_INTEGER) ! game_nbr = -1; ! ! if ((ptr = cgi_getentrystr("country")) != NULL) ! strncpy(country, ptr, COUNTRY_LEN); ! ! turn_nbr = cgi_getentryint("turn"); ! ! switch(cgi_errno) { ! case CGIERR_NONE: break; ! case CGIERR_NOT_INTEGER: turn_nbr = -1; break; } ! mailsend = cgi_getentrybool("send_mail", 0); ! if (cgi_getentrystr("jet_power") != NULL) techs += JetPowerTech; ! if (cgi_getentrystr("rockets") != NULL) techs += RocketTech; ! if(cgi_getentrystr("super_sub") != NULL) techs += SuperSubTech; ! if(cgi_getentrystr("long_range") != NULL) techs += LongRangeTech; ! if(cgi_getentrystr("ind_tech") != NULL) techs += IndTech; ! if(cgi_getentrystr("hvy_bomber") != NULL) techs += HvyBomberTech; ! tech = cgi_getentryint("tech_roll"); ! batmat[0][TECH] = tech; /* 162 The data has now been loaded from the login form */ *************** *** 143,147 **** if((fp = fopen(filename,"r")) == NULL) { gamecreate(game_nbr, own_dogtag, "", opp_dogtag, "", 0); ! cgiClose(cgi); fp = fopen(filename, "r"); } --- 144,148 ---- if((fp = fopen(filename,"r")) == NULL) { gamecreate(game_nbr, own_dogtag, "", opp_dogtag, "", 0); ! cgi_quit(); fp = fopen(filename, "r"); } *************** *** 159,163 **** verified = 0; ! if (strncasecmp(own_email, own_dogtag, strlen(own_dogtag)) == 0) { verified++; } --- 160,164 ---- verified = 0; ! if (strncasecmp(&own_email[1], own_dogtag, strlen(own_dogtag)) == 0) { verified++; } *************** *** 167,171 **** "Please check that the data was entered correctly."); ! if (strncasecmp(opp_email, opp_dogtag, strlen(opp_dogtag)) == 0) { verified++; } --- 168,172 ---- "Please check that the data was entered correctly."); ! if (strncasecmp(&opp_email[1], opp_dogtag, strlen(opp_dogtag)) == 0) { verified++; } *************** *** 569,573 **** /* Mail has now been sent, let us close down */ ! cgiClose(cgi); exit(0); } --- 570,574 ---- /* Mail has now been sent, let us close down */ ! cgi_quit(); exit(0); } *************** *** 771,775 **** } ! cgiClose(cgi); exit(0); } --- 772,776 ---- } ! cgi_quit(); exit(0); } *************** *** 797,801 **** if(opp_email) ! printf("%s", htmlize(own_email)); else putchar('-'); --- 798,802 ---- if(opp_email) ! printf("%s", htmlize(opp_email)); else putchar('-'); *************** *** 804,808 **** "or one of them is not proper E-mail address, then follow the link:" " <a href=\"change.html\">Change E-mail</a> to correct the error.</p></body></html>"); ! cgiClose(cgi); exit(1); } --- 805,809 ---- "or one of them is not proper E-mail address, then follow the link:" " <a href=\"change.html\">Change E-mail</a> to correct the error.</p></body></html>"); ! cgi_quit(); exit(1); } Index: logincreate.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/logincreate.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** logincreate.c 9 Jan 2004 23:26:59 -0000 1.3 --- logincreate.c 11 Jan 2004 05:51:10 -0000 1.4 *************** *** 9,13 **** htmlheader(stdout, "Axis & Allies Dice Server Login - " ! "AAMC Registered Games"); if (errors) { --- 9,13 ---- htmlheader(stdout, "Axis & Allies Dice Server Login - " ! ENTITY " Registered Games"); if (errors) { Index: rolls.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/rolls.cgi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** rolls.cgi.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- rolls.cgi.c 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 2,11 **** #include <stdlib.h> #include <string.h> ! #include "yacgi.h" #include <sys/file.h> #include <ctype.h> static FILE *fp; - static CGI *cgi; /* This script fetches the game number, checks if it consists of four digits --- 2,10 ---- #include <stdlib.h> #include <string.h> ! #include "cgi-util.h" #include <sys/file.h> #include <ctype.h> static FILE *fp; /* This script fetches the game number, checks if it consists of four digits *************** *** 68,70 **** cgiClose(cgi); exit(1); ! } \ No newline at end of file --- 67,69 ---- cgiClose(cgi); exit(1); ! } Index: tech.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/tech.cgi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tech.cgi.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- tech.cgi.c 11 Jan 2004 05:51:10 -0000 1.2 *************** *** 1,5 **** #include <stdio.h> #include <stdlib.h> ! #include "yacgi.h" #include <string.h> #include <sys/file.h> --- 1,5 ---- #include <stdio.h> #include <stdlib.h> ! #include "cgi-util.h" #include <string.h> #include <sys/file.h> *************** *** 38,43 **** static int playertype; - static CGI *cgi; - /* This script will roll technology rolls */ --- 38,41 ---- *************** *** 671,673 **** strftime(datostreng,50,"%b %d %H:%M:%S\n",dato); return 0; ! } \ No newline at end of file --- 669,671 ---- strftime(datostreng,50,"%b %d %H:%M:%S\n",dato); return 0; ! } |
From: <mad...@us...> - 2004-01-09 23:27:03
|
Update of /cvsroot/dicey/dicey/standard In directory sc8-pr-cvs1:/tmp/cvs-serv16970/standard Modified Files: Makefile index.cgi.c logincreate.c Log Message: intermediate commit for sharing across systems. the current code is very much in transition between cgi libraries Index: Makefile =================================================================== RCS file: /cvsroot/dicey/dicey/standard/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 13 Nov 2003 03:05:13 -0000 1.2 --- Makefile 9 Jan 2004 23:26:59 -0000 1.3 *************** *** 17,21 **** # INCLUDES = -I../include $(EXTRA_INCLUDES) ! LIBS = -L../lib -ldicey -lyacgi $(EXTRA_LIBS) CFLAGS = -Wall -pedantic $(INCLUDES) -DBASE_URL=\"http://$(DICEY_SERVER)/\" --- 17,21 ---- # INCLUDES = -I../include $(EXTRA_INCLUDES) ! LIBS = -L../lib -ldicey -lcgi-util $(EXTRA_LIBS) CFLAGS = -Wall -pedantic $(INCLUDES) -DBASE_URL=\"http://$(DICEY_SERVER)/\" Index: index.cgi.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/index.cgi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.cgi.c 13 Nov 2003 03:02:42 -0000 1.1 --- index.cgi.c 9 Jan 2004 23:26:59 -0000 1.2 *************** *** 6,10 **** #include <time.h> ! #include "yacgi.h" #include "dicey.h" --- 6,10 ---- #include <time.h> ! #include "cgi-util.h" #include "dicey.h" *************** *** 18,23 **** - CGI *cgi; /* interface to CGI data */ - /* This program enables one to login to an A&A game. Possible input data are: * dogtag of yourself, dogtag of opponent, game number, country, turn, --- 18,21 ---- *************** *** 54,63 **** char syscommand[L_tmpnam+300]; int techcount; ! long tech; int mailsend; int verified; int errors = 0; int form_techs[6] = {0, 0, 0, 0, 0, 0}; memset(batmat, 0, sizeof(int)*UNITNR*2); --- 52,70 ---- char syscommand[L_tmpnam+300]; int techcount; ! int tech; int mailsend; int verified; int errors = 0; int form_techs[6] = {0, 0, 0, 0, 0, 0}; + const char* ptr; + memset(own_dogtag, '\0', EMAIL_LEN/4+1); + memset(opp_dogtag, '\0', EMAIL_LEN/4+1); + memset(country, '\0', COUNTRY_LEN+1); + memset(send_mail, '\0', 4); + memset(filename, '\0', 30); + memset(presenttime, '\0', 51); + memset(logname, '\0', 30); + memset(syscommand, '\0', L_tmpnam+300); memset(batmat, 0, sizeof(int)*UNITNR*2); *************** *** 65,130 **** ! cgi = cgiOpen(); ! if(!cgi) { printf("Content-type: text/html %c%c", 10, 10); htmlheader(stdout, "CGI System Error"); ! printf("<p><span class=\"note\">%s</span></p>\n", cgiStateMsg()); printf("</body></html>\n"); exit(EXIT_FAILURE); } ! if(!(cgiFirst(cgi))) ! er(" 1 - a system error occured (CGI subsystem failure). " ! "Please try again.", 0); ! /* get values from CGI interface */ ! cgiValueString(cgi, "own_dogtag", own_dogtag, EMAIL_LEN/4); ! cgiValueString(cgi, "opp_dogtag", opp_dogtag, EMAIL_LEN/4); ! cgiValueInteger(cgi, "game_nbr", &game_nbr, -1); ! ! cgiValueString(cgi, "country", country, COUNTRY_LEN); ! switch(cgiValueInteger(cgi, "turn", &turn_nbr, -1)) { ! case CGI_OK: break; ! case CGI_VAL_EMPTY: turn_nbr = -1; break; - - case CGI_VAL_INVALID: - turn_nbr = -2; - break; } ! cgiValueString(cgi, "send_mail", send_mail, 3); ! ! if(cgiValueFirst(cgi,"jet_power")) techs += JetPowerTech; ! if (cgiValueFirst(cgi,"rockets")) techs += RocketTech; ! if(cgiValueFirst(cgi,"super_sub")) techs += SuperSubTech; ! if(cgiValueFirst(cgi,"long_range")) techs += LongRangeTech; ! if(cgiValueFirst(cgi,"ind_tech")) techs += IndTech; ! if(cgiValueFirst(cgi,"hvy_bomber")) techs += HvyBomberTech; ! cgiValueInteger(cgi, "tech_roll", &tech, 0); ! batmat[0][TECH] = (int)tech; ! if(strcmp(send_mail,"NO")) ! mailsend = 0; ! else ! mailsend = 1; /* 162 The data has now been loaded from the login form */ --- 72,133 ---- ! if (cgi_init() != CGIERR_NONE) { printf("Content-type: text/html %c%c", 10, 10); htmlheader(stdout, "CGI System Error"); ! printf("<p><span class=\"note\">%s</span></p>\n", ! cgi_strerror(cgi_errno)); printf("</body></html>\n"); exit(EXIT_FAILURE); } ! printf("Content-type: text/html\n\n"); ! /* get values from CGI interface */ ! if ((ptr = cgi_getentrystr("own_dogtag")) != NULL) ! strncpy(own_dogtag, ptr, EMAIL_LEN/4); ! if ((ptr = cgi_getentrystr("opp_dogtag")) != NULL) ! strncpy(opp_dogtag, ptr, EMAIL_LEN/4); ! game_nbr = cgi_getentryint("game_nbr"); ! if (cgi_errno == CGIERR_NOT_INTEGER) ! game_nbr = -1; ! if ((ptr = cgi_getentrystr("country")) != NULL) ! strncpy(country, ptr, COUNTRY_LEN); ! ! turn_nbr = cgi_getentryint("turn"); ! ! switch(cgi_errno) { ! case CGIERR_NONE: break; ! case CGIERR_NOT_INTEGER: turn_nbr = -1; break; } ! if (cgi_getentrystr("jet_power") != NULL) techs += JetPowerTech; ! if (cgi_getentrystr("rockets") != NULL) techs += RocketTech; ! if(cgi_getentrystr("super_sub") != NULL) techs += SuperSubTech; ! if(cgi_getentrystr("long_range") != NULL) techs += LongRangeTech; ! if(cgi_getentrystr("ind_tech") != NULL) techs += IndTech; ! if(cgi_getentrystr("hvy_bomber") != NULL) techs += HvyBomberTech; ! tech = cgi_getentryint("tech_roll"); ! batmat[0][TECH] = tech; ! mailsend = cgi_getentrybool("send_mail", 0); /* 162 The data has now been loaded from the login form */ *************** *** 148,152 **** if((fp = fopen(filename,"r")) == NULL) { gamecreate(game_nbr, own_dogtag, "", opp_dogtag, "", 0); ! cgiClose(cgi); fp = fopen(filename, "r"); } --- 151,155 ---- if((fp = fopen(filename,"r")) == NULL) { gamecreate(game_nbr, own_dogtag, "", opp_dogtag, "", 0); ! cgi_quit(); fp = fopen(filename, "r"); } *************** *** 574,578 **** /* Mail has now been sent, let us close down */ ! cgiClose(cgi); exit(0); } --- 577,581 ---- /* Mail has now been sent, let us close down */ ! cgi_quit(); exit(0); } *************** *** 675,679 **** printf("</p><p>Number of technology rolls you wish to purchase: " ! "<input type=\"text\" name=\"n\" maxlength=\"2\" size=\"1\" value=\"%ld\"></p>", tech); printf("<p>Comment: <input type=\"text\" name=\"r\" maxlength=\"100\" size=\"80\"></p>"); printf("<p><input type=submit><input type=reset><a href=\"techhelp.html\">HELP</a></p></form></body></html>"); --- 678,682 ---- printf("</p><p>Number of technology rolls you wish to purchase: " ! "<input type=\"text\" name=\"n\" maxlength=\"2\" size=\"1\" value=\"%d\"></p>", tech); printf("<p>Comment: <input type=\"text\" name=\"r\" maxlength=\"100\" size=\"80\"></p>"); printf("<p><input type=submit><input type=reset><a href=\"techhelp.html\">HELP</a></p></form></body></html>"); *************** *** 776,780 **** } ! cgiClose(cgi); exit(0); } --- 779,783 ---- } ! cgi_quit(); exit(0); } *************** *** 809,813 **** "or one of them is not proper E-mail address, then follow the link:" " <a href=\"change.html\">Change E-mail</a> to correct the error.</p></body></html>"); ! cgiClose(cgi); exit(1); } --- 812,816 ---- "or one of them is not proper E-mail address, then follow the link:" " <a href=\"change.html\">Change E-mail</a> to correct the error.</p></body></html>"); ! cgi_quit(); exit(1); } Index: logincreate.c =================================================================== RCS file: /cvsroot/dicey/dicey/standard/logincreate.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** logincreate.c 13 Nov 2003 21:21:14 -0000 1.2 --- logincreate.c 9 Jan 2004 23:26:59 -0000 1.3 *************** *** 1,4 **** #include "dicey.h" ! #include "yacgi.h" void --- 1,4 ---- #include "dicey.h" ! #include "cgi-util.h" void |
From: <mad...@us...> - 2004-01-09 23:27:02
|
Update of /cvsroot/dicey/dicey/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16970/lib Modified Files: er.c Log Message: intermediate commit for sharing across systems. the current code is very much in transition between cgi libraries Index: er.c =================================================================== RCS file: /cvsroot/dicey/dicey/lib/er.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** er.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- er.c 9 Jan 2004 23:26:59 -0000 1.2 *************** *** 1,9 **** #include <stdio.h> #include <sys/file.h> ! #include "yacgi.h" /* I *hate* this extern crap, but don't see a way around it right now */ - extern CGI* cgi; extern FILE* logfile; --- 1,9 ---- #include <stdio.h> + #include <stdlib.h> #include <sys/file.h> ! #include "cgi-util.h" /* I *hate* this extern crap, but don't see a way around it right now */ extern FILE* logfile; *************** *** 22,26 **** flock(errorfile-> _fileno, LOCK_UN); } ! cgiClose(cgi); exit(1); } --- 22,26 ---- flock(errorfile-> _fileno, LOCK_UN); } ! cgi_quit(); exit(1); } |
From: <mad...@us...> - 2004-01-09 23:27:02
|
Update of /cvsroot/dicey/dicey/include In directory sc8-pr-cvs1:/tmp/cvs-serv16970/include Modified Files: diceydefs.h Log Message: intermediate commit for sharing across systems. the current code is very much in transition between cgi libraries Index: diceydefs.h =================================================================== RCS file: /cvsroot/dicey/dicey/include/diceydefs.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** diceydefs.h 14 Nov 2003 13:59:55 -0000 1.2 --- diceydefs.h 9 Jan 2004 23:26:59 -0000 1.3 *************** *** 53,62 **** }; ! enum idx_errors { ERR_IDX_OWN_DT = 0x0004, ERR_IDX_OPP_DT = 0x0008, ERR_IDX_GAME_NBR = 0x0010, ERR_IDX_DUP_DT = 0x0040, ! ERR_IDX_DUP_GAME_NBR = 0x0080 }; --- 53,72 ---- }; ! enum index_errors { ERR_IDX_OWN_DT = 0x0004, ERR_IDX_OPP_DT = 0x0008, ERR_IDX_GAME_NBR = 0x0010, ERR_IDX_DUP_DT = 0x0040, ! ERR_IDX_DUP_GAME_NBR = 0x0080, ! ERR_IDX_TECH_ROLLS = 0x0100 ! }; ! ! enum form_tech_idx { ! jet_power_idx = 0, ! rockets_idx, ! super_sub_idx, ! long_range_idx, ! ind_tech_idx, ! hvy_bomber_idx }; *************** *** 66,73 **** void htmlheader(FILE* fp, char* title); void er(char* msg, int value); ! void gamecreate(int game_nbr, char* own_dt, char* own_em, ! char* opp_dt, char* opp_em, int errors); ! void logincreate(int game_nbr, char* own_dogtag, char* opp_dogtag, ! int errors, int form_techs[6], long tech_roll); ! #endif --- 76,82 ---- void htmlheader(FILE* fp, char* title); void er(char* msg, int value); ! void gamecreate(int game_nbr, char* own_dt, char* own_em, ! char* opp_dt, char* opp_em, int errors); ! void logincreate(int game_nbr, char* own_dt, char* opp_dt, int errors, ! int form_techs[6], long tech_rolls); #endif |
From: <mad...@us...> - 2004-01-07 13:52:23
|
Update of /cvsroot/dicey/dicey/yacgi12/src In directory sc8-pr-cvs1:/tmp/cvs-serv13847/src Removed Files: Copyright Makefile yacgi.c yacgi.h Log Message: switching from a poorly licensed and hard to find cgi library to an open source supported cgi library --- Copyright DELETED --- --- Makefile DELETED --- --- yacgi.c DELETED --- --- yacgi.h DELETED --- |
From: <mad...@us...> - 2004-01-07 13:52:23
|
Update of /cvsroot/dicey/dicey/yacgi12/sample In directory sc8-pr-cvs1:/tmp/cvs-serv13847/sample Removed Files: Makefile yacsampl.c Log Message: switching from a poorly licensed and hard to find cgi library to an open source supported cgi library --- Makefile DELETED --- --- yacsampl.c DELETED --- |
Update of /cvsroot/dicey/dicey/yacgi12/htdocs In directory sc8-pr-cvs1:/tmp/cvs-serv13847/htdocs Removed Files: brapic1.gif emailform.html emailhd.html license.txt yacgi.gif yacgi.html yacsampl.html Log Message: switching from a poorly licensed and hard to find cgi library to an open source supported cgi library --- brapic1.gif DELETED --- --- emailform.html DELETED --- --- emailhd.html DELETED --- --- license.txt DELETED --- --- yacgi.gif DELETED --- --- yacgi.html DELETED --- --- yacsampl.html DELETED --- |
From: <mad...@us...> - 2004-01-07 13:52:23
|
Update of /cvsroot/dicey/dicey/yacgi12/include In directory sc8-pr-cvs1:/tmp/cvs-serv13847/include Removed Files: yacgi.h Log Message: switching from a poorly licensed and hard to find cgi library to an open source supported cgi library --- yacgi.h DELETED --- |
From: <mad...@us...> - 2004-01-07 13:52:22
|
Update of /cvsroot/dicey/dicey/yacgi12/emailhd In directory sc8-pr-cvs1:/tmp/cvs-serv13847/emailhd Removed Files: Makefile emailhd.c emailhd.conf Log Message: switching from a poorly licensed and hard to find cgi library to an open source supported cgi library --- Makefile DELETED --- --- emailhd.c DELETED --- --- emailhd.conf DELETED --- |
From: <mad...@us...> - 2004-01-07 13:52:22
|
Update of /cvsroot/dicey/dicey/yacgi12 In directory sc8-pr-cvs1:/tmp/cvs-serv13847 Removed Files: Copyright Log Message: switching from a poorly licensed and hard to find cgi library to an open source supported cgi library --- Copyright DELETED --- |
From: <chr...@us...> - 2004-01-07 04:36:35
|
Update of /cvsroot/dicey/dicey/web In directory sc8-pr-cvs1:/tmp/cvs-serv21453 Removed Files: instructions3.html Log Message: duplicate of help.html --- instructions3.html DELETED --- |
From: <chr...@us...> - 2004-01-07 04:36:25
|
Update of /cvsroot/dicey/dicey/web In directory sc8-pr-cvs1:/tmp/cvs-serv21623 Removed Files: moderator.html Log Message: Obsolete file --- moderator.html DELETED --- |
From: <chr...@us...> - 2004-01-07 04:36:16
|
Update of /cvsroot/dicey/dicey/web In directory sc8-pr-cvs1:/tmp/cvs-serv21744 Removed Files: newlogin.html Log Message: Obsolete file --- newlogin.html DELETED --- |
From: <chr...@us...> - 2004-01-07 04:05:29
|
Update of /cvsroot/dicey/dicey/web In directory sc8-pr-cvs1:/tmp/cvs-serv21150 Removed Files: diceyindex.html Log Message: Generated on the fly, obsolete. --- diceyindex.html DELETED --- |
From: <chr...@us...> - 2004-01-07 04:03:48
|
Update of /cvsroot/dicey/dicey/web In directory sc8-pr-cvs1:/tmp/cvs-serv20887 Removed Files: create.html Log Message: Generated on the fly, obsolete. --- create.html DELETED --- |
From: <chr...@us...> - 2004-01-07 03:43:27
|
Update of /cvsroot/dicey/dicey/web In directory sc8-pr-cvs1:/tmp/cvs-serv17981 Modified Files: about.html Log Message: First revision of About Dicey page for version 2.0 Index: about.html =================================================================== RCS file: /cvsroot/dicey/dicey/web/about.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** about.html 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- about.html 7 Jan 2004 03:43:24 -0000 1.2 *************** *** 1,30 **** ! <html><title>About the Dice Server</title><body> ! <p>This Dice Server was created by Jens Groth 1999</p> ! <p>Anybody may use it to roll dice for battles of Axis and Allies.</p> ! <p>Axis and Allies is a board game sold by Hasbro. I have no connection with Hasbro, and they are in no way responsible for this Dice Server.</p> ! <p>The Dice Server consists of several parts, designed with different purposes and priorities: ! <ul><li>The login page: This page was intended to be 1) User friendly ! <li>The battle page: It was designed with the following in mind: 1) Randomness of dice rolls 2) Fast to download 3) Fast to use 4) User friendliness. ! <li>Logs of rolls page: It is a bit clumsy, the sole purpose is 1) To be able to validate that the rolls were actually made and when they were made. ! <li>Instruction pages: They are meant to be 1) Instructive ! </ul><p> ! If there are any bugs the support staff would like to hear about them to correct them. Likewise if you have a good suggestion for an improvement (bearing in mind the above goals) ! please send an email to <a href="mailto:dic...@aa...">Dice Server</a></p> ! <p>A special thanks goes to Jesper Nielsen who helped me learn C programming, who lend me a computer, provided me with software and answered my many questions.<br> ! I'd also like to thank Mike Paese aka TopDog, Paul Millard, Todd Bullock, Carlo Miroglio, Damien del Russo and Kim Hunter aka the Water Otter for their input and suggestions while I made this dice server. I believe it turned out as a better result due to their help.<br> ! During my work with it I have used the Yacgi-library created by Andrew Girow. It was a great help that I ! didn't have to create the web-page interface myself.<br> ! For randomness I have used the Mersenne Twister invented by Matsumoto and Nishimura.<br> ! </p> ! <p>-------<br> ! Copyright notice regarding the Yacgi-library (more info can be found on <a href="http://www.freecode.com/cgi-bin/viewsource.pl?3739,unzip/yacgi12/htdocs/license.txt">http://www.freecode.com/cgi-bin/viewsource.pl?3739,unzip/yacgi12/htdocs/license.txt</a>):<p> ! YACGI, copyright 1996-1997 by Andrew Girow (Andriy Zhyrov). <br> ! Permission is granted to use YACGI in any application, commercial ! or noncommercial, at no cost. <br><br> ! HOWEVER, this copyright paragraph MUST APPEAR on a "credits" page ! accessible in the public online and offline documentation of the ! program.<p> ! -------<br> ! Information about the Mersenne Twister can be found at <a href="http://www.math.keio.ac.jp/~matumoto/emt.html">http://www.math.keio.ac.jp/~matumoto/emt.html</a>. The implementation used here is the version made by Shawn Cokus. ! </body></html> \ No newline at end of file --- 1,22 ---- ! <?xml version="1.0" encoding="UTF-8"?> ! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ! "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ! <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> ! <head> ! <title>About Dicey</title> ! <base href="BASE_URL" /> ! <style type="text/css"> ! .block {border-width: thin; border-style: solid; text-align: center} ! .note {font-weight: bold; font-size: 12px;} ! .error {font-weight: bold; font-size: 14px; color: #FF0000;} ! .main {font-weight: bold; font-size: 18px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, H ! elvetica, sans-serif;} ! </style> ! </head> ! <body background="site_bg.jpg"> ! <h1 class="main">About Dicey</h1> ! <p>Dicey was created by Jens Groth 1999 and released under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a> in 2003. "Axis & Allies" is a Trademark of <a href="http://hasbro.com/">Hasbro</a>. The Dicey project is not affiliated with or licensed by Hasbro. Any use of Hasbro's trademarks should not be viewed as a challenge to those trademarks.</p> ! ! </body> ! </html> \ No newline at end of file |
From: <mad...@us...> - 2003-11-14 13:59:58
|
Update of /cvsroot/dicey/dicey/include In directory sc8-pr-cvs1:/tmp/cvs-serv20774 Modified Files: diceydefs.h Log Message: added error definitions for the logincreate function and prototype for that function Index: diceydefs.h =================================================================== RCS file: /cvsroot/dicey/dicey/include/diceydefs.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** diceydefs.h 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- diceydefs.h 14 Nov 2003 13:59:55 -0000 1.2 *************** *** 53,56 **** --- 53,64 ---- }; + enum idx_errors { + ERR_IDX_OWN_DT = 0x0004, + ERR_IDX_OPP_DT = 0x0008, + ERR_IDX_GAME_NBR = 0x0010, + ERR_IDX_DUP_DT = 0x0040, + ERR_IDX_DUP_GAME_NBR = 0x0080 + }; + int dice(char* ret_str, int nbr_rolls); void normalize_email(char* in, char* out); *************** *** 60,63 **** --- 68,73 ---- void gamecreate(int game_nbr, char* own_dt, char* own_em, char* opp_dt, char* opp_em, int errors); + void logincreate(int game_nbr, char* own_dogtag, char* opp_dogtag, + int errors, int form_techs[6], long tech_roll); #endif |
From: <mad...@us...> - 2003-11-14 13:57:58
|
Update of /cvsroot/dicey/dicey/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20467 Modified Files: Makefile Log Message: changed include path to be relative Index: Makefile =================================================================== RCS file: /cvsroot/dicey/dicey/lib/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- Makefile 14 Nov 2003 13:57:54 -0000 1.2 *************** *** 4,8 **** DICEY_SERVER = dicey.quarter-flash.com REMOTE_INSTALL_DIR = $(DICEY_SERVER):/var/www/axis_allies - PROJECT_ROOT = /home/kenw/src/dicey # --- 4,7 ---- *************** *** 16,20 **** # variables you shouldn't need to change # ! INCLUDES = -I$(PROJECT_ROOT)/include $(EXTRA_INCLUDES) CFLAGS = -Wall -pedantic $(INCLUDES) -DBASE_URL=\"http://$(DICEY_SERVER)/\" --- 15,19 ---- # variables you shouldn't need to change # ! INCLUDES = -I../include $(EXTRA_INCLUDES) CFLAGS = -Wall -pedantic $(INCLUDES) -DBASE_URL=\"http://$(DICEY_SERVER)/\" |
From: <mad...@us...> - 2003-11-13 21:21:38
|
Update of /cvsroot/dicey/dicey/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20538 Modified Files: htmlheader.c Log Message: tuning the appearance of the output html Index: htmlheader.c =================================================================== RCS file: /cvsroot/dicey/dicey/lib/htmlheader.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** htmlheader.c 7 Nov 2003 20:05:09 -0000 1.1.1.1 --- htmlheader.c 13 Nov 2003 21:21:35 -0000 1.2 *************** *** 13,26 **** fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"); fprintf(out, "<head>\n <title>%s</title>\n", title); ! fprintf(out, " <base href=\"%s\">\n", BASE_URL); fprintf(out, " <style type=\"text/css\">\n"); fprintf(out, " .block {border-width: thin; border-style: solid; text-align: center}\n"); ! fprintf(out, " .note {font-weight: bold; font-size: 12px;}\n"); ! fprintf(out, " .error {font-weight: bold; font-size: 14px; color: #FF0000;}\n"); ! fprintf(out, " .main {font-weight: bold; font-size: 18px; " "font-family: 'Lucida Grande', Verdana, Geneva, Lucida, " "Arial, Helvetica, sans-serif;}\n"); fprintf(out, " </style>\n</head>\n"); fprintf(out, "<body background=\"site_bg.jpg\">\n"); ! fprintf(out, "<h class=\"main\">%s</h>\n", title); } --- 13,26 ---- fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"); fprintf(out, "<head>\n <title>%s</title>\n", title); ! fprintf(out, " <base href=\"%s\" />\n", BASE_URL); fprintf(out, " <style type=\"text/css\">\n"); fprintf(out, " .block {border-width: thin; border-style: solid; text-align: center}\n"); ! fprintf(out, " .note {font-weight: bold; font-size: 18px;}\n"); ! fprintf(out, " .error {font-weight: bold; font-size: 18px; color: #FF0000;}\n"); ! fprintf(out, " .main {font-weight: bold; font-size: 24px; " "font-family: 'Lucida Grande', Verdana, Geneva, Lucida, " "Arial, Helvetica, sans-serif;}\n"); fprintf(out, " </style>\n</head>\n"); fprintf(out, "<body background=\"site_bg.jpg\">\n"); ! fprintf(out, "<h1 class=\"main\">%s</h1>\n", title); } |