Mail Archives: cygwin/1998/01/27/23:06:07
>3) As you can see above, the hostname of my system is printed in all caps
for
>some reason. I placed in my /etc/profile the following line:
>
>export HOSTNAME=`/NT/system32/hostname`
>
>which works fine on the command line and returns a lower-case version of my
>hostname. (The cygwin32 version of hostname returns the hostname in all
caps--I
>don't know why.) Bash is supposed to use $HOSTNAME for the \h in $PS1.
Again,
>what is going on here?
bash uses "gethostname()" if it is avaliable, or it's own version (in
oslib.c). you
can delete line "#define HAVE_GETHOSTNAME 1" in config.h and hack this
function
to downcase name.
#if !defined (HAVE_GETHOSTNAME)
# if defined (HAVE_UNAME)
# include <sys/utsname.h>
int
gethostname (name, namelen)
char *name;
int namelen;
{
int i;
struct utsname ut;
--namelen;
uname (&ut);
i = strlen (ut.nodename) + 1;
strncpy (name, ut.nodename, i < namelen ? i : namelen);
name[namelen] = '\0';
return (0);
}
# else /* !HAVE_UNAME */
int
gethostname (name, namelen)
int name, namelen;
{
strncpy (name, "unknown", namelen);
name[namelen] = '\0';
return 0;
}
# endif /* !HAVE_UNAME */
#endif /* !HAVE_GETHOSTNAME */
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -