source: trunk/minix/lib/ip/domainname.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 414 bytes
Line 
1/*
2domainname.c
3*/
4
5#include <stdio.h>
6#include <string.h>
7#include <net/netlib.h>
8
9int getdomainname(domain, size)
10char *domain;
11size_t size;
12{
13 FILE *domainfile;
14 char *line;
15
16 domainfile= fopen("/etc/domainname", "r");
17 if (!domainfile)
18 {
19 return -1;
20 }
21
22 line= fgets(domain, size, domainfile);
23 fclose(domainfile);
24 if (!line)
25 return -1;
26 line= strchr(domain, '\n');
27 if (line)
28 *line= '\0';
29 return 0;
30}
Note: See TracBrowser for help on using the repository browser.