From: Michihiro NAKAJIMA Date: Mon, 20 Feb 2012 06:31:20 +0000 (+0900) Subject: Correct console I/O on Windows. Use CONIN$ and CONOUT$ instead of /dev/tty. X-Git-Tag: v3.0.4~2^2~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6467e840cafb2e1f1b8f84dbc93cda4b0b6079d2;p=thirdparty%2Flibarchive.git Correct console I/O on Windows. Use CONIN$ and CONOUT$ instead of /dev/tty. --- diff --git a/cpio/cpio.c b/cpio/cpio.c index 717476e23..57f4e260d 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -1152,12 +1152,24 @@ cpio_rename(const char *name) static char buff[1024]; FILE *t; char *p, *ret; +#if defined(_WIN32) && !defined(__CYGWIN__) + FILE *to; + t = fopen("CONIN$", "r"); + if (t == NULL) + return (name); + to = fopen("CONOUT$", "w"); + if (to == NULL) + return (name); + fprintf(to, "%s (Enter/./(new name))? ", name); + fclose(to); +#else t = fopen("/dev/tty", "r+"); if (t == NULL) return (name); fprintf(t, "%s (Enter/./(new name))? ", name); fflush(t); +#endif p = fgets(buff, sizeof(buff), t); fclose(t);