From 621608a383f5173ca467f0239df911af2e7eb256 Mon Sep 17 00:00:00 2001 From: yokota Date: Tue, 24 Jun 1997 12:43:18 +0000 Subject: 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 . --- sys/modules/syscons/daemon/Makefile | 8 +++++++- sys/modules/syscons/daemon/daemon_saver.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) (limited to 'sys/modules') diff --git a/sys/modules/syscons/daemon/Makefile b/sys/modules/syscons/daemon/Makefile index 57526c0..3c5a320 100644 --- a/sys/modules/syscons/daemon/Makefile +++ b/sys/modules/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 diff --git a/sys/modules/syscons/daemon/daemon_saver.c b/sys/modules/syscons/daemon/daemon_saver.c index 921044c..232f416 100644 --- a/sys/modules/syscons/daemon/daemon_saver.c +++ b/sys/modules/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 @@ -35,6 +35,9 @@ #include #include #include +#include +#include +#include #include @@ -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; } -- cgit v1.1