#include #include #include #include #define ALLOC_BLOCK_SIZE 50000 #if 0 extern void print_recipe(char *string); #endif extern void print_recipe(); void main(int argc, char *argv[]) { FILE *fs; char *szBuff = (char *) malloc(ALLOC_BLOCK_SIZE), c; int i=0, cBlocks=1; if (argc <= 1) fs=stdin; else fs = fopen(argv[1], "r"); assert(fs); #if 0 /* Takes input from stdin and prints a recipe using it as a random seed. */ while((c=fgetc(fs)) != EOF) { szBuff[i++] = c; if ((i % ALLOC_BLOCK_SIZE) == 0) { szBuff = (char *) realloc(szBuff, ALLOC_BLOCK_SIZE*(++cBlocks)); assert(szBuff); } } szBuff[i] = '\0'; print_recipe(szBuff); #endif print_recipe(); }