OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [common/] [getdnnm.c] - Blame information for rev 1325

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
#include <stdlib.h>
2
#include <string.h>
3
#include <unistd.h>
4
#include <errno.h>
5
#define __USE_GNU
6
#include <sys/utsname.h>
7
 
8
 
9
int
10
getdomainname(char *name, size_t len)
11
{
12
  struct utsname uts;
13
 
14
  if (name == NULL) {
15
    __set_errno(EINVAL);
16
    return -1;
17
  }
18
 
19
  if (uname(&uts) == -1) return -1;
20
 
21
  if (strlen(uts.domainname)+1 > len) {
22
    __set_errno(EINVAL);
23
    return -1;
24
  }
25
  strcpy(name, uts.domainname);
26
  return 0;
27
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.