Skip to content

Commit

Permalink
Add compat symlink for "last"
Browse files Browse the repository at this point in the history
  • Loading branch information
thkukuk committed Apr 11, 2023
1 parent 9386e49 commit aaf14bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ executable('wtmpdb',
dependencies : [libaudit],
install : true)

if get_option('compat-symlink')
install_symlink('last',
pointing_to: 'wtmpdb',
install_dir: 'bin')
endif

subdir('tmpfiles.d')
subdir('units')

Expand Down
3 changes: 3 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ option('man', type : 'combo', choices : ['auto', 'true', 'false'],
option('audit', type : 'combo', choices : ['auto', 'true', 'false'],
value : 'auto',
description : 'libaudit support')
option('compat-symlink', type : 'boolean',
value : 'false',
description : 'create last compat symlink')
4 changes: 3 additions & 1 deletion src/wtmpdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,9 @@ main (int argc, char **argv)
};
int c;

if (argc == 1)
if (strcmp (basename(argv[0]), "last") == 0)
return main_last (argc, argv);
else if (argc == 1)
usage (EXIT_SUCCESS);
else if (strcmp (argv[1], "last") == 0)
return main_last (--argc, ++argv);
Expand Down

0 comments on commit aaf14bf

Please sign in to comment.