Mercurial > hg > octave-nkf
changeset 320:781f2e240975
[project @ 1994-01-28 20:00:20 by jwe]
author | jwe |
---|---|
date | Fri, 28 Jan 1994 20:01:18 +0000 |
parents | 42fe4794ded9 |
children | 2d04965c32fb |
files | src/utils.cc src/utils.h |
diffstat | 2 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/utils.cc +++ b/src/utils.cc @@ -32,7 +32,7 @@ read_octal sub_append_string decode_prompt_string pathname_backup make_absolute get_working_directory - change_to_directory + change_to_directory gethostname */ @@ -1117,6 +1117,28 @@ } } +#if !defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H) +extern "C" +{ +#include <sys/utsname.h> +int +gethostname (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; +} +} +#endif + /* * Has file `A' been modified after time `T'? *