diff options
author | marcus <marcus> | 2003-09-07 22:13:04 +0000 |
---|---|---|
committer | marcus <marcus> | 2003-09-07 22:13:04 +0000 |
commit | 3e7717ecf8c191a5e3c2fd865df18a20a407dfdd (patch) | |
tree | 8d34cff9d12a5022825f1acde56f06be260d854f | |
parent | 103f3951ba2e4ae7c1c39ad9c7d71a1df23586c9 (diff) |
Small cleanups.
-rw-r--r-- | laden/ia32-output.c | 7 | ||||
-rw-r--r-- | laden/ia32-shutdown.c | 4 | ||||
-rw-r--r-- | laden/laden.c | 4 | ||||
-rw-r--r-- | laden/output-none.c | 6 | ||||
-rw-r--r-- | laden/output-vga.c | 6 | ||||
-rw-r--r-- | laden/output.c | 15 | ||||
-rw-r--r-- | laden/output.h | 11 | ||||
-rw-r--r-- | laden/shutdown.h | 7 | ||||
-rw-r--r-- | laden/string.c | 7 | ||||
-rw-r--r-- | laden/string.h | 6 |
10 files changed, 61 insertions, 12 deletions
diff --git a/laden/ia32-output.c b/laden/ia32-output.c index ff9aca9..88c45cc 100644 --- a/laden/ia32-output.c +++ b/laden/ia32-output.c @@ -18,8 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -#include "laden.h" +#if HAVE_CONFIG_H +#include <config.h> +#endif +#include "output.h" + + extern struct output_driver vga_output; extern struct output_driver no_output; diff --git a/laden/ia32-shutdown.c b/laden/ia32-shutdown.c index 2aa0d4c..f467fb1 100644 --- a/laden/ia32-shutdown.c +++ b/laden/ia32-shutdown.c @@ -18,6 +18,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +#include <config.h> +#endif + #include <sys/io.h> #include "shutdown.h" diff --git a/laden/laden.c b/laden/laden.c index 9745a0b..9e2f371 100644 --- a/laden/laden.c +++ b/laden/laden.c @@ -99,7 +99,9 @@ parse_args (int argc, char *argv[]) else if (!strcmp (argv[i], "-o") || !strcmp (argv[i], "--output")) { i++; - output_init (argv[i++]); + if (!output_init (argv[i])) + panic ("Unknown output driver %s", argv[i]); + i++; } else if (!strcmp (argv[i], "-h") || !strcmp (argv[i], "--halt")) { diff --git a/laden/output-none.c b/laden/output-none.c index 67ab686..d5ca80f 100644 --- a/laden/output-none.c +++ b/laden/output-none.c @@ -18,7 +18,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -#include "laden.h" +#if HAVE_CONFIG_H +#include <config.h> +#endif + +#include "output.h" struct output_driver no_output = { diff --git a/laden/output-vga.c b/laden/output-vga.c index b6ed064..82234e5 100644 --- a/laden/output-vga.c +++ b/laden/output-vga.c @@ -18,10 +18,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -#include "laden.h" +#if HAVE_CONFIG_H +#include <config.h> +#endif #include <sys/io.h> +#include "output.h" + #define VGA_VIDEO_MEM_BASE_ADDR 0x0B8000 #define VGA_VIDEO_MEM_LENGTH 0x004000 diff --git a/laden/output.c b/laden/output.c index e3c30ea..61d7c9f 100644 --- a/laden/output.c +++ b/laden/output.c @@ -18,9 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdarg.h> -#include "laden.h" +#include "output.h" /* The active output driver. */ @@ -29,8 +33,9 @@ static struct output_driver *output; /* Activate the output driver NAME or the default one if NAME is a null pointer. Must be called once at startup, before calling - putchar or any other output routine. */ -void + putchar or any other output routine. Returns 0 if NAME is not a + valid output driver name, otherwise 1 on success. */ +int output_init (char *name) { if (output) @@ -49,13 +54,15 @@ output_init (char *name) out++; } if (!output) - panic ("Unknown output driver %s", name); + return 0; } else output = output_drivers[0]; if (output->init) (*output->init) (); + + return 1; } diff --git a/laden/output.h b/laden/output.h index 57c8014..c520ba3 100644 --- a/laden/output.h +++ b/laden/output.h @@ -18,6 +18,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#ifndef _OUTPUT_H +#define _OUTPUT_H 1 + /* Every architecture must define at least one output driver, but might define several. For each output driver, the name and operations on @@ -46,9 +49,9 @@ extern struct output_driver *output_drivers[]; /* Activate the output driver NAME or the default one if NAME is a null pointer. Must be called once at startup, before calling - putchar or any other output routine. Otherwise the default output - driver will be used. */ -void output_init (char *name); + putchar or any other output routine. Returns 0 if NAME is not a + valid output driver name, otherwise 1 on success. */ +int output_init (char *name); /* Deactivate the output driver. Must be called after the last time putchar or any other output routine is called. */ @@ -58,3 +61,5 @@ void output_deinit (void); void putchar (int chr); void printf (const char *fmt, ...); + +#endif /* _OUTPUT_H */ diff --git a/laden/shutdown.h b/laden/shutdown.h index cc11a6d..80dc90e 100644 --- a/laden/shutdown.h +++ b/laden/shutdown.h @@ -18,6 +18,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#ifndef _SHUTDOWN_H +#define _SHUTDOWN_H 1 + +#include "output.h" + /* Every architecture must provide the following functions. */ @@ -36,3 +41,5 @@ extern int shutdown_reset; /* End the program with a failure. This can halt or reset the system. */ void shutdown (void); + +#endif /* _SHUTDOWN_H */ diff --git a/laden/string.c b/laden/string.c index aafc8bc..5ebe928 100644 --- a/laden/string.c +++ b/laden/string.c @@ -18,6 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +#include <config.h> +#endif + +#include "string.h" + + int strcmp (const char *s1, const char *s2) { diff --git a/laden/string.h b/laden/string.h index 8ccef38..e9eb8c9 100644 --- a/laden/string.h +++ b/laden/string.h @@ -18,9 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - +#ifndef _STRING_H +#define _STRING_H 1 + int strcmp (const char *s1, const char *s2); void *memcpy (void *dest, const void *src, int n); void *memset (void *s, int c, int n); + +#endif /* _STRING_H */ |