1 d72054aa 2004-04-23 devnull #include <u.h>
2 d72054aa 2004-04-23 devnull #include <libc.h>
5 d72054aa 2004-04-23 devnull sysname(void)
7 70723aae 2005-01-04 devnull static char buf[512];
8 70723aae 2005-01-04 devnull char *p, *q;
10 70723aae 2005-01-04 devnull if(buf[0])
11 70723aae 2005-01-04 devnull return buf;
13 70723aae 2005-01-04 devnull if((q = getenv("sysname")) != nil && q[0] != 0){
14 70723aae 2005-01-04 devnull utfecpy(buf, buf+sizeof buf, q);
16 70723aae 2005-01-04 devnull return buf;
21 70723aae 2005-01-04 devnull if(gethostname(buf, sizeof buf) >= 0){
22 d72054aa 2004-04-23 devnull buf[sizeof buf-1] = 0;
23 70723aae 2005-01-04 devnull if((p = strchr(buf, '.')) != nil)
25 70723aae 2005-01-04 devnull return buf;
28 70723aae 2005-01-04 devnull strcpy(buf, "gnot");
29 70723aae 2005-01-04 devnull return buf;