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 201033 2009-12-26 22:36:05Z 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#define _ULOG_POSIX_NAMES
48#include <ulog.h>
49#include <unistd.h>
50
51static void heading(void);
52static void process_utmp(void);
53static void quick(void);
54static void row(struct utmpx *);
55static int ttywidth(void);
56static void usage(void);
57static void whoami(void);
--- 46 unchanged lines hidden (view full) ---
104 mflag = 1;
105 argc -= 2;
106 argv += 2;
107 }
108 if (argc > 1)
109 usage();
110
111 if (*argv != NULL) {
112 if (ulog_setutxfile(UTXI_TTY, *argv) != 0)
113 err(1, "%s", *argv);
114 }
115
116 if (qflag)
117 quick();
118 else {
119 if (sflag)
120 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 201033 2009-12-26 22:36:05Z 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#define _ULOG_POSIX_NAMES
48#include <ulog.h>
49#include <unistd.h>
50
51static void heading(void);
52static void process_utmp(void);
53static void quick(void);
54static void row(struct utmpx *);
55static int ttywidth(void);
56static void usage(void);
57static void whoami(void);
--- 46 unchanged lines hidden (view full) ---
104 mflag = 1;
105 argc -= 2;
106 argv += 2;
107 }
108 if (argc > 1)
109 usage();
110
111 if (*argv != NULL) {
112 if (ulog_setutxfile(UTXI_TTY, *argv) != 0)
113 err(1, "%s", *argv);
114 }
115
116 if (qflag)
117 quick();
118 else {
119 if (sflag)
120 Tflag = uflag = 0;
--- 184 unchanged lines hidden ---