Skip to content

Commit

Permalink
Added some new features and other small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskorpe committed Jun 22, 2010
1 parent bc1bd9d commit f051358
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions brainfuck_cgi.c
Expand Up @@ -114,8 +114,6 @@ header (char *title)

if (title)
printf ("</head><body><p>Interpreting file: /%s</p>", title);
else
printf ("</head><body><p>No file to interpret</p>");
}


Expand Down Expand Up @@ -237,6 +235,8 @@ main (void)
char *filename;
char *get = getenv ("QUERY_STRING");

char byte;

if (!*get)
{
header (NULL);
Expand Down Expand Up @@ -277,10 +277,19 @@ main (void)

i = 0;

printf ("<pre>\n\n");
printf ("Output:<pre>\n\n");
interpret (0);

printf ("\n\n</pre><hr /><p><a href=\"/%s\">Source code</a></p>", filename+3);
printf ("\n\n</pre><hr /><p><a href=\"/%s\">Source code</a>:</p>", filename+3);


lseek (file, 0, SEEK_SET);

printf ("<pre>");
while (read (file, &byte, 1))
fwrite (&byte, 1, 1, stdout);

printf ("</pre>");

footer (EXIT_SUCCESS);

Expand Down

0 comments on commit f051358

Please sign in to comment.