This really belongs on something like comp.lang.unix, but hey...

In <[EMAIL PROTECTED]>, J. Seth Henry <[EMAIL PROTECTED]> typed:
> In summary, can anyone help me write code that:
> 1) puts my daemon to sleep, awaking only when either a timer has expired,
> data has arrived one of the controlled serial ports, or the user has
> invoked some interface from a script or command line utility.

Select on Posix. kqueue on FreeBSD is more flexible though.

> 2) Daemonizes my program (dissasociating itself from the terminal)

See the daemon function, though I'm not sure if it's
posix-compliant. The man page describes what it does, though.

> 3) Accepts commands and/or data from scripts or command line utilities.

popen is the call you want.

> 4) Call other programs, and pass them parameters.

popen if you want to read their output or send them input. system if
you don't. fork and exec* for absolute control.

> 5) Read the system clock.

time(3).

        <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>          http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to