]> granicus.if.org Git - nethack/commitdiff
win32gui: make error() work
authornethack.allison <nethack.allison>
Sat, 23 Mar 2002 22:47:44 +0000 (22:47 +0000)
committernethack.allison <nethack.allison>
Sat, 23 Mar 2002 22:47:44 +0000 (22:47 +0000)
- in 3.4.0 it was useless in the graphical port.

doc/fixes34.1
sys/share/pcunix.c
sys/winnt/winnt.c

index d6ab81e05651e02e11ea58fecb821a00d5935dd4..3414b345337ac9493bf41a4b13ee7265a79ff021 100644 (file)
@@ -19,4 +19,5 @@ wall symbol not replaced when digging while blind and levitating
 Platform- and/or Interface-Specific Fixes
 -----------------------------------------
 
+win32gui: make error() work; it was essentially non-operative in 3.4.0
 win32tty: honour the use_inverse option and default to ATR_BOLD if disabled
index 0064e3390b568ab9b8cf16616b273eb892984a34..2ec56227a8781cf7540266ee9d41e4ae7f682bb3 100644 (file)
@@ -117,7 +117,12 @@ getlock()
        if((fd = open(fq_lock,0)) == -1) {
                if(errno == ENOENT) goto gotlock;    /* no such file */
                chdirx(orgdir, 0);
+#if defined(WIN32)
+               error("Bad directory or name: %s\n%s\n",
+                               fq_lock, strerror(errno));
+#else
                perror(fq_lock);
+#endif
                unlock_file(HLOCK); 
                error("Cannot open %s", fq_lock);
        }
index 5c7ebb5ee429e87d95c51f9674f32c51e6b6ba3d..8af3c4573a0f69adaadf4323a147b706cc37bb75 100644 (file)
@@ -209,9 +209,16 @@ error VA_DECL(const char *,s)
        VA_INIT(s, const char *);
        /* error() may get called before tty is initialized */
        if (iflags.window_inited) end_screen();
-       putchar('\n');
-       Vprintf(s,VA_ARGS);
-       putchar('\n');
+       if (!strncmpi(windowprocs.name, "tty", 3)) {
+               putchar('\n');
+               Vprintf(s,VA_ARGS);
+               putchar('\n');
+       } else {
+               char buf[BUFSZ];
+               (void) vsprintf(buf, s, VA_ARGS);
+               Strcat(buf, "\n");
+               raw_printf(buf);
+       }
        VA_END();
        exit(EXIT_FAILURE);
 }