#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "udanax.h"
#include "players.h"
Include dependency graph for xumain.cxx:

Go to the source code of this file.
Defines | |
| #define | MAX_PLAYERS 5 |
Functions | |
| bool | getrequest (Session *sess, typerequest *requestptr) |
| ??? | |
| void | processrcfile () |
| ??? | |
| void | prompt (Session *sess, char *string) |
| ??? | |
| void | putcreatenewdocument (Session *sess, IStreamAddr *newdocisaptr) |
| ??? | |
| void | xanadu (Session *sess) |
| ??? | |
| int | main (int argc, char *argv[]) |
| ??? | |
| bool | setmaximumsetupsize (Session *sess) |
| ??? | |
| bool | getmuchtext (Session *sess, typetext *textptr) |
| ??? | |
| void | sourceunixcommand (Session *sess) |
| ??? | |
| bool | decrementusers () |
| ??? | |
| bool | isthisusersdocument (Session *sess, Tumbler *tp) |
| ??? | |
Variables | |
| int | user = 0 |
| PLAYER | player [MAX_PLAYERS] |
| int | errno |
| FILE * | febelog = NULL |
| bool | isxumain |
| bool | maximumsetupsizehasbeenhit |
| int | maximumsetupsize |
| bool | logstuff |
| Session * | sessx |
| Input: User's session context. | |
| FILE * | interfaceinput = NULL |
| int | backenddaemon |
(to be defined)
Definition in file xumain.cxx.
|
|
Definition at line 103 of file xumain.cxx. |
|
|
??? (to be defined) Definition at line 334 of file xumain.cxx.
00335 {
00336 return (false);
00337 }
|
|
||||||||||||
|
??? (to be defined)
Definition at line 210 of file xumain.cxx. References assert, GRANTEXTLENGTH, Session::inp, typetext::itemid, typetext::length, typetext::string, and TEXTID. Referenced by sourceunixcommand().
00211 : User's session context 00212 typetext *textptr) 00213 { /* 00214 * * this code stolen from get2.d which could * use some improvement but be 00215 * careful */ 00216 int numinstring = 0; 00217 int temp; 00218 00219 numinstring = temp = 0; 00220 for (;;) { 00221 if (!fgets(textptr->string + numinstring, GRANTEXTLENGTH - numinstring, sess->inp)) { 00222 temp = 0; 00223 break; 00224 } 00225 temp = strlen(textptr->string + numinstring); 00226 if (temp < 1) { 00227 break; 00228 } 00229 numinstring += temp; 00230 if (numinstring >= GRANTEXTLENGTH) { 00231 break; 00232 } 00233 } 00234 00235 if (numinstring > GRANTEXTLENGTH) 00236 assert(0); // got too much in getmuchtext 00237 00238 if (numinstring == 0) { 00239 textptr->length = 0; 00240 return false; 00241 } 00242 00243 textptr->length = numinstring; 00244 textptr->itemid = TEXTID; 00245 return true; 00246 } |
|
||||||||||||
|
??? (to be defined)
Definition at line 326 of file get2.cxx. References Session::charinbuff, getnumber(), Session::inp, L, logfile, prompt(), pullc(), validrequest(), and WORDELIM. Referenced by xanadu().
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 347 of file xumain.cxx. References Session::account, and tumbleraccounteq(). Referenced by checkforopen(), and docreatenewversion().
00348 : User's session context 00349 Tumbler *tp) 00350 { 00351 return tumbleraccounteq(tp, &sess->account); 00352 } |
|
||||||||||||
|
??? (to be defined) <Input: User's session context Definition at line 153 of file xumain.cxx. References debug, Session::getaccount(), init(), initsession(), isxumain, nsessorcommand, NULL, processrcfile(), sessx, testforreservedness(), and xanadu().
00156 { /* inside temporary */
00157 Session sess;
00158 //UNUSED FILE *fd;
00159 //UNUSED int i = 0;
00160
00161 isxumain = true;
00162
00163 setbuf(stderr, NULL);
00164 debug = false;
00165 processrcfile();
00166 init(0);
00167 //now uses a ctor:: inittask(&sess);
00168 /*
00169 * if (fd = fopen ("xusetup", "r")) sess.inp = fd; errno = 0; */
00170 initsession("enf.enf");
00171 sessx = &sess;
00172 sess.getaccount(&sess.account);
00173 for (;;) {
00174 nsessorcommand++;
00175 /*
00176 * L("%d ",i++); */
00177 xanadu(&sess);
00178 testforreservedness("main");
00179 /* if (maximumsetupsizehasbeenhit) { L("Setup has reached size limit.\n"); diskexit (); } */
00180 }
00181 return 0;
00182 }
|
|
|
??? (to be defined) Definition at line 110 of file rcfile.cxx. References allocsize, ALLOCSIZENAME, HOSTMETANAME, hostname, incrementalallocsize, INCREMENTALALLOCSIZENAME, L, NULL, PORT, PORTMETANAME, portname, and RCFILENAME.
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 98 of file put.cxx. References Session::outp, and xuputstring(). Referenced by examine(), getbool(), getboolset(), getcopy(), getcreatelink(), getcreatenewversion(), getcutseq(), getdeletevspan(), getfindlinksfromtothree(), getfindnextnlinksfromtothree(), getfollowlink(), getinsert(), getrearrange(), getrequest(), getretrievedocvspan(), getretrievedocvspanset(), getshowrelationof2versions(), getspan(), getspanset(), getspecset(), getvspec(), playwithalloc(), setdebug(), showenfilades(), showorgl(), and sourceunixcommand().
00099 : User's session context 00100 char *string) 00101 { 00102 fprintf(sess->outp, "%s", string); 00103 } |
|
||||||||||||
|
??? (to be defined)
Definition at line 493 of file put.cxx. References CREATENEWDOCUMENT, Session::outp, putisa(), and putnumber(). Referenced by createnewdocument(), and sourceunixcommand().
00494 : User's session context 00495 IStreamAddr *newdocisaptr) 00496 { 00497 fprintf(sess->outp, "new document: "); 00498 putisa(sess, newdocisaptr); 00499 fprintf(sess->outp, "\n\n"); 00500 } |
|
|
??? (to be defined)
Definition at line 192 of file xumain.cxx. References Session::inp, maximumsetupsize, and Session::outp.
00193 : User's session context
00194 {
00195 char buff[100];
00196
00197 fprintf(sess->outp, "maximumsetupsize = ? ");
00198 maximumsetupsize = atoi(fgets(buff, 100, sess->inp));
00199 return true;
00200 }
|
|
|
??? (to be defined)
Definition at line 256 of file xumain.cxx. References assert, debug, doappend(), docreatenewdocument(), Session::free(), getmuchtext(), Session::inp, typetext::itemid, L, typetext::length, typetext::next, NULL, prompt(), putcreatenewdocument(), typetext::string, and TEXTID.
00257 : User's session context
00258 {
00259 char unixcommand[132];
00260 char file[64];
00261 IStreamAddr docisa;
00262 typetext *textsetptr;
00263
00264 FILE *infile;
00265 int count, lines, bugger;
00266 int status;
00267
00268 count = 0;
00269 lines = 0;
00270 bugger = debug;
00271
00272 sprintf(file, "xum%d", getpid());
00273 prompt(sess, " Enter unix command : ");
00274 fgets(unixcommand, 132, sess->inp);
00275
00276 if (unixcommand[strlen(unixcommand) - 1] == '\n')
00277 unixcommand[strlen(unixcommand) - 1] = '\0';
00278
00279 strcat(unixcommand, " >");
00280 strcat(unixcommand, file);
00281
00282 if ((status = system(unixcommand)) != 0) {
00283 L("Exit status = %d\n", status);
00284 perror("Udanax(system call 0)");
00285 // return false;
00286 }
00287 if (debug) {
00288 prompt(sess, "lines until debug : ");
00289 count = atoi(fgets(unixcommand, 132, sess->inp));
00290 if (count)
00291 debug = 0;
00292 }
00293
00294 docreatenewdocument(sess, &docisa);
00295 /* testforreservedness ("eatunixcommand createdoc"); */
00296 putcreatenewdocument(sess, &docisa);
00297
00298 infile = sess->inp;
00299 if (!(sess->inp = fopen(file, "r"))) {
00300 perror("xanadu");
00301 L("Couldn't open %s\n", file);
00302 assert(0); // Awful badness in sourceunixfile
00303 }
00304 while ((textsetptr = new(sess) typetext) != NULL
00305 // while ((textsetptr = (typetext *) sess->alloc(sizeof(typetext)))
00306 && (getmuchtext(sess, textsetptr) || (textsetptr->length > 0))) {
00307 if (debug)
00308 L("line # %d\n", lines);
00309 textsetptr->next = NULL;
00310 textsetptr->itemid = TEXTID;
00311 textsetptr->length = strlen(textsetptr->string);
00312 doappend(sess, &docisa, textsetptr);
00313 /* testforreservedness ("eatunixcommand loop"); */
00314 ++lines;
00315 sess->free();
00316 if (count && --count == 0)
00317 debug = bugger;
00318 }
00319 fclose(sess->inp);
00320 unlink(file);
00321 sess->inp = infile;
00322
00323 //NOBODY CARES return true;
00324 }
|
|
|
??? (to be defined)
Definition at line 131 of file xumain.cxx. References Session::free(), getrequest(), logstuff, requestfns, and typerequest. Referenced by main().
00132 : User's session context
00133 {
00134 typerequest request;
00135
00136 logstuff = false;
00137 if (getrequest(sess, &request))
00138 (*requestfns[request]) (sess);
00139 /*
00140 * else sess->inp = stdin; */
00141 logstuff = false;
00142 sess->free();
00143 }
|
|
|
Definition at line 115 of file xumain.cxx. |
|
|
Definition at line 107 of file xumain.cxx. |
|
|
Definition at line 108 of file xumain.cxx. |
|
|
Definition at line 114 of file xumain.cxx. |
|
|
Definition at line 109 of file xumain.cxx. |
|
|
Definition at line 112 of file xumain.cxx. |
|
|
Definition at line 111 of file xumain.cxx. Referenced by diskalloc(), and setmaximumsetupsize(). |
|
|
Definition at line 110 of file xumain.cxx. Referenced by diskalloc(). |
|
|
Definition at line 105 of file xumain.cxx. |
|
|
Input: User's session context.
Definition at line 113 of file xumain.cxx. |
|
|
Definition at line 104 of file xumain.cxx. |
1.3.4