/* * File Name: iframe_env.c * Workflow: fullfill HTML iframe * Return Value: 0 always */ /* Header files */ #include #include #include #include #include #include "cgic.h" #include "proto.h" /* cgiMain, main in cgic.h */ int cgiMain() { key_t shm_key; int shm_id; SHM_STRUCT *p_shm_struct; shm_key = ftok("/usr/bin/boa", 'm'); shm_id = shmget(shm_key, sizeof(SHM_STRUCT), 0600); p_shm_struct = shmat(shm_id, NULL, 0); cgiHeaderContentType("text/html"); fprintf(cgiOut, "\n"); fprintf(cgiOut, "\n"); fprintf(cgiOut, "\n"); fprintf(cgiOut, "

Temperature:\t%d

\n", p_shm_struct->tempNow); fprintf(cgiOut, "

Humidity:\t%d

\n", p_shm_struct->humiNow); fprintf(cgiOut, "\n"); return 0; }