How does Sendmail know how it was invoked?
Don Hinton
don.hinton at vanderbilt.edu
Sat Aug 4 11:17:36 PDT 2007
On Saturday 04 August 2007 13:06:34 RW wrote:
> mailwrapper checks to see how it was invoked and then looks up the
> appropriate command in mailer.conf. All of the entries in mailer.conf
> point to /usr/libexec/sendmail/sendmail, so how does that binary know what
> it's supposed to do.
It checks argv[0], i.e., the name used to invoke it. Here's a simple program
demostrating it:
#include <iostream>
int main (int argc, char* argv[])
{
std::cout << "my name is: " << argv[0] << std::endl;
return 0;
}
Save it to a file and do the following:
$ c++ -o foo file.cxx
$ ./foo
my name is: ./foo
$ mv foo bar
$ ./bar
my name is: ./bar
hth...
don
>
> I'm just curious.
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"
--
Don Hinton <don.hinton at vanderbilt.edu> or <hintonda at gmail.com>
Institute for Software Integrated Systems (ISIS), Vanderbilt University
tel: 615.480.5667 or 615.870.9728
More information about the freebsd-questions
mailing list