Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site men1.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!teddy!panda!talcott!harvard!seismo!umcp-cs!prometheus!men1!ron From: ron@men1.UUCP (Ron Flax) Newsgroups: net.sources Subject: Cute (.login || .profile) program Message-ID: <342@men1.UUCP> Date: Thu, 10-Jan-85 13:14:48 EST Article-I.D.: men1.342 Posted: Thu Jan 10 13:14:48 1985 Date-Received: Sat, 12-Jan-85 07:34:20 EST Distribution: net Organization: MTACCS Engineering Network, Arlington VA Lines: 46 This is a cute little program to put in a uses .login or .profle file to welcome him/her differently at different times of the day. The program is called tod.c (time of day): ------C-U-T--H-E-R-E------------------------C-U-T--H-E-R-E--T-O-O------ #include#include struct tm *localtime (); struct tm *loc_time; main () { long clock; char tod[5]; int t_hour, t_min, daytime, tnum; static char *daymsg[] = {"Good Morning!", "Good Afternoon! Only a few more hours to go.", "Good Evening! Working late I see.", "Good Grief! What are you doing on at this hour?", "I don't know what time it is, do you?"}; time (&clock); loc_time = localtime (&clock); t_hour = loc_time->tm_hour; t_min = loc_time->tm_min; sprintf (tod, "%2d%02d", t_hour, t_min); daytime = 5; /* Not sure what time it is? */ tnum = atoi (tod); if (tnum >= 0500 && tnum <= 1159) /* it's morning */ daytime = 0; if (tnum >= 1200 && tnum <= 1759) /* it's afternoon */ daytime = 1; if (tnum >= 1800 && tnum <= 2359) /* it's evening */ daytime = 2; if (tnum >= 0000 && tnum <= 0459) /* it's late! */ daytime = 3; printf ("\n\7%s\n", daymsg[daytime]); } ------C-U-T--H-E-R-E------------------------C-U-T--H-E-R-E--T-O-O------ Ron@men1 (Ron Flax) MTACCS Engineering Network ..!{seismo,umcp-cs}!{prometh,cal-unix}!men1!ron