about summary refs log tree commit diff
path: root/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-08-17 02:53:23 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-08-17 02:53:23 +0000
commit2bfd22562dfc209298d548f757f0fa4906d17f70 (patch)
tree8f87d15b3cd6f48ba0ecc739ca3a0e5846e49fad /other
parentc550680685117cf8bbcd6e7bf33d6056dbff4aa5 (diff)
downloadnetpbm-mirror-2bfd22562dfc209298d548f757f0fa4906d17f70.tar.gz
netpbm-mirror-2bfd22562dfc209298d548f757f0fa4906d17f70.tar.xz
netpbm-mirror-2bfd22562dfc209298d548f757f0fa4906d17f70.zip
Wait to initialize Svgalib to keep console usable longer
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@970 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other')
-rw-r--r--other/ppmsvgalib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/other/ppmsvgalib.c b/other/ppmsvgalib.c
index 5bcabdc1..8598cef2 100644
--- a/other/ppmsvgalib.c
+++ b/other/ppmsvgalib.c
@@ -253,10 +253,6 @@ main(int argc, char *argv[]) {
 
     ppm_init(&argc, argv);
 
-    rc = vga_init();         /* Initialize. */
-    if (rc < 0)
-        pm_error("Svgalib unable to allocate a virtual console.");
-
     parseCommandLine(argc, argv, &cmdline);
 
     ifP = pm_openr(cmdline.inputFilespec);
@@ -269,6 +265,14 @@ main(int argc, char *argv[]) {
                   &checkResult);
     }
 
+    /* We wait to initialize Svgalib to prevent it from interfering with
+       error messages the code above might issue, and leaving the console
+       in an undesirable state if the above code aborts the program.
+    */
+    rc = vga_init();         /* Initialize. */
+    if (rc < 0)
+        pm_error("Svgalib unable to allocate a virtual console.");
+
     if (vga_hasmode(cmdline.mode))
         display(ifP, cols, rows, maxval, format, 
                 cmdline.mode, cmdline.verbose);