diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-05-29 17:00:30 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-05-29 17:00:30 +0000 |
commit | 7020377e8f2214d2adbda252c52ecd54e15d7e97 (patch) | |
tree | 0d1aff815863220cb9ad20f070a110f0c17aeedd /c/src/libnetworking/rtems/sghostname.c | |
parent | 2001-05-29 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-7020377e8f2214d2adbda252c52ecd54e15d7e97.tar.bz2 |
2002-05-29 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
Move networking libraries to c/src/exec/libnetworking
* configure.ac: Reflect Moval.
* Makefile.am: Reflect Moval.
* wrapup/Makefile.am: Reflect Moval.
Diffstat (limited to 'c/src/libnetworking/rtems/sghostname.c')
-rw-r--r-- | c/src/libnetworking/rtems/sghostname.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/c/src/libnetworking/rtems/sghostname.c b/c/src/libnetworking/rtems/sghostname.c deleted file mode 100644 index 307f045fbd..0000000000 --- a/c/src/libnetworking/rtems/sghostname.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * RTEMS versions of hostname functions - * FIXME: Not thread-safe - * - * $Id$ - */ - -#include <string.h> -#include <errno.h> -#include <rtems/rtems_bsdnet.h> -#include <sys/param.h> -#include <sys/malloc.h> -#include <sys/kernel.h> - -static char *rtems_hostname; - -int -gethostname (char *name, size_t namelen) -{ - char *cp = rtems_hostname; - - if (cp == NULL) - cp = ""; - strncpy (name, cp, namelen); - return 0; -} - -int -sethostname (char *name, size_t namelen) -{ - char *old, *new; - - if (namelen >= MAXHOSTNAMELEN) { - errno = EINVAL; - return -1; - } - new = malloc (namelen + 1, M_HTABLE, M_NOWAIT); - if (new == NULL) { - errno = ENOMEM; - return -1; - } - strncpy (new, name, namelen); - new[namelen] = '\0'; - old = rtems_hostname; - rtems_hostname = new; - if (old) - free (old, M_HTABLE); - return 0; -} |