Re: Quote from thing



tomg@xxxxxxxxxxx wrote:
It might be fortune, if that is being run when he logs in. IIRC,
though, another commonly-used one, at login, was/is motd (i.e. message
of the day). I think they both just have simple text files, containing
all of the messages.

motd gives you one single message. Fortune chooses one, pseudo-randomly.
To make this thread vaguely relevant to electronics, and because I think
it's interesting. I'm going to tell you how it (the original version)
chooses one.

It uses stat() or fstat() to work out the total size of the text file in
bytes. Then it reads each multi-line message, one at a time. For each
message, it decides what fraction it represents of the remaining file
size. Then it chooses a random boolean value having that fraction as a
probability of truth, and if true, emits the message and terminates.

Thus even though the messages all vary in size, and it doesn't know how
many messages are present in advance, there's an equal chance of choosing
each one.

Well, I didn't say I expected *you* to be interested as well :-).
.



Relevant Pages

  • Re: Quote from thing
    ... Clifford Heath wrote: ... though, another commonly-used one, at login, was/is motd (i.e. message ... motd gives you one single message. ... it decides what fraction it represents of the remaining file ...
    (sci.electronics.design)
  • problems with motd
    ... I've got some problems with motd as following description: ... After logging in system, messages: last login. ... According to the man page for motd, use touch ~/.hushlogin can suppress those messages besides the last login part. ...
    (freebsd-questions)
  • Re: SSH and motd
    ... Pete ... >I have sometimes been using /etc/motd to provide helpfull ... >login attempts fails, and what he can do about it. ... >is simply because motd is first printed when the user has ...
    (comp.os.linux.security)
  • SSH and motd
    ... I have sometimes been using /etc/motd to provide helpfull ... login attempts fails, and what he can do about it. ... is simply because motd is first printed when the user has ... Kasper Dupont -- der bruger for meget tid på usenet. ...
    (comp.os.linux.security)
  • Delete Windows System Password Requirement
    ... I am purchasing a 3-month old computer from someone today for a ... fraction of the original cost. ... The seller's daughter passworded the System, so you must login when Windows ...
    (microsoft.public.windowsxp.customize)