Commit graph

20 commits

Author SHA1 Message Date
Warner Losh c857356409 Remove $FreeBSD$: alt one-line .c pattern
Remove /^\s*__RCSID\("\$FreeBSD\$"\);\n/
2023-08-16 11:54:53 -06:00
Philip Paeps 427b88d77e Add libxo(3) support to lastlogin(8).
Reviewed by:	kp
Approved by:	re (gjb)
MFC after:	1 week
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D16919
2018-08-28 17:12:37 +00:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
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.
2017-11-27 15:37:16 +00:00
Ed Schouten 05c67f2245 Allow custom files to be opened and allow sorting by timestamp.
While implementing a tool to import lastlog entries into utmpx, I
noticed lastlogin doesn't allow custom database files to be opened. Add
a -f switch to support this. Also, add -r and -t similar to ls(1),
ruptime(1), etc. where you can sort entries by timestamp and reverse
them. This allows you to spot active/idle users more easily.
2011-06-06 18:40:01 +00:00
Ed Schouten 6d2b7c381b Don't forget to catch realloc() errors. 2010-04-11 12:07:03 +00:00
Ed Schouten aacd7d6afc Alphabetically sort the output of lastlogin(8).
According to the manpage, the entries have to be sorted by uid. This is
no longer possible, since our utmpx implementation is completely unaware
of user IDs. You can safely add entries for multiple users sharing the
same uid.

Make the output less random by sorting everything by name.
2010-04-11 12:02:13 +00:00
Ed Schouten d7f1607c6a Chop off excessive long hostnames to keep the table structure intact.
This makes lastlogin(8) use exactly the same printf format as last(1).
2010-03-20 09:29:25 +00:00
Ed Schouten 3c247358fe Remove unneeded setpassent() calls.
lastlogin no longer requires the use of the passwd database.
2010-01-24 14:29:40 +00:00
Ed Schouten b5207b31c4 Port lastlogin(8) to utmpx.
While there, fix a bug I introduced previously. We must reopen the
database for each username passed on the command line. We must rewind
the database and search from the beginning.
2010-01-13 18:17:12 +00:00
Ed Schouten 10bc3a7f42 ANSIfy almost all applications that use WARNS=6.
I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.
2009-12-29 22:53:27 +00:00
Ed Schouten 444999a314 Several refinements to libulog's API.
- Only set the fields in the ulog_utmpx structure that are valid for the
  command in question. This means that strings like "shutdown" or "~"
  are not visible to the user anymore.
- Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
  the `antique' filename. If we ever get rid of utmp, it makes little
  sense calling it by its old name.
2009-12-26 22:36:05 +00:00
Ed Schouten b486f60642 Port lastlogin(1) to libulog.
Just use ulog_getutxuser() to obtain lastlog records or ulog_getutxent()
to browse through all of them.
2009-12-09 20:05:37 +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
Mike Barcroft 6a85a2d149 Don't depend on <pwd.h> to bogusly include <sys/types.h>. 2002-06-09 19:29:55 +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 5e8a6141be Fix ctime(&int) due to change to lastlog->ll_time 2001-10-29 00:40:05 +00:00
Dima Dorfman c869717158 Include stdlib.h for exit(3).
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-24 20:05:30 +00:00
Philippe Charnier fdd5d777dc Remove unused #includes, duplicate $FreeBSD$ and $NetBSD$ definitions.
Reviewed by:	Ruslan Ermilov <ru@FreeBSD.org>
2000-12-10 20:57:23 +00:00
Ruslan Ermilov b3b01ff362 Added the lastlogin utility.
Obtained from:	NetBSD
2000-11-14 17:49:38 +00:00