#include <stdlib.h>
#include <time.h>
#include "udanax.h"
#include "players.h"
Include dependency graph for be.cxx:

Go to the source code of this file.
Defines | |
| #define | MAX_PLAYERS 5 |
Functions | |
| bool | getrequest (Session *sess, typerequest *requestptr) |
| ??? | |
| void | sendresultoutput (Session *session) |
| ??? | |
| char | pullc (Session *sess) |
| ??? | |
| void | xuputstring (char *string, FILE *fd) |
| ??? | |
| void | processrcfile () |
| ??? | |
| void | xanadu (Session *sess) |
| ??? | |
| bool | establishprotocol (FILE *inp, FILE *outp) |
| ??? | |
| int | main (int argc, char *argv[]) |
| ??? | |
| void | frontenddied () |
| ??? | |
| void | setmaximumsetupsize (Session *sess) |
| ??? | |
| void | sourceunixcommand (Session *sess) |
| ??? | |
| bool | decrementusers () |
| ??? | |
| bool | isthisusersdocument (Session *sess, Tumbler *tp) |
| ??? | |
Variables | |
| int | user = 0 |
| PLAYER | player [MAX_PLAYERS] |
| int | errno |
| FILE * | logfile |
| FILE * | nulllog |
| FILE * | reallog |
| char | outputbuffer [BUFSIZ] |
| char | inputbuffer [BUFSIZ] |
| bool | logstuff |
| FILE * | interfaceinput |
| FILE * | febelog |
| bool | firstputforrequest |
| Session * | sessx |
| User's session context. | |
| int | backenddaemon |
| Tumbler | defaultaccount = { 0, 0, 0, 0, { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0 } } |
(to be defined)
Definition in file be.cxx.
|
|
Definition at line 92 of file be.cxx. Referenced by new_players(). |
|
|
??? (to be defined) Definition at line 292 of file be.cxx. Referenced by indiskexit().
00293 {
00294 return false;
00295 }
|
|
||||||||||||
|
??? (to be defined) <Input: User's session context Definition at line 154 of file be.cxx.
00157 {
00158 char ch;
00159 Session tempsess;
00160
00161 if (febelog && febelog != nulllog)
00162 fprintf(febelog, "fe:\n");
00163 firstputforrequest = true;
00164
00165 /* This is the metaprotocol for the time being */
00166
00167 tempsess.inp = inp;
00168 tempsess.outp = outp;
00169 tempsess.errp = stderr;
00170
00171 while ((ch = pullc(&tempsess)) != '\n') ;
00172 while ((ch = pullc(&tempsess)) == '\n') ;
00173 if (ch == 'P' && pullc(&tempsess) == '0' && pullc(&tempsess) == '~') {
00174 xuputstring("\nP0~", tempsess.outp);
00175 sendresultoutput(&tempsess);
00176 return true;
00177 } else {
00178 xuputstring("\nP?~", tempsess.outp);
00179 sendresultoutput(&tempsess);
00180 return false;
00181 }
00182 }
|
|
|
??? (to be defined) Definition at line 250 of file be.cxx. Referenced by pullc(), and xuputc().
|
|
||||||||||||
|
??? (to be defined)
Definition at line 326 of file get2.cxx.
00327 : User's session context 00328 typerequest *requestptr) 00329 { 00330 prompt(sess, "\nrequest? "); 00331 int c = getc(sess->inp); 00332 if ((int) c == EOF) { 00333 L("endfile\n"); 00334 sess->inp = stdin; 00335 } /* else if (c == ':') { while ((c = * getc (sess->inp)) != '\n'); * return 00336 * (false); } */ 00337 ungetc(c, sess->inp); 00338 return getnumber(sess, requestptr) && validrequest(sess, *requestptr); 00339 } |
|
||||||||||||
|
??? (to be defined)
Definition at line 305 of file be.cxx.
00306 : User's session context 00307 Tumbler *tp) 00308 { 00309 return tumbleraccounteq(tp, &sess->account); 00310 } |
|
||||||||||||
|
??? (to be defined) <Input: User's session context Definition at line 192 of file be.cxx. References debug, defaultaccount, establishprotocol(), febelog, init(), initsession(), inputbuffer, interfaceinput, logfile, movetumbler, nsessorcommand, NULL, nulllog, outputbuffer, processrcfile(), reallog, sessx, and xanadu().
00195 {
00196 Session sess;
00197 char buf[100];
00198 //UNUSED FILE *fd;
00199 struct tm *local;
00200 long clock;
00201
00202 sessx = &sess;
00203 febelog = interfaceinput = reallog = logfile = nulllog = fopen("/dev/null", "a");
00204
00205 clock = time(0);
00206 local = localtime(&clock);
00207 sprintf(buf, "ln%d.%d.%d:%d", local->tm_mon + 1, local->tm_mday, local->tm_hour, local->tm_min);
00208 /*
00209 * #ifndef DISTRIBUTION
00210 * sprintf(buf,"febe%d.%d.%d:%d",local->tm_mon+1,local->tm_mday,local->tm_hour,local->tm_min);
00211 * febelog = fopen(buf, "w"); #endif */
00212
00213 freopen("backenderror", "w", stderr); /* CHANGE THIS ?? */
00214 setbuf(stderr, NULL);
00215 processrcfile();
00216
00217 setbuf(stdin, inputbuffer);
00218 setbuf(stdout, outputbuffer);
00219
00220 if (!establishprotocol(stdin, stdout))
00221 exit(1);
00222
00223 debug = false;
00224
00225 init(1);
00226 //now uses a ctor:: inittask(&sess);
00227
00228 initsession("enf.enf");
00229
00230 movetumbler(&defaultaccount, &sess.account);
00231
00232 for (;;) {
00233 nsessorcommand++;
00234 xanadu(&sess);
00235 /* testforreservedness ("main"); */
00236 logfile = nulllog;
00237 }
00238 /* lookatalloc(); */
00239 return 0;
00240 }
|
|
|
??? (to be defined) Definition at line 110 of file rcfile.cxx. Referenced by main().
00111 {
00112 FILE *rcfd;
00113 static char buf[BUFSIZ];
00114 static char line[256];
00115 static char name[256];
00116 int temp;
00117
00118 if ((rcfd = fopen(RCFILENAME, "r")) != NULL) {
00119 while (fgets(buf, BUFSIZ, rcfd)) {
00120 if (buf[0] != '#' && sscanf(buf, "%s = %s", name, line) == 2) {
00121 //UNUSED if (!strcmp(name, BACKENDFILEMETANAME))
00122 //UNUSED strcpy(backendfilename, line);
00123 //UNUSED else if (!strcmp(name, ACCOUNTFILEMETANAME))
00124 //UNUSED strcpy(accountfilename, line);
00125 //UNUSED else
00126 if (!strcmp(name, PORTMETANAME)) {
00127 if (sscanf(line, "%d", &portname) < 1) {
00128 L("Could not use port = %s, using %d\n", line, PORT);
00129 portname = PORT;
00130 }
00131 } else if (!strcmp(name, HOSTMETANAME))
00132 strcpy(hostname, line);
00133 //UNUSED else if (!strcmp(name, BACKENDDIRECTORYMETANAME))
00134 //UNUSED strcpy(backenddirectoryname, line);
00135 //UNUSED else if (!strcmp(name, BACKENDGLUEFILEMETANAME))
00136 //UNUSED strcpy(backendgluefilename, line);
00137 //UNUSED else if (!strcmp(name, FRONTENDGLUEFILEMETANAME))
00138 //UNUSED strcpy(frontendgluefilename, line);
00139 //UNUSED else if (!strcmp(name, FRONTENDFILEMETANAME))
00140 //UNUSED strcpy(frontendfilename, line);
00141 else if (!strcmp(name, ALLOCSIZENAME)) {
00142 temp = allocsize;
00143 sscanf(line, "%d", &allocsize);
00144 if (allocsize < 100000 || allocsize > 300000000) { /* minimal sanity checking */
00145 incrementalallocsize = temp;
00146 }
00147 } else if (!strcmp(name, INCREMENTALALLOCSIZENAME)) {
00148 temp = incrementalallocsize;
00149 sscanf(line, "%d", &incrementalallocsize);
00150 if (incrementalallocsize < 10000 || incrementalallocsize > 100000000) {
00151 incrementalallocsize = temp;
00152 }
00153 } else
00154 L("Don't know about %s = %s\n", name, line);
00155 }
00156 }
00157 fclose(rcfd);
00158 }
00159 }
|
|
|
??? (to be defined)
Definition at line 146 of file get2fe.cxx. References Session::charbuff, Session::charinbuff, febelog, frontenddied(), Session::inp, interfaceinput, L, logstuff, nulllog, user, and WORDELIM. Referenced by eatchar(), establishprotocol(), getnumber(), getrequest(), getspecset(), gettdigit(), and gettumbler().
00147 : User's session context
00148 {
00149 int temp;
00150
00151 if (sess->charinbuff) {
00152 sess->charinbuff = false;
00153 return sess->charbuff;
00154
00155 } else {
00156 temp = getc(sess->inp);
00157 if (temp == EOF) {
00158 L("EOF on user %d in pullc\n", user);
00159 frontenddied(); /* does longjmp in backenddaemon, exit in backend */
00160
00161 /* L("Premature end-of-file in backend\n"); diskexit (); // try to avoid screwing enf.enf //
00162 * assert(0); "pullc" */
00163 }
00164
00165 temp &= 0x7f;
00166 if (logstuff && interfaceinput && interfaceinput != nulllog) {
00167 if (temp == WORDELIM)
00168 putc('\n', interfaceinput);
00169 else
00170 putc(temp, interfaceinput);
00171 }
00172
00173 if (febelog && febelog != nulllog)
00174 putc(temp, febelog);
00175 return temp;
00176 }
00177 }
|
|
|
??? (to be defined)
Definition at line 192 of file putfe.cxx.
00193 : User's session context
00194 {
00195 /* FILE *fd; fd = session->outp; write (fd->_file, fd->_base, (int) (fd->_ptr - fd->_base)); fd->_ptr = fd->_base;
00196 * fd->_cnt = BUFSIZ; */
00197 fflush(session->outp);
00198 }
|
|
|
??? (to be defined)
Definition at line 266 of file be.cxx.
00267 : User's session context
00268 {
00269 }
|
|
|
??? (to be defined)
Definition at line 279 of file be.cxx. Referenced by init().
00280 : User's session context
00281 {
00282 }
|
|
|
??? (to be defined)
Definition at line 124 of file be.cxx. References febelog, firstputforrequest, Session::free(), getrequest(), Session::inp, interfaceinput, logstuff, nulllog, requestfns, sendresultoutput(), and typerequest.
00125 : User's session context
00126 {
00127 typerequest request;
00128
00129 if (febelog && febelog != nulllog)
00130 fprintf(febelog, "\nfe:\n");
00131 firstputforrequest = true;
00132 logstuff = false;
00133 if (getrequest(sess, &request)) {
00134 (*requestfns[request]) (sess);
00135 sendresultoutput(sess);
00136 } else {
00137 sess->inp = stdin;
00138 }
00139 sess->free();
00140 /* lookatalloc(); */
00141 if (interfaceinput && interfaceinput != nulllog)
00142 fflush(interfaceinput);
00143 logstuff = false;
00144 }
|
|
||||||||||||
|
??? (to be defined) Definition at line 145 of file putfe.cxx.
00148 {
00149 /* while (*string) xuputc (*string++, fd); */
00150 fwrite(string, 1, strlen(string), fd);
00151 }
|
|
|
Definition at line 107 of file be.cxx. Referenced by main(), and quitxanadu(). |
|
|
Definition at line 108 of file be.cxx. Referenced by main(). |
|
|
Definition at line 95 of file be.cxx. Referenced by initenffile(), main(), and FileBlockIO::open(). |
|
|
Definition at line 104 of file be.cxx. Referenced by establishprotocol(), main(), pullc(), xanadu(), and xuputc(). |
|
|
Definition at line 105 of file be.cxx. Referenced by establishprotocol(), xanadu(), and xuputc(). |
|
|
Definition at line 101 of file be.cxx. Referenced by main(). |
|
|
Definition at line 103 of file be.cxx. Referenced by flagquitting(), getclose(), getcopy(), getcreatelink(), getcreatenewdocument(), getcreatenewversion(), getcreatenode_or_account(), getdeletevspan(), getinsert(), getopen(), getrearrange(), getxaccount(), logaccount(), main(), pullc(), quitxanadu(), and xanadu(). |
|
|
Definition at line 97 of file be.cxx. Referenced by getrequest(), main(), and putfindlinksfromtothree(). |
|
|
Definition at line 102 of file be.cxx. Referenced by getclose(), getcopy(), getcreatelink(), getcreatenewdocument(), getcreatenewversion(), getcreatenode_or_account(), getdeletevspan(), getinsert(), getopen(), getrearrange(), getxaccount(), pullc(), and xanadu(). |
|
|
Definition at line 98 of file be.cxx. Referenced by establishprotocol(), main(), pullc(), xanadu(), and xuputc(). |
|
|
Definition at line 100 of file be.cxx. Referenced by main(). |
|
|
Definition at line 94 of file be.cxx. Referenced by decrementusers(), getxaccount(), isthisusersdocument(), leave(), main(), new_players(), xaccount(), and xanadu(). |
|
|
Definition at line 99 of file be.cxx. Referenced by main(). |
|
|
User's session context.
Definition at line 106 of file be.cxx. Referenced by main(). |
|
|
Definition at line 93 of file be.cxx. Referenced by crash(), decrementusers(), getxaccount(), isthisusersdocument(), main(), pullc(), xaccount(), and xanadu(). |
1.3.4