Fix grammar issues and unify style across documentation and code comments.
No functional change.
## lastlog2
-`lastlog2` tries to solve this problems:
+`lastlog2` tries to solve these problems:
* It's using sqlite3 as database backend.
-* Data is only collected via a PAM module, so that every tools can make use of it, without modifying existing packages.
+* Data is only collected via a PAM module, so that all tools can make use of it, without modifying existing packages.
* The output is as compatible as possible with the old lastlog implementation.
* The old `/var/log/lastlog` file can be imported into the new database.
* The size of the database depends on the amount of users, not how big the biggest UID is.
-**IMPORTANT** To be Y2038 safe on 32bit architectures, the binaries needs to be build with a **64bit time_t**. This should be the standard on 64bit architectures.
+**IMPORTANT** To be Y2038 safe on 32bit architectures, the binaries need to be built with a **64bit time_t**. This should be the standard on 64bit architectures.
Besides the lastlog2 library in this directory there are additional parts like service definition, PAM module and applications:
*lastlog2* reports the last login of a given user or of all users who did ever login on a system.
-It's using sqlite3 as database backend. Data is only collected via a PAM module, so that every
+It's using sqlite3 as database backend. Data is only collected via a PAM module, so that all
tools can make use of it, without modifying existing packages.
The output is as compatible as possible with the old lastlog implementation.
By default the database will be written as `/var/lib/lastlog/lastlog2.db`.
== NAME
-ll2_import_lastlog - Import old lastlog file.
+ll2_import_lastlog - Imports old lastlog file.
== SYNOPSIS
== DESCRIPTION
-Importing all entries from _lastlog_file_ file (lastlog(8)) into
+Imports all entries from _lastlog_file_ file (lastlog(8)) into
lastlog2 database defined with _context_.
If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_,
will be taken.
== NAME
-ll2_new_context - Context which defines the lastlog2 environment.
+ll2_new_context - Allocates context which defines the lastlog2 environment.
== SYNOPSIS
== DESCRIPTION
-Defining lastlog2 context e.g. database file, which will be used for
-any other lastlog2 calls. If _db_path_ is NULL, the default path defined
+Defines lastlog2 context e.g. database file, which will be used for
+any other lastlog2 call. If _db_path_ is NULL, the default path defined
in _LL2_DEFAULT_DATABASE_ will be taken.
--------------------------------------
== RETURN VALUE
-Returns context which will used for all other lastlog2 library calls.
+Returns context which will be used for all other lastlog2 library calls.
This context should be released with _ll2_unref_context_ when it is not
needed anymore.
Returns NULL on an error.
_error_ contains an error string if the return value is -1.
_error_ is not guaranteed to contain an error string, could also be NULL.
_error_ should be freed by the caller.
-If lastlog2 database does not exist at all, the errno ENOENT has been set
+If lastlog2 database does not exist at all, the errno ENOENT is set
and can be checked.
== AUTHORS
_error_ contains an error string if the return value is -1.
_error_ is not guaranteed to contain an error string, could also be NULL.
_error_ should be freed by the caller.
-If lastlog2 database does not exist at all, the errno ENOENT has been set
+If lastlog2 database does not exist at all, the errno ENOENT is set
and can be checked.
The evaluated values are returned by _ll_time_, _tty_, _rhost_ and _pam_service_.
== NAME
-ll2_remove_entry - Remove all entries of an user.
+ll2_remove_entry - Removes all entries of a user.
== SYNOPSIS
== DESCRIPTION
-Removing all database entries, defined in _context_, with the user name _user_.
+Removes all database entries, defined in _context_, with the user name _user_.
If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_,
will be taken.
== NAME
-ll2_rename_user - Renames an user entry.
+ll2_rename_user - Renames a user entry.
== SYNOPSIS
== DESCRIPTION
-Changing user name from _user_ to _newname_ of one entry in
+Changes user name from _user_ to _newname_ of one entry in
database, which is defined by _context_. All other entries with the user _user_
will be deleted.
If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_,
== NAME
-ll2_unref_context - Freeing lastlog2 context.
+ll2_unref_context - Frees lastlog2 context.
== SYNOPSIS
== DESCRIPTION
-Freeing lastlog2 context, which has been generated by
+Frees lastlog2 context, which has been allocated by
_ll2_new_context_.
--------------------------------------
== NAME
-ll2_update_login_time - Writes an *new* entry with updated login time.
+ll2_update_login_time - Writes a *new* entry with updated login time.
== SYNOPSIS
== DESCRIPTION
-Writes an *new* entry to database, defined in _context_, for user _user_.
+Writes a *new* entry to database, defined in _context_, for user _user_.
Time is set by _ll_time_ whereas the other values are taken from
an already existing entry.
If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_,
Returns 0 on success, -ENOMEM or -1 on other failure.
_error_ contains an error string if the return value is -1.
-_error_ is not guaranteed to contain an error string. It could also be NULL if the return value is -1.
+_error_ is not guaranteed to contain an error string, could also be NULL.
_error_ should be freed by the caller.
== AUTHORS
== NAME
-ll2_write_entry - Write a new entry into the database.
+ll2_write_entry - Writes a new entry into the database.
== SYNOPSIS
== DESCRIPTION
-Writes an new entry into database, which is defined in _context_.
+Writes a new entry into database, which is defined in _context_.
If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_,
will be taken.
#include "lastlog2P.h"
#include "strutils.h"
-/* Set the ll2 context/environment */
+/* Sets the ll2 context/environment. */
/* Returns the context or NULL if an error has happened. */
extern struct ll2_context * ll2_new_context(const char *db_path)
{
return context;
}
-/* Release ll2 context/environment */
+/* Releases ll2 context/environment. */
extern void ll2_unref_context(struct ll2_context *context)
{
if (context)
return retval;
}
-/* reads 1 entry from database and returns that. Returns 0 on success, -ENOMEM or -1 on other failure. */
+/* Reads one entry from database and returns that.
+ Returns 0 on success, -ENOMEM or -1 on other failure. */
int
ll2_read_entry(struct ll2_context *context, const char *user,
int64_t *ll_time, char **tty, char **rhost,
return retval;
}
-/* Write a new entry. Returns 0 on success, -ENOMEM or -1 on other failure. */
+/* Writes a new entry.
+ Returns 0 on success, -ENOMEM or -1 on other failure. */
static int
write_entry(sqlite3 *db, const char *user,
int64_t ll_time, const char *tty, const char *rhost,
return retval;
}
-/* Write a new entry. Returns 0 on success, -ENOMEM or -1 on other failure. */
+/* Writes a new entry.
+ Returns 0 on success, -ENOMEM or -1 on other failure. */
int
ll2_write_entry(struct ll2_context *context, const char *user,
int64_t ll_time, const char *tty, const char *rhost,
return retval;
}
-/* Write a new entry with updated login time.
+/* Writes a new entry with updated login time.
Returns 0 on success, -ENOMEM or -1 on other failure. */
int
ll2_update_login_time(struct ll2_context *context, const char *user,
char **error)
{
sqlite3 *db;
- char *err_msg = 0;
+ char *err_msg = NULL;
int retval = 0;
if ((retval = open_database_ro(context, &db, error)) != 0)
return retval;
}
-/* Remove an user entry. Returns 0 on success, -ENOMEM or -1 on other failure. */
+/* Removes a user entry.
+ Returns 0 on success, -ENOMEM or -1 on other failure. */
static int
remove_entry(sqlite3 *db, const char *user, char **error)
{
return retval;
}
-/* Remove an user entry. Returns 0 on success, -ENOMEM or -1 on other failure. */
+/* Removes a user entry.
+ Returns 0 on success, -ENOMEM or -1 on other failure. */
int
ll2_remove_entry(struct ll2_context *context, const char *user,
char **error)
return retval;
}
-/* Renames an user entry. Returns 0 on success, -ENOMEM or -1 on other failure. */
+/* Renames a user entry.
+ Returns 0 on success, -ENOMEM or -1 on other failure. */
int
ll2_rename_user(struct ll2_context *context, const char *user,
const char *newname, char **error)
return retval;
}
-/* Import old lastlog file.
+/* Imports old lastlog file.
Returns 0 on success, -ENOMEM or -1 on other failure. */
int
ll2_import_lastlog(struct ll2_context *context, const char *lastlog_file,
== NAME
-lastlog2 - display date of last login for all users or a specific one
+lastlog2 - displays date of last login for all users or a specific one
== SYNOPSIS