From 6c0eafbb1395d426a72a74538e0b2a95e8344ca6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 16 Jan 2006 00:09:26 +0000 Subject: libs 1 git-svn-id: svn://tug.org/texlive/trunk@1483 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/libgnuw32/system_popen_check.c | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Build/source/libs/libgnuw32/system_popen_check.c (limited to 'Build/source/libs/libgnuw32/system_popen_check.c') 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); + } +} -- cgit v1.2.3