This is a very simple HTTP server for Unix, using fork(). It's very easy to use
- include header 
httpd.h - write your route method, handling requests.
 - call 
serve_forever("12913")to start serving on port 12913 
| int main (){ | |
| //This is a test. | |
| return (int) 0; | |
| }; | 
| #include <stdio.h> | |
| int check( int num ){ | |
| return (int) ( num == 0 ? num : ( num > 0 ? 1 : -1 ) ); | |
| //return (num > 0) - (num < 0); | |
| }; | |
| int main (){ | |
| // gist para a rotina de mouse. | |
| // | |
| // ************* C ********************* | |
| // | |
| //======================================================= | |
| //++ Usadas pelo mouse. | |
| // hardwarelib.inc | 
| unsigned long | |
| virtual_to_physical( unsigned long virtual_address, | |
| unsigned long dir_address ) | |
| { | |
| unsigned long address; | |
| unsigned long *dir = (unsigned long *) dir_address; | |
| unsigned long tmp; | 
| void *CreatePageDirectory (){ | |
| int i; | |
| unsigned long destAddressVA; //virtual. | |
| //alocaremos uma página apenas, pois tem 4KB. | |
| destAddressVA = (unsigned long) newPage (); | |
| if ( destAddressVA == 0 ) | 
| void | |
| refresh_rectangle ( unsigned long x, | |
| unsigned long y, | |
| unsigned long width, | |
| unsigned long height ) | |
| { | |
| void *p = (void *) FRONTBUFFER_ADDRESS; | |
| const void *q = (const void*) BACKBUFFER_ADDRESS; | |
| //#TEST | 
| // Credits: | |
| // Omar Mohammad. Maadi, Cairo, Egypt. (Original in Assembly) | |
| // Wagner Teixeira | |
| // Fred Nora | |
| //================================================================================== | |
| // Start - testing update_mouse | |
| //================================================================================== | |
| #define MOUSE_LEFT_BTN 0x01 | 
| // Exemplo de geração de números aleatórios | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| /* | |
| A função gerar_numero() retorna um número aleatório | |
| que pertence ao intervalo [lim_inf, lim_sup] | |
| /* | |
| Packet sniffer using libpcap library | |
| */ | |
| #include<pcap.h> | |
| #include<stdio.h> | |
| #include<stdlib.h> // for exit() | |
| #include<string.h> //for memset | |
| #include<sys/socket.h> | |
| #include<arpa/inet.h> // for inet_ntoa() |