On Wed, 19 Jan 2000 20:05:24 +0000 (GMT) , [EMAIL PROTECTED] writes:
> #include <stdio.h>
> #include <stdlib.h>
> void main(void)
> {
>        long len=0L;
> 
>        fseek( stdin, 0L, SEEK_END);
>        len=ftell(stdin);
>        fseek( stdin, 0L, SEEK_SET);
>        if (len>=128000L)
>         system("/var/qmail3/bin/forward \"$DEFAULT@$HOST\"");
>        else
>         system("/var/qmail2/bin/forward \"$DEFAULT@$HOST\"");
> }

ugh... two seeks?  Stat() is sooo much nicer ;-)

#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>

int main(void) {
  struct stat st;
  if (fstat(0, &st) < 0) _exit(111);
  if (lseek(0,0,SEEK_SET)< 0) _exit(111);
  if (st.st_size >= 128000L)
    system("/var/qmail3/bin/forward \"$DEFAULT@$HOST\"");
  else
    system("/var/qmail2/bin/forward \"$DEFAULT@$HOST\"");
  return 0;
}

-- 
Chris Mikkelson  | If you throw your bread upon the waters, it shall come
[EMAIL PROTECTED] | back threefold, but only if you are willing to throw the
                 | recipe upon the waters as well...  -- Terry Lambert 
                        

Reply via email to