inc/gfWebLib.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gfServerAt
struct  gfWebConfig

Functions

gfServerAtgfWebFindServer (struct gfServerAt *serverList, char *varName)
gfWebConfiggfWebConfigRead (char *fileName)


Function Documentation

struct gfWebConfig* gfWebConfigRead ( char *  fileName  )  [read]

Definition at line 28 of file gfWebLib.c.

References AllocVar, gfWebConfig::background, cfg, cloneString(), gfWebConfig::company, errAbort(), freeHash(), hashAdd(), hashLookup(), gfServerAt::host, lineFileNextReal(), lineFileOpen(), lineFile::lineIx, gfServerAt::name, newHash(), nextWord(), gfServerAt::port, sameString, sameWord, gfServerAt::seqDir, gfWebConfig::serverList, slAddTail(), gfWebConfig::tempDir, gfWebConfig::transServerList, trimSpaces(), and TRUE.

Referenced by main().

00030 {
00031 struct gfWebConfig *cfg;
00032 struct lineFile *lf = lineFileOpen(fileName, TRUE);
00033 char *line, *word;
00034 struct hash *uniqHash = newHash(0), *uniqTransHash = newHash(0), *hash;
00035 
00036 AllocVar(cfg);
00037 cfg->company = "";
00038 while (lineFileNextReal(lf, &line))
00039     {
00040     word = nextWord(&line);
00041     if (sameWord("company", word))
00042         {
00043         cfg->company = cloneString(trimSpaces(line));
00044         }
00045     else if (sameWord("gfServer", word) || sameWord("gfServerTrans", word))
00046         {
00047         struct gfServerAt *server;
00048         char *dupe = cloneString(line);
00049         AllocVar(server);
00050         server->host = nextWord(&dupe);
00051         server->port = nextWord(&dupe);
00052         server->seqDir = nextWord(&dupe);
00053         server->name = trimSpaces(dupe);
00054         if (server->name == NULL || server->name[0] == 0)
00055             errAbort("Badly formed gfServer command line %d of %s:\n%s",
00056                 lf->lineIx, fileName, line);
00057         if (sameString("gfServerTrans", word))
00058             {
00059             slAddTail(&cfg->transServerList, server);
00060             hash = uniqTransHash;
00061             }
00062         else
00063             {
00064             slAddTail(&cfg->serverList, server);
00065             hash = uniqHash;
00066             }
00067         if (hashLookup(hash, server->name))
00068             errAbort("Duplicate %s name %s line %d of %s",
00069                 word, server->name, lf->lineIx, fileName);
00070         hashAdd(hash, server->name, NULL);
00071         }
00072     else if (sameWord("tempDir", word))
00073         {
00074         cfg->tempDir = cloneString(trimSpaces(line));
00075         }
00076     else if (sameWord("background", word))
00077         {
00078         cfg->background = cloneString(trimSpaces(line));
00079         }
00080     else
00081         {
00082         errAbort("Unrecognized command %s line %d of  %s", word, lf->lineIx, fileName);
00083         }
00084     }
00085 
00086 if (cfg->serverList == NULL && cfg->transServerList == NULL)
00087     errAbort("no gfServer's specified in %s", fileName);
00088 freeHash(&uniqHash);
00089 freeHash(&uniqTransHash);
00090 return cfg;
00091 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct gfServerAt* gfWebFindServer ( struct gfServerAt serverList,
char *  varName 
) [read]

Definition at line 10 of file gfWebLib.c.

References cgiString(), cgiVarExists(), errAbort(), gfServerAt::name, gfServerAt::next, and sameString.

Referenced by findServer().

00012 {
00013 struct gfServerAt *server = serverList;
00014 if (cgiVarExists(varName))
00015      {
00016      char *db = cgiString(varName);
00017      for (server = serverList; server != NULL; server = server->next)
00018           {
00019           if (sameString(db, server->name))
00020               break;
00021           }
00022      if (server == NULL)
00023           errAbort("%s %s not found", varName, db);
00024      }
00025 return server;
00026 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 18:59:10 2007 for blat by  doxygen 1.5.2