Age | Commit message (Collapse) | Author |
|
|
|
|
|
Error messages now output to stderr. Also updated logic to default to
updating the lastlogin file outside of the logic tree, since the logic
tree returned early on each failure state.
|
|
|
|
This function was a [huge] waste of processing power and complexity.
Replaced with a macro for easier readability of code, since 86400 (the
number of seconds in 24 hours) isn't immediately obvious what it is. Now
it is referenced by the macro SECONDS_IN_DAY.
|
|
The operation provided by get_lastlogin was very generic and could be
simplified and reduced to a simple file reader that returns a long value
rather than copying into a buffer by reference.
|
|
CCOPTS now turn on all warnings, optimize, and set standard to gnu99.
|
|
Previously there was a function for this (get_user_home: *sigh*). Now we
just check if the getenv for HOME returns a null pointer and save double
copying into a buffer.
|
|
Also renames get_help() to usage() and add -h,--help switch to the
output.
|
|
|
|
|
|
When bios clock resets to 1979, terminus reads that, determines the threshold
has not been exceeded (because it's a negative number since lastlogin obviously
ahead of 1979), and writes the new lastlogin time, which is in 1979. If ntp
then updates the clock, the user hasn't logged in in over 35 years, likely
exceeding their set threshold.
This puts in a sanity check to ensure the difference between lastlogin and now
is a positive number. If the difference exceeds -1 day, terminus exits since
the system clock is evidently unreliable.
|
|
In the event the threshold was exceeded, terminus would (and should) not reset
the lastlogin file. However if the user did not intend for the threshold to be
exceeded (eg: vacation), there was no way to reset the timer. This implements
the -r,--reset flags for resetting the lastlogin file.
Also moved the helptext into its own function and expanded it a bit.
To implement the new switches, implemented basic argument parser as well.
Consequently, implemented -h,--help flags.
|
|
Oops. Forgot to remove this when switching to atoi. Also removed math.h
include.
|
|
|
|
|
|
|
|
This version is fully working, though it is still lacking in some
functionality.
|