diff options
author | Aaron Ball <nullspoon@oper.io> | 2019-12-29 20:30:37 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2019-12-29 20:30:37 -0700 |
commit | c6f67b23e5996216ca30afb27baa914d32679005 (patch) | |
tree | 0d5a3f7767da3fb0abbd45610f62a6b3da027f41 | |
parent | 4f3627646436e25f62dd9cd90c6ba0b3d7eadc37 (diff) | |
download | terminus-c6f67b23e5996216ca30afb27baa914d32679005.tar.gz terminus-c6f67b23e5996216ca30afb27baa914d32679005.tar.xz |
Update usage text
Also renames get_help() to usage() and add -h,--help switch to the
output.
-rw-r--r-- | src/main.c | 36 |
1 files changed, 21 insertions, 15 deletions
@@ -23,19 +23,25 @@ /** * Prints the helptext */ -void get_help() { - printf("Please specify a timeout threshold (in days) as well as a command\n" - "or commands to be run if the threshold is exceeded.\n\n" - "[1mExample:[0m\n" - " terminus 5 '<command to execute>'\n\n" - "This example will execute the given command if the user has not\n" - "logged in in the last 5 days." - "\n\n" - "If terminus detects that the login threshold has been exceeded, it will\n" - "not reset the last login. If however the threshold was exceeded but the\n" - "user is fine, the lastlogin file can be reset using the [1m-r[0m or the\n" - "[1m--reset[0m flags\n\n" - ); +void usage() { + printf( +"Terminus is a program to trigger another program or script if the\n" +"configured passive activity threshold is exceeded. For example, if a user\n" +"does not log in to their system more recently than the configured duration,\n" +"then the configured program or script is executed by terminus on the next\n" +"login.\n" +"\n" +"Terminus is intended for use within the shell's profile/rc file so it is\n" +"called every time a new shell is loaded, which will update the lastlogin\n" +"timestamp as the user uses the system.\n" +"\n" +"Usage:\n" +" terminus <days> <command to execute>\n" +"\n" +"Options:\n" +" -h,--help Print this help text\n" +" -r,--reset Reset last login timestamp to current time\n" +); } @@ -157,7 +163,7 @@ int main(int argc, char* argv[]) { time_t lastlogin; if(argc == 1) { - get_help(); + usage(); return 1; } @@ -181,7 +187,7 @@ int main(int argc, char* argv[]) { return 0; } else if(strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) { // The user requested the help text - get_help(); + usage(); return 0; } } |