#include "dystring.h"#include "hash.h"Include dependency graph for cheapcgi.h:

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

Go to the source code of this file.
Data Structures | |
| struct | cgiVar |
| struct | cgiChoice |
Defines | |
| #define | cgiUsualInt cgiOptionalInt |
| #define | cgiUsualDouble cgiOptionalDouble |
Functions | |
| cgiVar * | cgiVarList () |
| char * | findCookieData (char *varName) |
| void | dumpCookieList () |
| boolean | cgiIsOnWeb () |
| char * | cgiScriptName () |
| char * | cgiServerName () |
| char * | cgiString (char *varName) |
| int | cgiInt (char *varName) |
| double | cgiDouble (char *varName) |
| boolean | cgiBoolean (char *varName) |
| boolean | cgiBooleanDefined (char *name) |
| char * | cgiBooleanShadowPrefix () |
| void | cgiMakeHiddenBoolean (char *name, boolean on) |
| int | cgiIntExp (char *varName) |
| char * | cgiOptionalString (char *varName) |
| char * | cgiUsualString (char *varName, char *usual) |
| slName * | cgiStringList (char *varName) |
| int | cgiOptionalInt (char *varName, int defaultVal) |
| double | cgiOptionalDouble (char *varName, double defaultVal) |
| int | cgiOneChoice (char *varName, struct cgiChoice *choices, int choiceSize) |
| boolean | cgiVarExists (char *varName) |
| void | cgiBadVar (char *varName) |
| void | cgiDecode (char *in, char *out, int inLength) |
| char * | cgiEncode (char *inString) |
| char * | cgiEncodeFull (char *inString) |
| void | cgiMakeButtonWithMsg (char *name, char *value, char *msg) |
| void | cgiMakeButton (char *name, char *value) |
| void | cgiMakeOnClickButton (char *command, char *value) |
| void | cgiMakeOptionalButton (char *name, char *value, boolean disabled) |
| void | cgiMakeRadioButton (char *name, char *value, boolean checked) |
| void | cgiMakeOnClickRadioButton (char *name, char *value, boolean checked, char *command) |
| void | cgiMakeCheckBoxWithMsg (char *name, boolean checked, char *msg) |
| void | cgiMakeCheckBox (char *name, boolean checked) |
| void | cgiMakeTextArea (char *varName, char *initialVal, int rowCount, int columnCount) |
| void | cgiMakeTextAreaDisableable (char *varName, char *initialVal, int rowCount, int columnCount, boolean disabled) |
| void | cgiMakeTextVar (char *varName, char *initialVal, int charSize) |
| void | cgiMakeIntVar (char *varName, int initialVal, int maxDigits) |
| void | cgiMakeDoubleVar (char *varName, double initialVal, int maxDigits) |
| void | cgiMakeDropListClass (char *name, char *menu[], int menuSize, char *checked, char *class) |
| void | cgiMakeDropList (char *name, char *menu[], int menuSize, char *checked) |
| void | cgiMakeDropListWithVals (char *name, char *menu[], char *values[], int menuSize, char *checked) |
| void | cgiMakeDropListFull (char *name, char *menu[], char *values[], int menuSize, char *checked, char *extraAttribs) |
| void | cgiMakeMultList (char *name, char *menu[], int menuSize, char *checked, int length) |
| void | cgiMakeHiddenVar (char *varName, char *string) |
| void | cgiContinueHiddenVar (char *varName) |
| void | cgiContinueAllVars () |
| void | cgiVarExclude (char *varName) |
| void | cgiVarExcludeExcept (char **varNames) |
| void | cgiVarSet (char *varName, char *val) |
| dyString * | cgiUrlString () |
| boolean | cgiSpoof (int *pArgc, char *argv[]) |
| boolean | cgiFromCommandLine (int *pArgc, char *argv[], boolean preferWeb) |
| void | useTempFile () |
| boolean | cgiFromFile (char *fileName) |
| boolean | cgiParseInput (char *input, struct hash **retHash, struct cgiVar **retList) |
| void | cgiSimpleTableStart () |
| void | cgiTableEnd () |
| void | cgiMakeSubmitButton () |
| void | cgiMakeResetButton () |
| void | cgiMakeClearButton (char *form, char *field) |
| void | cgiMakeFileEntry (char *name) |
| void | cgiSimpleTableRowStart () |
| void | cgiTableRowEnd () |
| void | cgiSimpleTableFieldStart () |
| void | cgiTableFieldEnd () |
| void | cgiTableField (char *text) |
| void | cgiTableFieldWithMsg (char *text, char *msg) |
| void | cgiParagraph (char *text) |
| #define cgiUsualDouble cgiOptionalDouble |
Definition at line 97 of file cheapcgi.h.
| #define cgiUsualInt cgiOptionalInt |
Definition at line 96 of file cheapcgi.h.
| void cgiBadVar | ( | char * | varName | ) |
Definition at line 477 of file cheapcgi.c.
References errAbort().
Referenced by htmlBadVar(), and mustFindVarData().
00479 { 00480 if (varName == NULL) varName = ""; 00481 errAbort("Sorry, didn't find input variable %s\n" 00482 "Probably the web page didn't mean to call this program.", 00483 varName); 00484 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean cgiBoolean | ( | char * | varName | ) |
Definition at line 716 of file cheapcgi.c.
References cgiVarExists().
00717 { 00718 return cgiVarExists(varName); 00719 }
Here is the call graph for this function:

| boolean cgiBooleanDefined | ( | char * | name | ) |
Definition at line 880 of file cheapcgi.c.
References cgiBooleanShadowPrefix(), cgiVarExists(), and safef().
00883 { 00884 char buf[256]; 00885 safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name); 00886 return cgiVarExists(buf); 00887 }
Here is the call graph for this function:

| char* cgiBooleanShadowPrefix | ( | ) |
Definition at line 874 of file cheapcgi.c.
Referenced by cgiBooleanDefined(), cgiMakeCheckBoxWithMsg(), and cgiMakeHiddenBoolean().
Here is the caller graph for this function:

| void cgiContinueAllVars | ( | ) |
Definition at line 1146 of file cheapcgi.c.
References cgiMakeHiddenVar(), inputList, cgiVar::name, cgiVar::next, and cgiVar::val.
01148 { 01149 struct cgiVar *cv; 01150 for (cv = inputList; cv != NULL; cv = cv->next) 01151 cgiMakeHiddenVar(cv->name, cv->val); 01152 }
Here is the call graph for this function:

| void cgiContinueHiddenVar | ( | char * | varName | ) |
Definition at line 1070 of file cheapcgi.c.
References cgiMakeHiddenVar(), cgiString(), and cgiVarExists().
01072 { 01073 if (cgiVarExists(varName)) 01074 cgiMakeHiddenVar(varName, cgiString(varName)); 01075 }
Here is the call graph for this function:

| void cgiDecode | ( | char * | in, | |
| char * | out, | |||
| int | inLength | |||
| ) |
Definition at line 495 of file cheapcgi.c.
Referenced by cgiParseInputAbort(), and parseCookies().
00499 { 00500 char c; 00501 int i; 00502 for (i=0; i<inLength;++i) 00503 { 00504 c = *in++; 00505 if (c == '+') 00506 *out++ = ' '; 00507 else if (c == '%') 00508 { 00509 int code; 00510 if (sscanf(in, "%2x", &code) != 1) 00511 code = '?'; 00512 in += 2; 00513 i += 2; 00514 *out++ = code; 00515 } 00516 else 00517 *out++ = c; 00518 } 00519 *out++ = 0; 00520 }
Here is the caller graph for this function:

| double cgiDouble | ( | char * | varName | ) |
Definition at line 689 of file cheapcgi.c.
References errAbort(), and mustFindVarData().
Referenced by cgiOptionalDouble().
00691 { 00692 char *data; 00693 double x; 00694 00695 data = mustFindVarData(varName); 00696 if (sscanf(data, "%lf", &x)<1) 00697 errAbort("Expecting real number in %s, got \"%s\"\n", varName, data); 00698 return x; 00699 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* cgiEncode | ( | char * | inString | ) |
Definition at line 522 of file cheapcgi.c.
References cloneString(), needMem(), and safef().
Referenced by appendCgiVar(), cgiUrlString(), and htmlSetCookie().
00526 { 00527 char c; 00528 int outSize = 0; 00529 char *outString, *out, *in; 00530 00531 if (inString == NULL) 00532 return(cloneString("")); 00533 00534 /* Count up how long it will be */ 00535 in = inString; 00536 while ((c = *in++) != 0) 00537 { 00538 if (isalnum(c) || c == ' ' || c == '.' || c == '_') 00539 outSize += 1; 00540 else 00541 outSize += 3; 00542 } 00543 outString = needMem(outSize+1); 00544 00545 /* Encode string */ 00546 in = inString; 00547 out = outString; 00548 while ((c = *in++) != 0) 00549 { 00550 if (isalnum(c) || c == '.' || c == '_') 00551 *out++ = c; 00552 else if (c == ' ') 00553 *out++ = '+'; 00554 else 00555 { 00556 unsigned char uc = c; 00557 char buf[4]; 00558 *out++ = '%'; 00559 safef(buf, sizeof(buf), "%02X", uc); 00560 *out++ = buf[0]; 00561 *out++ = buf[1]; 00562 } 00563 } 00564 *out++ = 0; 00565 return outString; 00566 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* cgiEncodeFull | ( | char * | inString | ) |
Definition at line 568 of file cheapcgi.c.
References cloneString(), needMem(), and safef().
00572 { 00573 char c; 00574 int outSize = 0; 00575 char *outString, *out, *in; 00576 00577 if (inString == NULL) 00578 return(cloneString("")); 00579 00580 /* Count up how long it will be */ 00581 in = inString; 00582 while ((c = *in++) != 0) 00583 { 00584 if (isalnum(c) || c == '.' || c == '_') 00585 outSize += 1; 00586 else 00587 outSize += 3; 00588 } 00589 outString = needMem(outSize+1); 00590 00591 /* Encode string */ 00592 in = inString; 00593 out = outString; 00594 while ((c = *in++) != 0) 00595 { 00596 if (isalnum(c) || c == '.' || c == '_') 00597 *out++ = c; 00598 else 00599 { 00600 unsigned char uc = c; 00601 char buf[4]; 00602 *out++ = '%'; 00603 safef(buf, sizeof(buf), "%02X", uc); 00604 *out++ = buf[0]; 00605 *out++ = buf[1]; 00606 } 00607 } 00608 *out++ = 0; 00609 return outString; 00610 }
Here is the call graph for this function:

| boolean cgiFromCommandLine | ( | int * | pArgc, | |
| char * | argv[], | |||
| boolean | preferWeb | |||
| ) |
Definition at line 1155 of file cheapcgi.c.
References cgiIsOnWeb(), FALSE, initCgiInput(), name, safef(), and TRUE.
Referenced by cgiSpoof().
01158 : 01159 * cgiScript nonCgiArg1 var1=value1 var2=value2 var3=value3 nonCgiArg2 01160 * or like 01161 * cgiScript nonCgiArg1 var1=value1&var2=value2&var3=value3 nonCgiArg2 01162 * or even like 01163 * cgiScript nonCgiArg1 -x -y=bogus z=really 01164 * (The non-cgi arguments can occur anywhere. The cgi arguments (all containing 01165 * the character '=' or starting with '-') are erased from argc/argv. Normally 01166 * you call this cgiSpoof(&argc, argv); 01167 */ 01168 { 01169 int argc = *pArgc; 01170 int i; 01171 int argcLeft = argc; 01172 char *name; 01173 static char queryString[4096]; 01174 char *q = queryString; 01175 boolean needAnd = TRUE; 01176 boolean gotAny = FALSE; 01177 boolean startDash; 01178 boolean gotEq; 01179 static char hostLine[512]; 01180 01181 if (preferWeb && cgiIsOnWeb()) 01182 return TRUE; /* No spoofing required! */ 01183 q += safef(q, queryString + sizeof(queryString) - q, 01184 "%s", "QUERY_STRING=cgiSpoof=on"); 01185 for (i=0; i<argcLeft; ) 01186 { 01187 name = argv[i]; 01188 if ((startDash = (name[0] == '-'))) 01189 ++name; 01190 gotEq = (strchr(name, '=') != NULL); 01191 if (gotEq || startDash) 01192 { 01193 if (needAnd) 01194 *q++ = '&'; 01195 q += safef(q, queryString + sizeof(queryString) - q, "%s", name); 01196 if (!gotEq || strchr(name, '&') == NULL) 01197 needAnd = TRUE; 01198 if (!gotEq) 01199 q += safef(q, queryString + sizeof(queryString) - q, "=on"); 01200 memcpy(&argv[i], &argv[i+1], sizeof(argv[i]) * (argcLeft-i-1)); 01201 argcLeft -= 1; 01202 gotAny = TRUE; 01203 } 01204 else 01205 i++; 01206 } 01207 if (gotAny) 01208 { 01209 *pArgc = argcLeft; 01210 } 01211 putenv("REQUEST_METHOD=GET"); 01212 putenv(queryString); 01213 safef(hostLine, sizeof(hostLine), "SERVER_NAME=%s", getenv("HOST")); 01214 putenv(hostLine); 01215 initCgiInput(); 01216 return gotAny; 01217 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean cgiFromFile | ( | char * | fileName | ) |
Definition at line 1227 of file cheapcgi.c.
References AllocArray, cgiSpoof(), cloneString(), ExpandArray, FALSE, freez(), lineFileClose(), lineFileNext(), lineFileOpen(), sameString, and TRUE.
01229 : 01230 * argument1=someVal 01231 * # This is a comment 01232 * argument2=someOtherVal 01233 * ... 01234 * and puts them into the cgi environment so that the usual 01235 * cgiGetVar() commands can be used. Useful when a program 01236 * has a lot of possible parameters. 01237 */ 01238 { 01239 char **argv = NULL; 01240 int argc = 0; 01241 int maxArgc = 10; 01242 int i; 01243 struct lineFile *lf = lineFileOpen(fileName, TRUE); 01244 char *line; 01245 boolean spoof= FALSE; 01246 AllocArray(argv, maxArgc); 01247 /* Remember that first arg is program name. 01248 Put filename there instead. */ 01249 argc = 1; 01250 argv[0] = cloneString(fileName); 01251 for(;;) 01252 { 01253 /* If we are at the end we're done. */ 01254 if(!lineFileNext(lf, &line, NULL)) 01255 break; 01256 /* If it is a comment or blank line skip it. */ 01257 if (line[0] == '#' || sameString(line, "")) 01258 continue; 01259 /* If our argv array is full expand it. */ 01260 if((argc+1) >= maxArgc) 01261 { 01262 ExpandArray(argv, maxArgc, 2*maxArgc); 01263 maxArgc *= 2; 01264 } 01265 /* Fill in another argument to our psuedo arguments. */ 01266 argv[argc++] = cloneString(line); 01267 } 01268 spoof = cgiSpoof(&argc, argv); 01269 /* Cleanup. */ 01270 lineFileClose(&lf); 01271 for(i=0; i<argc; i++) 01272 freez(&argv[i]); 01273 freez(&argv); 01274 return spoof; 01275 } }
Here is the call graph for this function:

| int cgiInt | ( | char * | varName | ) |
Definition at line 657 of file cheapcgi.c.
References errAbort(), mustFindVarData(), and skipLeadingSpaces().
Referenced by cgiOptionalInt(), and doDetailLine().
00659 { 00660 char *data; 00661 char c; 00662 00663 data = mustFindVarData(varName); 00664 data = skipLeadingSpaces(data); 00665 c = data[0]; 00666 if (!(isdigit(c) || (c == '-' && isdigit(data[1])))) 00667 errAbort("Expecting number in %s, got \"%s\"\n", varName, data); 00668 return atoi(data); 00669 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int cgiIntExp | ( | char * | varName | ) |
Definition at line 671 of file cheapcgi.c.
References cgiString(), and intExp().
Here is the call graph for this function:

| boolean cgiIsOnWeb | ( | ) |
Definition at line 44 of file cheapcgi.c.
Referenced by cgiFromCommandLine(), and main().
Here is the caller graph for this function:

| void cgiMakeButton | ( | char * | name, | |
| char * | value | |||
| ) |
Definition at line 770 of file cheapcgi.c.
References cgiMakeButtonWithMsg().
Referenced by cgiMakeSubmitButton(), and doGetSeq().
00772 { 00773 cgiMakeButtonWithMsg(name, value, NULL); 00774 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiMakeButtonWithMsg | ( | char * | name, | |
| char * | value, | |||
| char * | msg | |||
| ) |
Definition at line 762 of file cheapcgi.c.
Referenced by cgiMakeButton().
00764 { 00765 printf("<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"%s\" %s%s%s>", 00766 name, value, 00767 (msg ? " TITLE=\"" : ""), (msg ? msg : ""), (msg ? "\"" : "" )); 00768 }
Here is the caller graph for this function:

| void cgiMakeCheckBox | ( | char * | name, | |
| boolean | checked | |||
| ) |
Definition at line 903 of file cheapcgi.c.
References cgiMakeCheckBoxWithMsg().
00905 { 00906 cgiMakeCheckBoxWithMsg(name, checked, NULL); 00907 }
Here is the call graph for this function:

| void cgiMakeCheckBoxWithMsg | ( | char * | name, | |
| boolean | checked, | |||
| char * | msg | |||
| ) |
Definition at line 889 of file cheapcgi.c.
References cgiBooleanShadowPrefix(), cgiMakeHiddenVar(), and safef().
Referenced by cgiMakeCheckBox().
00893 { 00894 char buf[256]; 00895 00896 printf("<INPUT TYPE=CHECKBOX NAME=\"%s\" VALUE=on %s%s%s %s>", name, 00897 (msg ? " TITLE=\"" : ""), (msg ? msg : ""), (msg ? "\"" : "" ), 00898 (checked ? " CHECKED" : "")); 00899 safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name); 00900 cgiMakeHiddenVar(buf, "1"); 00901 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiMakeClearButton | ( | char * | form, | |
| char * | field | |||
| ) |
Definition at line 752 of file cheapcgi.c.
References cgiMakeOnClickButton(), and safef().
00754 { 00755 char javascript[1024]; 00756 00757 safef(javascript, sizeof(javascript), 00758 "document.%s.%s.value = ''; document.%s.submit();", form, field, form); 00759 cgiMakeOnClickButton(javascript, " Clear "); 00760 }
Here is the call graph for this function:

| void cgiMakeDoubleVar | ( | char * | varName, | |
| double | initialVal, | |||
| int | maxDigits | |||
| ) |
Definition at line 957 of file cheapcgi.c.
00959 { 00960 if (maxDigits == 0) maxDigits = 4; 00961 00962 printf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=%d VALUE=%g>", varName, 00963 maxDigits, initialVal); 00964 }
| void cgiMakeDropList | ( | char * | name, | |
| char * | menu[], | |||
| int | menuSize, | |||
| char * | checked | |||
| ) |
Definition at line 968 of file cheapcgi.c.
References cgiMakeDropListClass().
Referenced by doGetSeq().
00971 { 00972 cgiMakeDropListClass(name, menu, menuSize, checked, "normalText"); 00973 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiMakeDropListClass | ( | char * | name, | |
| char * | menu[], | |||
| int | menuSize, | |||
| char * | checked, | |||
| char * | class | |||
| ) |
Definition at line 976 of file cheapcgi.c.
References sameWord.
Referenced by cgiMakeDropList().
00979 { 00980 int i; 00981 char *selString; 00982 if (checked == NULL) checked = menu[0]; 00983 printf("<SELECT NAME=\"%s\" class=%s>\n", name, class); 00984 for (i=0; i<menuSize; ++i) 00985 { 00986 if (sameWord(menu[i], checked)) 00987 selString = " SELECTED"; 00988 else 00989 selString = ""; 00990 printf("<OPTION%s>%s</OPTION>\n", selString, menu[i]); 00991 } 00992 printf("</SELECT>\n"); 00993 }
Here is the caller graph for this function:

| void cgiMakeDropListFull | ( | char * | name, | |
| char * | menu[], | |||
| char * | values[], | |||
| int | menuSize, | |||
| char * | checked, | |||
| char * | extraAttribs | |||
| ) |
Definition at line 1015 of file cheapcgi.c.
References sameWord.
01018 { 01019 int i; 01020 char *selString; 01021 if (checked == NULL) checked = menu[0]; 01022 01023 if (NULL != extraAttribs) 01024 { 01025 printf("<SELECT NAME=\"%s\" %s>\n", name, extraAttribs); 01026 } 01027 else 01028 { 01029 printf("<SELECT NAME=\"%s\">\n", name); 01030 } 01031 01032 for (i=0; i<menuSize; ++i) 01033 { 01034 if (sameWord(values[i], checked)) 01035 selString = " SELECTED"; 01036 else 01037 selString = ""; 01038 printf("<OPTION%s VALUE=\"%s\">%s</OPTION>\n", selString, values[i], menu[i]); 01039 } 01040 printf("</SELECT>\n"); 01041 }
| void cgiMakeDropListWithVals | ( | char * | name, | |
| char * | menu[], | |||
| char * | values[], | |||
| int | menuSize, | |||
| char * | checked | |||
| ) |
Definition at line 1043 of file cheapcgi.c.
References sameWord.
01047 { 01048 int i; 01049 char *selString; 01050 if (checked == NULL) checked = values[0]; 01051 01052 printf("<SELECT NAME=\"%s\">\n", name); 01053 for (i=0; i<menuSize; ++i) 01054 { 01055 if (sameWord(values[i], checked)) 01056 selString = " SELECTED"; 01057 else 01058 selString = ""; 01059 printf("<OPTION%s VALUE=\"%s\">%s</OPTION>\n", selString, values[i], menu[i]); 01060 } 01061 printf("</SELECT>\n"); 01062 }
| void cgiMakeFileEntry | ( | char * | name | ) |
| void cgiMakeHiddenBoolean | ( | char * | name, | |
| boolean | on | |||
| ) |
Definition at line 909 of file cheapcgi.c.
References cgiBooleanShadowPrefix(), cgiMakeHiddenVar(), and safef().
00913 { 00914 char buf[256]; 00915 cgiMakeHiddenVar(name, on ? "on" : "off"); 00916 safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name); 00917 cgiMakeHiddenVar(buf, "1"); 00918 }
Here is the call graph for this function:

| void cgiMakeHiddenVar | ( | char * | varName, | |
| char * | string | |||
| ) |
Definition at line 1064 of file cheapcgi.c.
Referenced by cgiContinueAllVars(), cgiContinueHiddenVar(), cgiMakeCheckBoxWithMsg(), and cgiMakeHiddenBoolean().
Here is the caller graph for this function:

| void cgiMakeIntVar | ( | char * | varName, | |
| int | initialVal, | |||
| int | maxDigits | |||
| ) |
Definition at line 948 of file cheapcgi.c.
00950 { 00951 if (maxDigits == 0) maxDigits = 4; 00952 00953 printf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=%d VALUE=%d>", varName, 00954 maxDigits, initialVal); 00955 }
| void cgiMakeMultList | ( | char * | name, | |
| char * | menu[], | |||
| int | menuSize, | |||
| char * | checked, | |||
| int | length | |||
| ) |
Definition at line 995 of file cheapcgi.c.
References sameWord.
00999 { 01000 int i; 01001 char *selString; 01002 if (checked == NULL) checked = menu[0]; 01003 printf("<SELECT MULTIPLE SIZE=%d ALIGN=CENTER NAME=\"%s\">\n", length, name); 01004 for (i=0; i<menuSize; ++i) 01005 { 01006 if (sameWord(menu[i], checked)) 01007 selString = " SELECTED"; 01008 else 01009 selString = ""; 01010 printf("<OPTION%s>%s</OPTION>\n", selString, menu[i]); 01011 } 01012 printf("</SELECT>\n"); 01013 }
| void cgiMakeOnClickButton | ( | char * | command, | |
| char * | value | |||
| ) |
Definition at line 776 of file cheapcgi.c.
Referenced by cgiMakeClearButton().
00778 { 00779 printf("<INPUT TYPE=\"button\" VALUE=\"%s\" onClick=\"%s\">", value, command); 00780 }
Here is the caller graph for this function:

| void cgiMakeOnClickRadioButton | ( | char * | name, | |
| char * | value, | |||
| boolean | checked, | |||
| char * | command | |||
| ) |
Definition at line 863 of file cheapcgi.c.
00869 { 00870 printf("<INPUT TYPE=RADIO NAME=\"%s\" VALUE=\"%s\" %s %s>", 00871 name, value, command, (checked ? "CHECKED" : "")); 00872 }
| void cgiMakeOptionalButton | ( | char * | name, | |
| char * | value, | |||
| boolean | disabled | |||
| ) |
Definition at line 782 of file cheapcgi.c.
00784 { 00785 printf("<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"%s\"", name, value); 00786 if (disabled) 00787 printf(" DISABLED"); 00788 printf(">"); 00789 }
| void cgiMakeRadioButton | ( | char * | name, | |
| char * | value, | |||
| boolean | checked | |||
| ) |
Definition at line 854 of file cheapcgi.c.
00858 { 00859 printf("<INPUT TYPE=RADIO NAME=\"%s\" VALUE=\"%s\" %s>", name, value, 00860 (checked ? "CHECKED" : "")); 00861 }
| void cgiMakeResetButton | ( | ) |
| void cgiMakeSubmitButton | ( | ) |
Definition at line 740 of file cheapcgi.c.
References cgiMakeButton().
00742 { 00743 cgiMakeButton("Submit", "Submit"); 00744 }
Here is the call graph for this function:

| void cgiMakeTextArea | ( | char * | varName, | |
| char * | initialVal, | |||
| int | rowCount, | |||
| int | columnCount | |||
| ) |
Definition at line 920 of file cheapcgi.c.
References cgiMakeTextAreaDisableable(), and FALSE.
Referenced by doGetSeq().
00921 : intialVal */ 00922 { 00923 cgiMakeTextAreaDisableable(varName, initialVal, rowCount, columnCount, FALSE); 00924 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiMakeTextAreaDisableable | ( | char * | varName, | |
| char * | initialVal, | |||
| int | rowCount, | |||
| int | columnCount, | |||
| boolean | disabled | |||
| ) |
Definition at line 926 of file cheapcgi.c.
Referenced by cgiMakeTextArea().
00928 : intialVal */ 00929 { 00930 printf("<TEXTAREA NAME=\"%s\" ROWS=%d COLS=%d %s>%s</TEXTAREA>", varName, 00931 rowCount, columnCount, disabled ? "DISABLED" : "", 00932 (initialVal != NULL ? initialVal : "")); 00933 }
Here is the caller graph for this function:

| void cgiMakeTextVar | ( | char * | varName, | |
| char * | initialVal, | |||
| int | charSize | |||
| ) |
Definition at line 935 of file cheapcgi.c.
00938 { 00939 if (initialVal == NULL) 00940 initialVal = ""; 00941 if (charSize == 0) charSize = strlen(initialVal); 00942 if (charSize == 0) charSize = 8; 00943 00944 printf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=%d VALUE=\"%s\">", varName, 00945 charSize, initialVal); 00946 }
| int cgiOneChoice | ( | char * | varName, | |
| struct cgiChoice * | choices, | |||
| int | choiceSize | |||
| ) |
Definition at line 721 of file cheapcgi.c.
References cgiString(), errAbort(), name, and sameWord.
00723 { 00724 char *key = cgiString(varName); 00725 int i; 00726 int val = -1; 00727 00728 for (i=0; i<choiceSize; ++i) 00729 { 00730 if (sameWord(choices[i].name, key)) 00731 { 00732 val = choices[i].value; 00733 return val; 00734 } 00735 } 00736 errAbort("Unknown key %s for variable %s\n", key, varName); 00737 return val; 00738 }
Here is the call graph for this function:

| double cgiOptionalDouble | ( | char * | varName, | |
| double | defaultVal | |||
| ) |
Definition at line 701 of file cheapcgi.c.
References cgiDouble(), and cgiVarExists().
00703 { 00704 if (!cgiVarExists(varName)) 00705 return defaultVal; 00706 return cgiDouble(varName); 00707 }
Here is the call graph for this function:

| int cgiOptionalInt | ( | char * | varName, | |
| int | defaultVal | |||
| ) |
Definition at line 678 of file cheapcgi.c.
References cgiInt(), cgiOptionalString(), isEmpty, and skipLeadingSpaces().
00681 { 00682 char *s = cgiOptionalString(varName); 00683 s = skipLeadingSpaces(s); 00684 if (isEmpty(s)) 00685 return defaultVal; 00686 return cgiInt(varName); 00687 }
Here is the call graph for this function:

| char* cgiOptionalString | ( | char * | varName | ) |
Definition at line 612 of file cheapcgi.c.
References findVarData().
Referenced by cgiOptionalInt(), and initCgiInput().
00614 { 00615 return findVarData(varName); 00616 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiParagraph | ( | char * | text | ) |
Definition at line 402 of file cheapcgi.c.
References cgiParseAbort(), cgiParseInputAbort(), cgiParseRecover, FALSE, popAbortHandler(), pushAbortHandler(), and TRUE.
00408 { 00409 boolean ok = TRUE; 00410 int status = setjmp(cgiParseRecover); 00411 if (status == 0) /* Always true except after long jump. */ 00412 { 00413 pushAbortHandler(cgiParseAbort); 00414 cgiParseInputAbort(input, retHash, retList); 00415 } 00416 else /* They long jumped here because of an error. */ 00417 { 00418 ok = FALSE; 00419 } 00420 popAbortHandler(); 00421 return ok; 00422 }
Here is the call graph for this function:

| char* cgiScriptName | ( | ) |
| char* cgiServerName | ( | ) |
| void cgiSimpleTableFieldStart | ( | ) |
| void cgiSimpleTableRowStart | ( | ) |
| void cgiSimpleTableStart | ( | ) |
| boolean cgiSpoof | ( | int * | pArgc, | |
| char * | argv[] | |||
| ) |
Definition at line 1219 of file cheapcgi.c.
References cgiFromCommandLine(), and TRUE.
Referenced by cgiFromFile(), and main().
01223 { 01224 return cgiFromCommandLine(pArgc, argv, TRUE); 01225 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* cgiString | ( | char * | varName | ) |
Definition at line 619 of file cheapcgi.c.
References mustFindVarData().
Referenced by cgiContinueHiddenVar(), cgiIntExp(), cgiOneChoice(), doBlat(), doDetailLine(), and gfWebFindServer().
00621 { 00622 return mustFindVarData(varName); 00623 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct slName* cgiStringList | ( | char * | varName | ) | [read] |
Definition at line 636 of file cheapcgi.c.
References hashLookup(), initCgiInput(), inputHash, hashEl::name, newSlName(), hashEl::next, sameString, slAddHead, and hashEl::val.
00639 { 00640 struct hashEl *hel; 00641 struct slName *stringList = NULL, *string; 00642 00643 initCgiInput(); 00644 for (hel = hashLookup(inputHash, varName); hel != NULL; hel = hel->next) 00645 { 00646 if (sameString(hel->name, varName)) 00647 { 00648 struct cgiVar *var = hel->val; 00649 string = newSlName(var->val); 00650 slAddHead(&stringList, string); 00651 } 00652 } 00653 return stringList; 00654 }
Here is the call graph for this function:

| void cgiTableEnd | ( | ) |
| void cgiTableField | ( | char * | text | ) |
| void cgiTableFieldEnd | ( | ) |
| void cgiTableFieldWithMsg | ( | char * | text, | |
| char * | msg | |||
| ) |
Definition at line 840 of file cheapcgi.c.
00842 { 00843 printf("<TD %s%s%s> %s </TD>\n", 00844 (msg ? " TITLE=\"" : ""), (msg ? msg : ""), (msg ? "\"" : "" ), 00845 text); 00846 }
| void cgiTableRowEnd | ( | ) |
| struct dyString* cgiUrlString | ( | ) | [read] |
Definition at line 1126 of file cheapcgi.c.
References cgiEncode(), dyStringAppend(), dyStringPrintf(), freez(), inputList, cgiVar::name, newDyString(), cgiVar::next, and cgiVar::val.
01128 { 01129 struct dyString *dy = newDyString(0); 01130 struct cgiVar *cv; 01131 char *e; 01132 01133 01134 for (cv = inputList; cv != NULL; cv = cv->next) 01135 { 01136 if (cv != inputList) 01137 dyStringAppend(dy, "&"); 01138 e = cgiEncode(cv->val); 01139 dyStringPrintf(dy, "%s=", cv->name); 01140 dyStringAppend(dy, e); 01141 freez(&e); 01142 } 01143 return dy; 01144 }
Here is the call graph for this function:

| char* cgiUsualString | ( | char * | varName, | |
| char * | usual | |||
| ) |
Definition at line 625 of file cheapcgi.c.
References findVarData().
Referenced by aliLines(), doBlat(), and doGetSeq().
00628 { 00629 char *pt; 00630 pt = findVarData(varName); 00631 if (pt == NULL) 00632 pt = usual; 00633 return pt; 00634 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiVarExclude | ( | char * | varName | ) |
Definition at line 1077 of file cheapcgi.c.
References cgiVarExists(), hashRemove(), inputHash, inputList, and slRemoveEl().
Referenced by cgiVarExcludeExcept().
01079 { 01080 if (cgiVarExists(varName)) 01081 { 01082 struct cgiVar *cv = hashRemove(inputHash, varName); 01083 slRemoveEl(&inputList, cv); 01084 } 01085 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cgiVarExcludeExcept | ( | char ** | varNames | ) |
Definition at line 1087 of file cheapcgi.c.
References cgiVarExclude(), freeHash(), hashAdd(), hashElFreeList(), hashElListHash(), hashLookup(), initCgiInput(), inputHash, hashEl::name, newHash(), and hashEl::next.
01091 { 01092 struct hashEl *list, *el; 01093 struct hash *exclude = newHash(8); 01094 char *s; 01095 01096 /* Build up hash of things to exclude */ 01097 if (varNames != NULL) 01098 { 01099 while ((s = *varNames++) != NULL) 01100 hashAdd(exclude, s, NULL); 01101 } 01102 01103 /* Step through variable list and remove them if not 01104 * excluded. */ 01105 initCgiInput(); 01106 list = hashElListHash(inputHash); 01107 for (el = list; el != NULL; el = el->next) 01108 { 01109 if (!hashLookup(exclude, el->name)) 01110 cgiVarExclude(el->name); 01111 } 01112 hashElFreeList(&list); 01113 freeHash(&exclude); 01114 }
Here is the call graph for this function:

| boolean cgiVarExists | ( | char * | varName | ) |
Definition at line 709 of file cheapcgi.c.
References hashLookup(), initCgiInput(), and inputHash.
Referenced by cgiBoolean(), cgiBooleanDefined(), cgiContinueHiddenVar(), cgiOptionalDouble(), cgiVarExclude(), gfWebFindServer(), and webBlat().
00711 { 00712 initCgiInput(); 00713 return hashLookup(inputHash, varName) != NULL; 00714 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct cgiVar* cgiVarList | ( | ) | [read] |
Definition at line 459 of file cheapcgi.c.
References initCgiInput(), and inputList.
00461 { 00462 initCgiInput(); 00463 return inputList; 00464 }
Here is the call graph for this function:

| void cgiVarSet | ( | char * | varName, | |
| char * | val | |||
| ) |
Definition at line 1116 of file cheapcgi.c.
References AllocVar, cloneString(), hashAddSaveName(), initCgiInput(), inputHash, cgiVar::name, and cgiVar::val.
01118 { 01119 struct cgiVar *var; 01120 initCgiInput(); 01121 AllocVar(var); 01122 var->val = cloneString(val); 01123 hashAddSaveName(inputHash, varName, var, &var->name); 01124 }
Here is the call graph for this function:

| void dumpCookieList | ( | ) |
Definition at line 30 of file cheapcgi.c.
References cookieList, cgiVar::name, cgiVar::next, cgiVar::saved, and cgiVar::val.
00032 { 00033 struct cgiVar *v; 00034 for (v=cookieList; v != NULL; v = v->next) 00035 printf("%s=%s (%d)\n", v->name, v->val, v->saved); 00036 }
| char* findCookieData | ( | char * | varName | ) |
Definition at line 308 of file cheapcgi.c.
References cookieHash, cookieList, hashFindVal(), parseCookies(), and cgiVar::val.
00310 { 00311 struct cgiVar *var; 00312 00313 /* make sure that the cookie hash table has been created */ 00314 parseCookies(&cookieHash, &cookieList); 00315 if (cookieHash == NULL) 00316 return NULL; 00317 if ((var = hashFindVal(cookieHash, varName)) == NULL) 00318 return NULL; 00319 return var->val; 00320 }
Here is the call graph for this function:

| void useTempFile | ( | ) |
Definition at line 38 of file cheapcgi.c.
References doUseTempFile, and TRUE.
00040 { 00041 doUseTempFile = TRUE; 00042 }
1.5.2