Hello
> 4 int
> 5 main(void)
> 6 {
> 7 char *s;
> 8
> 9 s = getenv("HOSTNAME");
> 10 if (s == NULL) {
> 11 fprintf(stderr, "getenv error\n");
> 12 exit(EXIT_FAILURE);
> 13 }
> 14 printf("HOSTNAME=%s\n", s);
> 15 return EXIT_SUCCESS;
> 16 }
It returns "getenv error"... at least in console at X11, will try on simlple
shell...
> By running 'env' you can see what variables are exported to the child
> processes of your shell.
> : [EMAIL PROTECTED]:~$ env | grep HOSTNAME
> : [EMAIL PROTECTED]:~$ echo $HOSTNAME
> : orion.daedalusnetworks.priv
HOSTNAME was not exported... and echo $HOSTNAME returns "bsd.mydomain.org"
> Clearly HOSTNAME isn't one of them. Using the program shown above and
>
> env(1) you can verify this:
> : [EMAIL PROTECTED]:~$ gcc -O -Wall -o lala lala.c
> : [EMAIL PROTECTED]:~$ ./lala
> : getenv error
> : [EMAIL PROTECTED]:~$ env HOSTNAME="testhost" ./lala
> : HOSTNAME=testhost
> : [EMAIL PROTECTED]:~$
Efectively was that way... in Linux it used to work fine... then my next
question should be... is there any other way to retrieve the hostname? and...
as a normal user?
Thanks!!
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"