Re: Whee, Greased HedgeHog on Steroids

Matty (matt@blitzen.canberra.edu.au)
Fri, 3 May 1996 07:30:31 +1000 (EST)


On Thu, 2 May 1996, shaggenbunsenburner wrote:
> On Tue, 30 Apr 1996, Andrew C. Esh wrote:
[snip]

> > If you'd like, I could write a PERL script which will scan the Makefile
> > of your current kernel source code and tell you the proper non-numeric
> > name for that kernel.
>
> sure - let's put it in the mainstream kernel distribution as "make madlib
> zlilo" or something :)

Well, in the mean time, here's a version in C. It's nothing special -
just something I hacked up because I was bored :)
It grabs the version info out of linux/version.h instead of the Makefile
as I couldn't be bothered making it open up the Makefile & read in the
desired values.
Feel free to do whatever you want with it :)

--
/*  greased_hedgehog.c                              */
/*  by Matt Hawkins <matt@blitzen.canberra.edu.au>  */

#include <stdio.h> #include <stdlib.h> #include <linux/version.h>

int main(void) { static char *s; int ver, pat, sublevel; div_t d;

sscanf(UTS_RELEASE, "%d.%d.%d", &ver, &pat, &sublevel);

d = div(sublevel, 10);

switch (ver) { case 1: s = "Greased"; break; case 2: s = "Turbocharged"; break; case 3: s = "Supercharged"; break; case 4: s = "Stealthy"; break; case 5: s = "Electrified"; break; case 6: s = "Hysterical"; break; case 7: s = "Zany"; break; case 8: s = "Wild-eyed"; break; case 9: s = "Unbeatable"; break; default: s = "ERROR"; } printf("%s ", s); switch (pat) { case 0: s = "Chicken"; break; case 1: s = "GroundHog"; break; case 2: s = "Ostrich"; break; case 3: s = "HedgeHog"; break; case 4: s = "Penguin"; break; case 5: s = "Kitten"; break; case 6: s = "Owl"; break; case 7: s = "Shrew"; break; case 8: s = "Rabbit"; break; case 9: s = "Hawk"; default: s = "ERROR"; } printf("%s ", s); switch (d.quot) { case 0: s = "doing"; break; case 1: s = "selling"; break; case 2: s = "spaced by"; break; case 3: s = "zoning on"; break; case 4: s = "needing"; break; case 5: s = "buying"; break; case 6: s = "handing out"; break; case 7: s = "craving"; break; case 8: s = "looking for"; break; case 9: s = "on"; break; default: s = "ERROR"; } printf("%s ", s); switch (d.rem) { case 0: s = "LSD"; break; case 1: s = "Quaaludes"; break; case 2: s = "Prozac"; break; case 3: s = "Pot"; break; case 4: s = "Dark Rum"; break; case 5: s = "Steroids"; break; case 6: s = "Endorphines"; break; case 7: s = "Adrenaline"; break; case 8: s = "Mountain Dew"; break; case 9: s = "Jolt Cola"; break; default: s = "ERROR"; } printf("%s.\n", s); return 0; }

--

Yeah, I should have used const char **'s for the strings, but for some reason gcc was seg. faulting on them and I couldn't be bothered finding out why. (gimme a break - it's 7:30am and I should be in.. what's that place called? bed - that's it...long time no see ;)

-,-,-,- Cogito Eggo Sum - "I think, therefore I am a waffle" -,-,-,-,-,-,-,-,-,- Matthew Hawkins - part-time programmer, sysadmin, BOFH. Full-time Geek. matt@blitzen.canberra.edu.au President, UC Computer Club. (UCNET) -'-'-'-'-'-'-'-'-'-'- Veni, Vidi, Vice - "I came, I saw, I partied" '-'-'-'-'-'-

-----BEGIN GEEK CODE BLOCK----- Version: 3.12 GIT/GMU/GO d- s++:- a-- C+++ UL++++(S+) P--- L++++>$ E- W+++(--) N+(++) !o K- w--- O M-- V--(!V) PS+ PE++ Y+ PGP t+ 5++ X+ !R tv--- b+ DI(+) D++ G-- e>++ d++ r--->+++ !y+ ------END GEEK CODE BLOCK------