diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-16 00:09:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-16 00:09:26 +0000 |
commit | 6c0eafbb1395d426a72a74538e0b2a95e8344ca6 (patch) | |
tree | 2a5f80b80fc76086a2602b812c2a182d00f961b7 /Build/source/libs/libgnuw32/system_popen_check.c | |
parent | 70f7efeb5c9965a63a4143ad1c1f473585dc364c (diff) |
libs 1
git-svn-id: svn://tug.org/texlive/trunk@1483 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/libgnuw32/system_popen_check.c')
-rw-r--r-- | Build/source/libs/libgnuw32/system_popen_check.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Build/source/libs/libgnuw32/system_popen_check.c b/Build/source/libs/libgnuw32/system_popen_check.c new file mode 100644 index 00000000000..f8fbe62dc5f --- /dev/null +++ b/Build/source/libs/libgnuw32/system_popen_check.c @@ -0,0 +1,27 @@ +#include "win32lib.h" + +main(int argc, char *argv[]) +{ + int ret; + FILE *f; + int c; + + if (argc != 3) { + exit(1); + } + if (strncmp(argv[1], "syst", 4) == 0) { + printf("Running cmd `%s'\n", argv[2]); + ret = system(argv[2]); + printf("return code = %d\n"); + } + else if (strncmp(argv[1], "popr", 4) == 0) { + f = popen(argv[2], "r"); + while ((c = fgetc(f)) != EOF) fputc(c, stdout); + pclose(f); + } + else if (strncmp(argv[1], "popw", 4) == 0) { + f = popen(argv[2], "w"); + while ((c = fgetc(stdin)) != EOF) fputc(c, f); + pclose(f); + } +} |