repo.or.cz
/
minix3.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Uninitialized vector entry?
[minix3.git]
/
lib
/
ip
/
domainname.c
blob
cae29d7789d1d2c74b033f0a3b795d6d07e26ce5
1
/*
2
domainname.c
3
*/
4
5
#include <stdio.h>
6
#include <string.h>
7
#include <unistd.h>
8
#include <net/netlib.h>
9
10
int
getdomainname
(
domain
,
size
)
11
char
*
domain
;
12
size_t
size
;
13
{
14
FILE
*
domainfile
;
15
char
*
line
;
16
17
domainfile
=
fopen
(
"/etc/domainname"
,
"r"
);
18
if
(!
domainfile
)
19
{
20
return
-
1
;
21
}
22
23
line
=
fgets
(
domain
,
size
,
domainfile
);
24
fclose
(
domainfile
);
25
if
(!
line
)
26
return
-
1
;
27
line
=
strchr
(
domain
,
'
\n
'
);
28
if
(
line
)
29
*
line
=
'\0'
;
30
return
0
;
31
}