kristapsdz / kcgi

minimal CGI and FastCGI library for C/C++
https://kristaps.bsd.lv/kcgi
ISC License
278 stars 40 forks source link

What does the integer input in sample.c ? #80

Closed echkourine25 closed 4 years ago

echkourine25 commented 4 years ago

I enter a number and send form but it does nothing. I do not understand these lines in sendindex() of sample.c cp = NULL == req->fieldmap[KEY_INTEGER] ? "" : req->fieldmap[KEY_INTEGER]->val; kasprintf(&page, "%s/%s", req->pname, pages[PAGE_INDEX]);

kristapsdz commented 4 years ago

The first assigns the value of KEY_INTEGER ("integer") to cp or the empty string if no value is given. The second formats the CGI script name and the index page as a path.