Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
No functional change intended.
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
- 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
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
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.
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
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
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.
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>
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.