Deleted Added
sdiff udiff text old ( 227081 ) new ( 250430 )
full compact
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. 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

--- 25 unchanged lines hidden (view full) ---

34 The Regents of the University of California. All rights reserved.\n";
35#endif /* not lint */
36
37#ifndef lint
38static const char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93";
39#endif /* not lint */
40#endif
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/sbin/dmesg/dmesg.c 227081 2011-11-04 13:36:02Z ed $");
43
44#include <sys/types.h>
45#include <sys/msgbuf.h>
46#include <sys/sysctl.h>
47
48#include <ctype.h>
49#include <err.h>
50#include <errno.h>
51#include <fcntl.h>
52#include <kvm.h>
53#include <limits.h>
54#include <locale.h>
55#include <nlist.h>
56#include <stdio.h>
57#include <stdlib.h>
58#include <string.h>
59#include <unistd.h>
60#include <vis.h>
61#include <sys/syslog.h>
62
63static struct nlist nl[] = {
64#define X_MSGBUF 0

--- 9 unchanged lines hidden (view full) ---

74int
75main(int argc, char *argv[])
76{
77 struct msgbuf *bufp, cur;
78 char *bp, *ep, *memf, *nextp, *nlistf, *p, *q, *visbp;
79 kvm_t *kd;
80 size_t buflen, bufpos;
81 long pri;
82 int all, ch;
83
84 all = 0;
85 (void) setlocale(LC_CTYPE, "");
86 memf = nlistf = NULL;
87 while ((ch = getopt(argc, argv, "aM:N:")) != -1)
88 switch(ch) {
89 case 'a':
90 all++;
91 break;
92 case 'M':
93 memf = optarg;
94 break;
95 case 'N':
96 nlistf = optarg;
97 break;
98 case '?':
99 default:

--- 85 unchanged lines hidden (view full) ---

185 continue;
186 p = q + 1;
187 }
188 }
189
190 (void)strvisx(visbp, p, nextp - p, 0);
191 (void)printf("%s", visbp);
192 }
193 exit(0);
194}
195
196void
197usage(void)
198{
199 (void)fprintf(stderr, "usage: dmesg [-a] [-M core [-N system]]\n");
200 exit(1);
201}