]> git.saurik.com Git - apple/boot.git/blobdiff - i386/libsaio/console.c
boot-132.tar.gz
[apple/boot.git] / i386 / libsaio / console.c
index 1b1103c26603a0134e939cd744a8ef315c33b519..d6bdfacce1a8c07f558ca8968d66c3a4adc4ddd9 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
+ * Portions Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights
  * Reserved.  This file contains Original Code and/or Modifications of
  * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.1 (the "License").  You may not use this file
+ * Source License Version 2.0 (the "License").  You may not use this file
  * except in compliance with the License.  Please obtain a copy of the
  * License at http://www.apple.com/publicsource and read it before using
  * this file.
  */
 
 #include "libsaio.h"
+#include "bootstruct.h"
 
-BOOL verbose_mode;
-BOOL errors;
+BOOL gVerboseMode;
+BOOL gErrors;
 
 /*
  * write one character to console
@@ -95,6 +96,7 @@ int getchar()
 int printf(const char * fmt, ...)
 {
     va_list ap;
+    if (bootArgs->Video.v_display != VGA_TEXT_MODE) return -1;
     va_start(ap, fmt);
     prf(fmt, ap, putchar, 0);
     va_end(ap);
@@ -105,7 +107,7 @@ int verbose(const char * fmt, ...)
 {
     va_list ap;
     
-    if (verbose_mode)
+    if (gVerboseMode)
     {
         va_start(ap, fmt);
         prf(fmt, ap, putchar, 0);
@@ -117,9 +119,21 @@ int verbose(const char * fmt, ...)
 int error(const char * fmt, ...)
 {
     va_list ap;
-    errors = YES;
+    gErrors = YES;
     va_start(ap, fmt);
     prf(fmt, ap, putchar, 0);
     va_end(ap);
     return(0);
 }
+
+void stop(const char * fmt, ...)
+{
+    va_list ap;
+
+    printf("\n");
+    va_start(ap, fmt);
+    prf(fmt, ap, putchar, 0);
+    va_end(ap);
+    printf("\n");
+    halt();
+}