Date: Sun, 21 May 1995 09:18:21 +0200 From: "Philippe Charnier" <charnier@lirmm.fr> To: current@FreeBSD.org Subject: small improvment for snake saver Message-ID: <199505210718.JAA06807@lirmm.lirmm.fr>
next in thread | raw e-mail | index | archive | help
Hello, snake saver now looks for `ostype' and `osrelease' and display these information. Index: snake_saver.c =================================================================== RCS file: /home2h/FreeBSD.cvsroot/src/lkm/syscons/snake/snake_saver.c,v retrieving revision 1.3 diff -u -r1.3 snake_saver.c --- 1.3 1995/05/16 19:10:11 +++ snake_saver.c 1995/05/20 19:31:07 @@ -36,6 +36,9 @@ #include <sys/lkm.h> #include <sys/errno.h> #include <saver.h> +#include <sys/proc.h> +#include <vm/vm.h> +#include <sys/sysctl.h> MOD_MISC("snake_saver") @@ -45,11 +48,30 @@ static void snake_saver(int blank) { - const char saves[] = {"FreeBSD-2.0.5"}; + static char saves[] = "???????????????????????????????????????????????"; static u_char *savs[sizeof(saves)-1]; static int dirx, diry; int f; scr_stat *scp = cur_console; + static size_t len = sizeof(saves)-1; + + if (*saves == '?') { + size_t idx; + + if ((idx = strlen(ostype)) < sizeof(saves)) { + /* enough space for ostype */ + strcpy (saves, ostype); + if ((len = strlen(osrelease)) < sizeof(saves)-1 - idx) { + /* enough space left for osrelease and a separator */ + saves[idx++] = ' '; + strcpy (&saves[idx], osrelease); + idx += len; + } + } + else + idx = sizeof(saves)-1; + len = idx; + } if (blank) { if (!scrn_blanked) { @@ -59,7 +81,7 @@ dirx = (scp->xpos ? 1 : -1); diry = (scp->ypos ? scp->xsize : -scp->xsize); - for (f=0; f< sizeof(saves)-1; f++) + for (f = 0; f < len; f++) savs[f] = (u_char *)Crtat + 2 * (scp->xpos+scp->ypos*scp->xsize); *(savs[0]) = scr_map[*saves]; @@ -73,8 +95,8 @@ if (scrn_blanked++ < 4) return; scrn_blanked = 1; - *(savs[sizeof(saves)-2]) = scr_map[0x20]; - for (f=sizeof(saves)-2; f > 0; f--) + *(savs[len - 1]) = scr_map[0x20]; + for (f = len - 1; f > 0; f--) savs[f] = savs[f-1]; f = (savs[0] - (u_char *)Crtat) / 2; if ((f % scp->xsize) == 0 || @@ -86,7 +108,7 @@ (random() % 20) == 0) diry = -diry; savs[0] += 2*dirx + 2*diry; - for (f=sizeof(saves)-2; f>=0; f--) + for (f = len - 1; f >= 0; f--) *(savs[f]) = scr_map[saves[f]]; } else { -------- -------- Philippe Charnier charnier@lirmm.fr LIRMM, 161 rue Ada, 34392 Montpellier cedex 5 -- France ------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505210718.JAA06807>