hostname behaves like the following on XP (polish localized copy,
messages may differ):
if(no parameter line given) {
print hostname()
} else {
if(parameter line begins with "-") {
if(parameter == "-s")
print hostname() . "\n"
else
print "Invalid option. \n\n Prints current host name. \n\n hostname \n"
}
else
print "sethostname: Use Control panel applet to set hostname. \n
hostname -s is not supported. \n"
}
~d0g
Benny Gaechter pisze:
If argc is more than 1 (so if there is given a
parameter) the output is
/Print the current host's name.\n\nhostname\n
/But maybe it could be changed in:
/
Usage: hostname
use this application without any parameter./
}else{
if (0 == strcmp(argv[1],"-s"))
{
fprintf(stderr,"%s: -s not supported.\n",argv[0]);
return EXIT_FAILURE;
}else{
printf("\nUsage: hostname\n\nuse this application without
any parameter\n"); //here i had to change.
}
}