#include "post.h" #include "cgi.h" #include "ieee.h" /* Creates a table listing shirt inventory * (mess) created by * - Charles Shiflett */ int main() { int st,ss,sc,edit,total; char exec_buffer[1024]; edit=(int)get_data("edit"); /* Checks for existance of edit variable */ sc=0; printf("\n\n"); if (edit) printf("
\n\n"); printf( ""); printf("
  "); while(*shirt_color[sc]) printf(" %s ",shirt_color[sc++]); /* format is TYPE_SIZE_COLOR */ st=0; while (*shirt_type[st++]) { printf("\n
%s
%s \n", shirt_type[st-1],shirt_type_price[st-1]); ss=0; while (*shirt_size[ss]) { printf("
%s",shirt_size[ss++]); sc=0; while (*shirt_color[sc++]) { if (!(sc&1)) printf(""); else printf(""); sprintf(exec_buffer, "select stock from inventory where size='%s' and color='%s' and type='%s'" , shirt_size[ss-1], shirt_color[sc-1], shirt_type[st-1]); total=find_total(exec_buffer); /* The two display modes, normal and edit. ****/ if (edit) { printf("", shirt_type[st-1], shirt_size[ss-1], shirt_color[sc-1],total); printf("", shirt_type[st-1], shirt_size[ss-1], shirt_color[sc-1],total); } else printf("%d", shirt_type[st-1], shirt_size[ss-1], shirt_color[sc-1],total); } printf("\n"); } } printf("


\n"); if (!edit) printf("

Edit

\n\n\n"); else printf("

\n\n\n"); printf("\n\n\n"); return(0); }