History log of /freebsd-9.3-release/usr.sbin/ac/ac.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 242891 11-Nov-2012 ed

MFC r233522, r239855, r239910, r239938, r239954 and r239961.

- Relicense to 2-clause BSD license.
- 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.


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 216227 06-Dec-2010 kevlo

Fix double ;;


# 206095 02-Apr-2010 ed

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


# 202203 13-Jan-2010 ed

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.


# 126752 08-Mar-2004 gad

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


# 126750 08-Mar-2004 gad

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


# 126516 03-Mar-2004 gad

Minor style(9) fixes. remove a register keyword, correct two indents.
Noticed while comparing to OpenBSD version.


# 126515 03-Mar-2004 gad

Convert K&R-style routine definitions to C89 style, partially to reduce
diffs with OpenBSD. This causes no changes to the object produced.


# 105325 17-Oct-2002 charnier

Remove unused #includes. Eliminate castings by using size_t instead of int.


# 99831 11-Jul-2002 alfred

Fix indentation broken in previous __P removal.

Grumbled about by: bde


# 99800 11-Jul-2002 alfred

de-__P()


# 99604 08-Jul-2002 bde

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.


# 89572 19-Jan-2002 dillon

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.


# 85649 28-Oct-2001 dillon

localtime() was being called with an int-pointer due to recent utmp
fixes.


# 81156 05-Aug-2001 jon

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


# 80275 24-Jul-2001 kris

Replace strncpy -> strlcpy

Obtained from: OpenBSD
MFC after: 1 week


# 78713 24-Jun-2001 dd

Constify and set WARNS=2.

Submitted by: Mike Barcroft <mike@q9media.com>
Reviewed by: md5(1)


# 74568 21-Mar-2001 ache

Use nl_langinfo instead of %Ef


# 61956 22-Jun-2000 ache

Use %Ef instead of hardcoded %b %e


# 52166 12-Oct-1999 charnier

err -> errx for malloc failure


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48459 02-Jul-1999 sheldonh

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


# 48378 30-Jun-1999 sheldonh

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


# 37330 02-Jul-1998 phk

/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>


# 36353 25-May-1998 steve

Give correct times with old wtmp files.

PR: 4732
Submitted by: Andrew Timonin <tim@pool1.convey.ru>


# 28995 01-Sep-1997 charnier

Style in rcsid, sort #include.


# 24428 31-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 11827 26-Oct-1995 ache

Add setlocale LC_TIME


# 8857 30-May-1995 rgrimes

Remove trailing whitespace.


# 4484 14-Nov-1994 ache

strncmp use wrong utmp name size
Submitted by: rlz@zeus.id.net


# 3133 26-Sep-1994 dg

ac(8) utility, brought over from FreeBSD 1.1.5.