#: 3482 S3/Languages
14-May-90 08:54:26
Sb: #3474-problems with os9fork
Fm: Bill Dickhaus 70325,523
To: BRETT 72057,3720 (X)
Brett,
I can't help you with question #1, but I can with #2. To use redirection,
pipes, and any other shell functions, you must use the system() function OR
fork shell using the complete command line as you would type it in from the
keyboard. In your code fragment, you are actually passing all that stuff to
mail, and it doesn't know what to do with it. System is easier to use, since
you don't have to put in all those other parameters. This is your code modified
to use the system() function:
char *mail_arg = "mail foo!foobar!user < dead.letter";
system(mail_arg);
If the command line is constant, you could also use:
system("mail foo!foobar!user < dead.letter");
You can also use functions like strcpy() and strcat() to build up a command
line, something like:
char *user;
strcpy(user, "foo")
sendlet(user);
....
sendlet(user)
char *user;
{
char cmdline[50]; /* make sure this is big enough, or use malloc */
system(strcat(strcat(strcpy(cmdline, "mail "),user),"
|