Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jun 1999 17:25:42 -0400
From:      Lowell Gilbert <lowell@world.std.com>
To:        ChrisMic@clientlogic.com
Cc:        questions@FreeBSD.org
Subject:   Re: Cycling bootup splash screens? (trivial)
Message-ID:  <199906242125.AA20749@world.std.com>
In-Reply-To: <6C37EE640B78D2118D2F00A0C90FCB44011059E5@site2s1> (message from Christopher Michaels on Thu, 24 Jun 1999 16:49:29 -0400)
References:   <6C37EE640B78D2118D2F00A0C90FCB44011059E5@site2s1>

next in thread | previous in thread | raw e-mail | index | archive | help
   From: Christopher Michaels <ChrisMic@clientlogic.com>
   Date: Thu, 24 Jun 1999 16:49:29 -0400

   I was thinking the latter, of using a symlink to an image and just leaving
   /boot/loader.conf alone.

That seems easiest (and best) to me. 

   Unfortunately, i'm not versed enough to get started on that script.  I'll
   probably beat my head over it this weekend.  :^)

It'll be good practice.  

   You wouldn't happen to have any ideas on how I would go about randomly
   selecting a file in a directory would you?

Well, that is the hard part, isn't it?  Once you've got a filename in
a (shell script) variable, making a symbolic link to it in a specific
place is easy.

In my shell, bash, you have a variable that gives you random values,
indexable arrays, and arithmetic calculations.  That is enough to
randomly pick one of a set.  You can get the set from 'ls', and you
can get the number of items in the set from applying 'wc' to 'ls'.

As a C programmer, I only thought about the shell stuff for a few
seconds before realizing that a program to randomly pick one of its
parameters (and spit it back) is essentially a two-liner:
#include <stdlib.h>
int main(int argc, char *argv[])
{
   srandomdev();
   printf("%s",argv[random()%argc]);
}
which could make the shell script even easier.

Actually, I assumed that you'd want to cycle through the screens
rather than picking one randomly.  But then, I don't "get" the
attraction of splash screens, myself.

Good luck.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906242125.AA20749>