On Mon, Oct 16, 2006 at 11:40:41AM +0200, Bernhard Fischer wrote:
Consider this invalid code:
$ cat no.c
int main(void) {}
$ tcc -o no no.c && ./no ; echo $? ; ./no ; echo $?
228
212
and a half now, so the -run mode is a viable scripting language.
For scripting mode it would be handy to be able to compile from stdin,
btw. Something like this, but perhaps without using /dev/stdin but 0
would seem to be appropriate.
$ echo -e "#include <stdio.h>\nint main(void) {printf(\"%s\", \"Hello,
world.\\\n\");return 0;}" | tcc -o no - && ./no
Hello, world.
diff -u ../tinycc.stdin.oorig/tcc.c ./tcc.c
--- ../tinycc.stdin.oorig/tcc.c 2005-09-04 00:51:34.000000000 +0200
+++ ./tcc.c 2006-10-16 12:50:07.000000000 +0200
@@ -10427,7 +10427,10 @@
break;
}
r = argv[optind++];
- if (r[0] != '-') {
+ if (r[0] == '-' && r[1] == '\0') {
+ /* add stdin */
+ dynarray_add((void ***)&files, &nb_files, "/dev/stdin");
+ } else if (r[0] != '-') {
/* add a new file */
dynarray_add((void ***)&files, &nb_files, r);
if (!multiple_files) {
Sounds useful?
_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel