[geeks] um, hi. I'm new.

Bill Bradford mrbill at mrbill.net
Fri Jun 28 13:21:51 CDT 2002


On Fri, Jun 28, 2002 at 02:08:54PM -0400, Dave McGuire wrote:
> void
> main(void)
> {
>   FILE *in, *out;
>   unsigned char mouth[MOUTHFUL_SIZ];
>   int soda_read;
>   if (!(in = fopen("/dev/soda", "r")))
>     {
>       fprintf(stderr, "no soda, go to fridge\n");
>       exit(1)
>     }
>   if (!(out = fopen("/dev/nose", "a")))
>     {
>       fprintf(stderr, "no nose, go to doctor\n");
>       exit(1)
>     }
>   soda_read = fread(mouth, MOUTHFUL_SIZ, 1, in);
>   if (soda_read)
>     fwrite(mouth, soda_read, 1, out);
>   fclose(in);
>   fclose(out);
>   exit(0);
> }

#/bin/bash
if [-f /tmp/soda];
 then spew_soda
else
 get_soda
 spew_soda
fi
spew_soda() {
  mv soda /tmp/mouth/
  cat /tmp/mouth/soda > /dev/monitor }
get_soda() {
echo "No soda. getting soda."
grep soda /dev/fridge > /tmp/soda }

Now, lets see Alex do this in one-line-of-perl-that-looks-like-line-noise! 8-)

Bill

-- 
Bill Bradford     
mrbill at mrbill.net 
Austin, TX        



More information about the geeks mailing list