1 cfa37a7b 2004-04-10 devnull .TH GETUSER 3
3 cfa37a7b 2004-04-10 devnull getuser, sysname \- get user or system name
4 cfa37a7b 2004-04-10 devnull .SH SYNOPSIS
5 cfa37a7b 2004-04-10 devnull .B #include <u.h>
7 cfa37a7b 2004-04-10 devnull .B #include <libc.h>
10 cfa37a7b 2004-04-10 devnull char* getuser(void)
13 cfa37a7b 2004-04-10 devnull char* sysname(void)
14 cfa37a7b 2004-04-10 devnull .SH DESCRIPTION
15 cfa37a7b 2004-04-10 devnull .I Getuser
16 cfa37a7b 2004-04-10 devnull returns a pointer to static data which contains the
17 cfa37a7b 2004-04-10 devnull null-terminated
18 cfa37a7b 2004-04-10 devnull name of the user who
19 cfa37a7b 2004-04-10 devnull owns the current process.
20 cfa37a7b 2004-04-10 devnull .I Getuser
22 058b0118 2005-01-03 devnull .IR getuid (2)
23 058b0118 2005-01-03 devnull and then reads
24 058b0118 2005-01-03 devnull .B /etc/passwd
25 058b0118 2005-01-03 devnull to find the corresponding name.
27 cfa37a7b 2004-04-10 devnull .I Sysname
28 058b0118 2005-01-03 devnull returns a pointer to static data which contains the name
29 058b0118 2005-01-03 devnull of the machine on which the current process is running.
30 058b0118 2005-01-03 devnull .I Sysname
31 058b0118 2005-01-03 devnull looks first for an environment variable
32 058b0118 2005-01-03 devnull .BR $sysname .
33 058b0118 2005-01-03 devnull If there is no such variable,
34 058b0118 2005-01-03 devnull .I sysname
36 058b0118 2005-01-03 devnull .IR gethostname (2)
37 058b0118 2005-01-03 devnull and truncates the returned name at the first dot.
39 058b0118 2005-01-03 devnull .I gethostname
41 058b0118 2005-01-03 devnull .I sysname
42 058b0118 2005-01-03 devnull returns the default name
43 058b0118 2005-01-03 devnull .LR gnot .
46 cfa37a7b 2004-04-10 devnull .IR getuser ,
47 cfa37a7b 2004-04-10 devnull .I sysname
48 058b0118 2005-01-03 devnull caches the string, deriving the host name only once.
49 cfa37a7b 2004-04-10 devnull .SH SOURCE
50 c3674de4 2005-01-11 devnull .B \*9/src/lib9/getuser.c
52 c3674de4 2005-01-11 devnull .B \*9/src/lib9/sysname.c