diff options
author | yokota <yokota@FreeBSD.org> | 1997-06-24 12:43:18 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 1997-06-24 12:43:18 +0000 |
commit | 621608a383f5173ca467f0239df911af2e7eb256 (patch) | |
tree | 4c7ee8795dd8ece064e48495d34de1ef7ce862e7 /lkm | |
parent | dc42cd84a9fff66c6289e7206acf13857fc0aff7 (diff) | |
download | FreeBSD-src-621608a383f5173ca467f0239df911af2e7eb256.zip FreeBSD-src-621608a383f5173ca467f0239df911af2e7eb256.tar.gz |
Take the OS release string from the kernel variable `osrelease'
rather than hard-code it in the message text. Optinally include
the host name in the message if SHOW_HOSTNAME is defined.
The origianl idea and sample code submitted by Angelo Turetta
<ATuretta@stylo.it>.
Diffstat (limited to 'lkm')
-rw-r--r-- | lkm/syscons/daemon/Makefile | 8 | ||||
-rw-r--r-- | lkm/syscons/daemon/daemon_saver.c | 31 |
2 files changed, 34 insertions, 5 deletions
diff --git a/lkm/syscons/daemon/Makefile b/lkm/syscons/daemon/Makefile index 57526c0..3c5a320 100644 --- a/lkm/syscons/daemon/Makefile +++ b/lkm/syscons/daemon/Makefile @@ -1,4 +1,4 @@ -# $Id$ +# $Id: Makefile,v 1.1 1997/05/21 14:18:26 yokota Exp $ KMOD= daemon_saver_mod SRCS= daemon_saver.c @@ -6,4 +6,10 @@ SRCS= daemon_saver.c NOMAN= CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys +# Omits the bouncing message text and shows only the daemon. +#CFLAGS+= -DDAEMON_ONLY + +# Includes the host name in the message text. +#CFLAGS+= -DSHOW_HOSTNAME + .include <bsd.kmod.mk> diff --git a/lkm/syscons/daemon/daemon_saver.c b/lkm/syscons/daemon/daemon_saver.c index 921044c..232f416 100644 --- a/lkm/syscons/daemon/daemon_saver.c +++ b/lkm/syscons/daemon/daemon_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: daemon_saver.c,v 1.2 1997/05/24 01:44:39 yokota Exp $ + * $Id: daemon_saver.c,v 1.4 1997/05/26 01:02:41 yokota Exp $ */ #include <sys/param.h> @@ -35,6 +35,9 @@ #include <sys/sysent.h> #include <sys/lkm.h> #include <sys/errno.h> +#include <sys/kernel.h> +#include <sys/sysctl.h> +#include <sys/malloc.h> #include <machine/md_var.h> @@ -150,6 +153,9 @@ draw_daemon(int xpos, int ypos, int dxdir) } #ifndef DAEMON_ONLY +static char *message; +static int messagelen; + static void draw_string(int xpos, int ypos, char *s, int len) { @@ -165,7 +171,6 @@ static void daemon_saver(int blank) { #ifndef DAEMON_ONLY - static const char message[] = {"FreeBSD 3.0 CURRENT"}; static int txpos = 10, typos = 10; static int txdir = -1, tydir = -1; #endif @@ -201,7 +206,7 @@ daemon_saver(int blank) #ifndef DAEMON_ONLY if (txdir > 0) { - if (txpos == scp->xsize - sizeof(message)-1) + if (txpos == scp->xsize - messagelen) txdir = -1; } else { if (txpos == 0) txdir = 1; @@ -217,7 +222,7 @@ daemon_saver(int blank) draw_daemon(dxpos, dypos, dxdir); #ifndef DAEMON_ONLY - draw_string(txpos, typos, (char *)message, sizeof(message)-1); + draw_string(txpos, typos, (char *)message, messagelen); #endif } else { if (scrn_blanked) { @@ -232,9 +237,25 @@ daemon_saver(int blank) static int daemon_saver_load(struct lkm_table *lkmtp, int cmd) { +#ifdef SHOW_HOSTNAME + static const char *freebsd = " - FreeBSD "; +#else + static const char *freebsd = "FreeBSD "; +#endif /* SHOW_HOSTNAME */ + (*current_saver)(0); old_saver = current_saver; current_saver = daemon_saver; + +#ifdef SHOW_HOSTNAME + messagelen = strlen(hostname) + strlen(freebsd) + strlen(osrelease); + message = malloc(messagelen + 1, M_DEVBUF, M_NOWAIT); + sprintf(message, "%s%s%s", hostname, freebsd, osrelease); +#else + messagelen = strlen(freebsd) + strlen(osrelease); + message = malloc(messagelen + 1, M_DEVBUF, M_NOWAIT); + sprintf(message, "%s%s", freebsd, osrelease); +#endif /* SHOW_HOSTNAME */ return 0; } @@ -243,6 +264,8 @@ daemon_saver_unload(struct lkm_table *lkmtp, int cmd) { (*current_saver)(0); current_saver = old_saver; + + free(message, M_DEVBUF); return 0; } |