enclose code and testfile.
kline at thought.org
Sun Jun 7 01:22:06 UTC 2009
I'm encloseing a brief C program that skips over php delimiters and a
74-byte test file. After gdb "reminded" me that it eats the last byte,
I was able to complete this. Am wondering if there is a better way.
Obv'ly there are other way to get past "<?" and "?>"; but this was
main(int argc, char *argv) // use: ./a.out testfile
if ((fp = fopen(*argv, "r")) ==NULL)
printf("[%s] not found\n", *argv);
* read past any php <? and ?>
foo (FILE *fp)
int ch, ch2, ch3, ch4;
while (( ch = getc(fp)) != EOF)
if (ch == '<' && (ch3 = getc(fp)) == '?')
while ((ch2 = getc(fp)) != '?')
if (ch2 == '?' && (ch4 = getc(fp)) == '>')
// the testfile:
end of html src file HERE.
Gary Kline kline at thought.org http://www.thought.org Public Service Unix
For FBSD list: http://transfinite.thought.org/slicejourney.php
More information about the freebsd-questions