File:  [DVB] / dietlibc / lib / getdomainname.c
Revision 1.3: download - view: text, annotated - select for diffs
Tue Aug 14 16:56:50 2001 UTC (22 years, 10 months ago) by fefe
Branches: MAIN
CVS tags: finnland_test_200301, branch_rc14_fieldtest_finnland, branch_rc13_fieldtest_finnland, branch_rc12_fieldtest_finnland, branch_rc10_fieldtest_finnland, RELEASE_finnland_200301_1, RC12_FIELDTEST_FINNLAND, RC10_FIELDTEST_FINNLAND, HEAD
enabled a few more obscure gcc warnings and started adding fluff code to
silence them.

#define _GNU_SOURCE

#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>

int getdomainname(char *name,size_t len) {
  struct utsname u;
  int res=uname(&u);
  if (res==0) {
    size_t i;
    if (len>=_UTSNAME_DOMAIN_LENGTH)
      len=_UTSNAME_DOMAIN_LENGTH;
    for (i=0; i<len; i++)
      name[i]=u.domainname[i];
  }
  return res;
}

LinuxTV legacy CVS <linuxtv.org/cvs>