Commit Graph

61 Commits

Author SHA1 Message Date
Joel Dahl
c65b9b0bd9 Move example to EXAMPLES. 2013-03-17 06:54:04 +00:00
Eitan Adler
eae8be706e Bump date missed in r202756
PR:		docs/171624
Submitted by:	bdrewery
Approved by:	gabor
MFC after:	3 days
2012-09-14 17:50:42 +00:00
Ed Schouten
f66dc62abf Also relicense the ac(8) man page.
MFC after:	1 month
Discussed with:	Simon Gerraty and Chris Demetriou
2012-08-31 22:37:08 +00:00
Ed Schouten
8f67c5bc87 Relicense ac(8).
Though the license of the original ac(8) source code provides many
liberties, we are already somewhat violating it. The license requires us
to clearly comment any modifications to the source code, as the original
authors of course do not want to get bug reports for modified versions
of ac(8). This is something we have not done consistently.

The need for such a license clause has become less over time. It is very
unlikely that end users will contact the original authors, as the
copyright is from 1994. I contacted both the copyright holders. They
responded in a timely fashion and were more than willing to relicense it
to a 2-clause BSD license. To address any concerns about bug reports
going to the original authors instead of me, add my own name and email
address to the copyright statements as well.

MFC after:		1 month
Special thanks to:	Christopher Demetriou and Simon Gerraty
2012-08-31 18:26:39 +00:00
Ed Schouten
07df15dd9e Use better variable naming.
MFC after:	1 month
2012-08-31 08:48:53 +00:00
Ed Schouten
b42c08d3c4 Massively refactor ac(8).
- Use queue(3) -- not some homegrown implementation of linked lists.
- Rename structures to _entry, as they are entries in the linked list --
  not the lists themselves.
- Don't store entire copies of struct utmpx in utmpx_entry, but only the
  members we're interested in. Large fields such as hostnames are not
  needed during the execution of the program.
- Give structure members useful names, instead of `name'.
- While there, use struct timevals instead of time_t's internally. This
  is not strictly useful, but while we're at it...
- Mark stuff static.
- Add missing const keywords.
- Remove unneeded prototypes.
- Remove workaround for sparc64-specific utmp problems. These don't
  apply to utmpx.
- Don't discard entries when timestamps are not monotone. This shouldn't
  ever happen with utmpx, but discarding them is a bit too harsh.
- Remove debug code. We nowadays have `getent utmpx', which can be used
  to analyze logfiles in depth.
- Use proper uppercasing/periods in comments.
- Print output of `ac -p' sorted alphabetically, instead of first
  occurrence.
- Properly check against pts/* instead of tty[PQRSpqrs]* to determine
  whether a TTY is a pseudo-terminal.

MFC after:	1 month
2012-08-30 16:45:27 +00:00
Ed Schouten
57bc16315f Fix whitespace. 2012-08-29 16:15:22 +00:00
Joel Dahl
46355096e1 mdoc: correct .Bd/.Bl arguments.
Reviewed by:	brueffer
2012-03-26 21:22:53 +00:00
Kevin Lo
7df9d5acad Fix double ;; 2010-12-06 10:24:06 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +00:00
Ed Schouten
9c8d0b9600 Properly initialize the timestamp when using ac -w.
When using ac -w, we must use the last timestamp to terminate the log
file. I accidentally removed this when I ported the code to use utmpx.

Reported by:	avg
2010-04-02 14:30:56 +00:00
Ed Schouten
0806dd9238 Remove stale references to utmp(5) and its corresponding filenames.
I removed utmp and its manpage, but not other manpages referring to it.
2010-01-21 17:25:12 +00:00
Ed Schouten
cf4d4e152c Port ac(8) to utmpx.
Similar to last(1), it must compare ut_id's instead of TTYs to determine
whether a session has been terminated. It must also use ut_type to
determine the type of the login record instead figuring it out by
itself.
2010-01-13 18:14:59 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
Garance A Drosehn
e3b218cd7b Add a check for wtmp records which have invalid values for ut_time. Wtmp
records with time==0 get "the time of the last valid record", while records
where time goes backwards (compared to the previous record) are skipped.
Also prints a message saying how many records were changed or skipped due
to these checks. Check was inspired by a simpler check in OpenBSD's version.

This is all meant to sidestep problems that Tillman Hodgson noticed with 'ac'
when running sparc64 with 64-bit time_t's.  The real problem is whatever is
creating wtmp records with ut_time==0, of course, but I have not yet figured
out what is doing that.

Reviewed by:	no screams from freebsd-sparc64 or bde
MFC after:	2 weeks
2004-03-08 20:02:23 +00:00
Garance A Drosehn
c38a857969 Compile 'ac' with DEBUG when arch==sparc64. 2004-03-08 20:01:34 +00:00
Garance A Drosehn
b5a06c256e Add a debug-statement from NetBSD, and then rework all debug-statements
so the program compiles without errors or warnings when DEBUG is defined on
sparc64 with 64-bit time_t's.  Also have debug statements include the year
when printing records from a different year than 'now'.  Also print out a
special timestamp in debug statements when ut_time==0.

Reviewed by:	freebsd-sparc, bde
MFC after:	2 weeks
2004-03-08 19:20:06 +00:00
Garance A Drosehn
2adaffb0aa Minor style(9) fixes. remove a register keyword, correct two indents.
Noticed while comparing to OpenBSD version.
2004-03-03 02:44:52 +00:00
Garance A Drosehn
7f761c522e Convert K&R-style routine definitions to C89 style, partially to reduce
diffs with OpenBSD.  This causes no changes to the object produced.
2004-03-03 02:41:21 +00:00
Philippe Charnier
b51547cf62 Remove unused #includes. Eliminate castings by using size_t instead of int. 2002-10-17 13:19:47 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Alfred Perlstein
54b60d7e15 Fix indentation broken in previous __P removal.
Grumbled about by: bde
2002-07-11 22:18:26 +00:00
Alfred Perlstein
d89167b4ea de-__P() 2002-07-11 18:31:16 +00:00
Bruce Evans
db774d6099 Fixed some world breakage caused by not updating clients when <timeconv.h>
was split off from <time.h>.  This became fatal here when -Werror was
reenabled.
2002-07-08 20:13:07 +00:00
Matthew Dillon
170ac683f2 I've been meaning to do this for a while. Add an underscore to the
time_to_xxx() and xxx_to_time() functions.  e.g. _time_to_xxx()
instead of time_to_xxx(), to make it more obvious that these are
stopgap functions & placemarkers and not meant to create a defacto
standard.  They will eventually be replaced when a real standard
comes out of committee.
2002-01-19 23:20:02 +00:00
Matthew Dillon
2064ef1c81 localtime() was being called with an int-pointer due to recent utmp
fixes.
2001-10-29 00:36:01 +00:00
Dima Dorfman
2392d350e6 Don't mention wtmp.[0-7] in the FILES section. This manual page
doesn't talk about these files elsewhere, doesn't use the files by
default, and the names are dependent on site-specific newsyslog
configuration.

PR:		30348
Submitted by:	Giorgos Keramidas <charon@labs.gr>
2001-09-05 19:33:08 +00:00
Ruslan Ermilov
d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
Jonathan Chen
974a54a2cd Fix logic error resulting in incorrect calculation of login time
PR:		bin/4204
Submitted by:	Anatoly A. Orehovsky <tolik@www.tomsk.su>
MFC after:	4 weeks
2001-08-05 09:41:20 +00:00
Kris Kennaway
fd96447ad0 Replace strncpy -> strlcpy
Obtained from:	OpenBSD
MFC after:	1 week
2001-07-24 11:36:56 +00:00
David E. O'Brien
90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Dima Dorfman
dfe60c7914 Constify and set WARNS=2.
Submitted by:	Mike Barcroft <mike@q9media.com>
Reviewed by:	md5(1)
2001-06-24 18:41:30 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Andrey A. Chernov
497c755856 Use nl_langinfo instead of %Ef 2001-03-21 13:41:03 +00:00
Ruslan Ermilov
c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
Ruslan Ermilov
e97407b4f2 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
Andrey A. Chernov
34d45d6d4e Use %Ef instead of hardcoded %b %e 2000-06-22 15:09:51 +00:00
Philippe Charnier
c3737d34ba err -> errx for malloc failure 1999-10-12 19:27:11 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Sheldon Hearn
1361b1fd76 Back out previous commit. Allowing `-' as a pseudonym for /dev/stdin is
legacy behaviour inherited from systems that don't have /dev/stdin.

Requested by:	bde
1999-07-02 12:31:31 +00:00
Sheldon Hearn
2835cbd026 Allow the use of `-' as an argument to the -w option so that standard
input may be used (e.g. gunzip -c /var/log/wtmp.Jan.gz | ac -w - ).

PR:	12467
Submitted by:	wollman
1999-06-30 21:46:03 +00:00
Poul-Henning Kamp
1ce46cef12 /var/log/wtmp entries for ptys are treated differently in ac, since
they may not be logins.  The code for determining whether it is a pty
entry is broken.

PR:		7137
Reviewed by:	phk
Submitted by:	Tom Rush <tarush@mindspring.com>
1998-07-02 05:34:08 +00:00
Steve Price
2a30154f05 Give correct times with old wtmp files.
PR:		4732
Submitted by:	Andrew Timonin <tim@pool1.convey.ru>
1998-05-25 05:21:29 +00:00
Philippe Charnier
3efa2f585c Style in rcsid, sort #include. 1997-09-01 06:11:40 +00:00
Warner Losh
6c3f552a31 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-31 05:11:47 +00:00
Peter Wemm
476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00