diff -urp texinfo-5.2/gnulib/lib/stat.c texinfo-5.2j/gnulib/lib/stat.c --- texinfo-5.2/gnulib/lib/stat.c 2013-02-20 08:25:29 +1000 +++ texinfo-5.2j/gnulib/lib/stat.c 2014-11-05 23:30:55 +1000 @@ -28,6 +28,8 @@ #undef __need_system_sys_stat_h #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN +# include # if _GL_WINDOWS_64_BIT_ST_SIZE # undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ # define stat _stati64 @@ -134,5 +136,32 @@ rpl_stat (char const *name, struct stat } } #endif /* REPLACE_FUNC_STAT_DIR */ +#ifdef WIN32_LEAN_AND_MEAN + if (result == 0) + { + /* Under Windows, st_dev (32 bits) is the drive number & st_ino (16 bits) + is always 0. The handle file information contains a 32-bit volume + serial number (i.e. a device id) with a 64-bit file index (unique file + id). Since the two st values are always tested together, put the + lower 16 bits of the serial into st_ino and combine the index values + into st_dev (brief testing shows the low word of the high index and + the high three digits of the low index are likely 0). */ + BY_HANDLE_FILE_INFORMATION fi; + HANDLE h = CreateFile (name, 0, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (h != INVALID_HANDLE_VALUE) + { + if (GetFileInformationByHandle (h, &fi)) + { + st->st_ino = LOWORD (fi.dwVolumeSerialNumber); + st->st_dev = (HIWORD (fi.nFileIndexHigh) << 24) + | (fi.nFileIndexLow & 0xFFFFFF); + } + CloseHandle (h); + } + } +#endif return result; } diff -urp texinfo-5.2/info/pcterm.c texinfo-5.2j/info/pcterm.c --- texinfo-5.2/info/pcterm.c 2013-08-23 03:54:06 +1000 +++ texinfo-5.2j/info/pcterm.c 2014-11-07 11:57:35 +1000 @@ -39,6 +39,7 @@ #include #include #include +#define WIN32_LEAN_AND_MEAN #include struct text_info { @@ -249,11 +250,20 @@ ScreenVisualBell (void) DWORD nchars = screenwidth * screenheight; COORD start_pos; DWORD written; + PWORD attr; + DWORD i; start_pos.X = start_pos.Y = 0; - FillConsoleOutputAttribute (hscreen, inv_attr, nchars, start_pos, &written); - Sleep (20); - FillConsoleOutputAttribute (hscreen, norm_attr, nchars, start_pos, &written); + attr = xmalloc (nchars * sizeof (WORD)); + ReadConsoleOutputAttribute (hscreen, attr, nchars, start_pos, &written); + for (i = 0; i < nchars; ++i) + attr[i] ^= norm_attr ^ inv_attr; + WriteConsoleOutputAttribute (hscreen, attr, nchars, start_pos, &written); + Sleep (50); + for (i = 0; i < nchars; ++i) + attr[i] ^= norm_attr ^ inv_attr; + WriteConsoleOutputAttribute (hscreen, attr, nchars, start_pos, &written); + free (attr); } int @@ -670,7 +680,23 @@ pc_put_text (string) if (speech_friendly) fputs (string, stdout); else +#ifdef _WIN32 + { + DWORD dummy; + WCHAR ws[256]; + /* Newer files use UTF-8, older Latin1 (probably). */ + int len = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, string, -1, + ws, 256); + if (len == 0) + len = MultiByteToWideChar (1252, 0, string, -1, ws, 256); + if (len == 0) + WriteConsoleA (hscreen, string, strlen (string), &dummy, NULL); + else + WriteConsoleW (hscreen, ws, len - 1, &dummy, NULL); + } +#else cputs (string); +#endif } /* Ring the terminal bell. The bell is rung visibly if the terminal is @@ -699,7 +725,7 @@ pc_write_chars (string, nchars) if (speech_friendly) printf ("%.*s",nchars, string); else - cprintf ("%..*s",nchars, string); + cprintf ("%.*s",nchars, string); } /* Scroll an area of the terminal from START to (and excluding) END,