1/*-
2 * Copyright (c) 2002 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/usr.bin/who/who.c 202200 2010-01-13 18:09:54Z ed $");
29
30#include <sys/param.h>
31#include <sys/types.h>
32#include <sys/ioctl.h>
33#include <sys/stat.h>
34
35#include <err.h>
36#include <errno.h>
37#include <langinfo.h>
38#include <limits.h>
39#include <locale.h>
40#include <paths.h>
41#include <pwd.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <string.h>
45#include <time.h>
46#include <timeconv.h>
47#include <unistd.h>
48#include <utmpx.h>
49
50static void heading(void);
51static void process_utmp(void);
52static void quick(void);
53static void row(struct utmpx *);
54static int ttywidth(void);
55static void usage(void);
56static void whoami(void);
--- 46 unchanged lines hidden (view full) ---
103 mflag = 1;
104 argc -= 2;
105 argv += 2;
106 }
107 if (argc > 1)
108 usage();
109
110 if (*argv != NULL) {
111 if (setutxdb(UTXDB_ACTIVE, *argv) != 0)
112 err(1, "%s", *argv);
113 }
114
115 if (qflag)
116 quick();
117 else {
118 if (sflag)
119 Tflag = uflag = 0;
--- 184 unchanged lines hidden ---
2 * Copyright (c) 2002 Tim J. Robbins.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/usr.bin/who/who.c 202200 2010-01-13 18:09:54Z ed $");
29
30#include <sys/param.h>
31#include <sys/types.h>
32#include <sys/ioctl.h>
33#include <sys/stat.h>
34
35#include <err.h>
36#include <errno.h>
37#include <langinfo.h>
38#include <limits.h>
39#include <locale.h>
40#include <paths.h>
41#include <pwd.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <string.h>
45#include <time.h>
46#include <timeconv.h>
47#include <unistd.h>
48#include <utmpx.h>
49
50static void heading(void);
51static void process_utmp(void);
52static void quick(void);
53static void row(struct utmpx *);
54static int ttywidth(void);
55static void usage(void);
56static void whoami(void);
--- 46 unchanged lines hidden (view full) ---
103 mflag = 1;
104 argc -= 2;
105 argv += 2;
106 }
107 if (argc > 1)
108 usage();
109
110 if (*argv != NULL) {
111 if (setutxdb(UTXDB_ACTIVE, *argv) != 0)
112 err(1, "%s", *argv);
113 }
114
115 if (qflag)
116 quick();
117 else {
118 if (sflag)
119 Tflag = uflag = 0;
--- 184 unchanged lines hidden ---