// ============================================================================================== // C servlet sample // ---------------------------------------------------------------------------------------------- // captcha.c: how to use small portable CAPTCHA images generator library without dependencies // ============================================================================================== #include #include #pragma link "libcaptcha.o" extern void captcha(unsigned char* im, unsigned char* l); extern void makegif(unsigned char* im, unsigned char* gif); #define GIF_SIZE 17646 int main(int argc, char* argv[]) { unsigned char l[6]; unsigned char im[70*200]; unsigned char gif[GIF_SIZE]; unsigned char encoded[GIF_SIZE * 3]; captcha(im, l); makegif(im, gif); set_reply_capacity(1024 + GIF_SIZE * 3); (void) u__snprintf(get_reply(), get_reply_capacity(), "", u_base64_encode(gif, GIF_SIZE, encoded), encoded); return 200; } // ============================================================================ // End of Source Code // ============================================================================