char *_hscan(int client, const char *reqStr, const char *msg, const char *inputstr) { char *qpath = getQueryPath(reqStr); char *qparam = getQueryParam(reqStr, "q"); FDPRINTF(client, OTAGA(form, action = "%s") "%s%s" STAG(input, type = "submit") CTAG(form), qpath, msg, inputstr); free(qpath); return qparam; }
char *_hscanIfEmpty(int client, const char *reqStr, const char *msg, const char *inputstr) { char *qpath = getQueryPath(reqStr); char *qparam = getQueryParam(reqStr, "q"); if (strcmp(qparam, UNDEFINED) == 0) { FDPRINTF(client, OTAGA(form, action = "%s") "%s%s" STAG(input, type = "submit") CTAG(form), qpath, msg, inputstr); } free(qpath); return qparam; }
static void form(Request *request, Response *response) { char *nStr = QUICK_FORM_TEXT(request, response, "longurl"); char shortUrl[6]; if (nStr != NULL) { shorten(nStr, shortUrl); resPrintf(response, "Here's the short url of %s: ", nStr); resPrintf(response, STAG(input, type="text" disabled="disabled" value="%s"), shortUrl); } }