mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-10-05 19:18:01 +08:00
25 lines
840 B
C
25 lines
840 B
C
// ============================================================================
|
|
// C servlet sample
|
|
// ----------------------------------------------------------------------------
|
|
// hellox.c: how to get URL parameters and use them in a reply
|
|
// ============================================================================
|
|
|
|
#include <ulib/internal/csp_interface.h>
|
|
#include <ulib/base/coder/xml.h>
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
unsigned char encoded[1024];
|
|
|
|
char* reply = get_reply();
|
|
|
|
(void) u_xml_encode(argv[1], strlen(argv[1]), encoded);
|
|
|
|
(void) u__snprintf(reply, get_reply_capacity(), "<h1>Hello %s</h1>", encoded);
|
|
|
|
return 200;
|
|
}
|
|
// ============================================================================
|
|
// End of Source Code
|
|
// ============================================================================
|