Users: add new option --users-myself-only

This commit is contained in:
Carter Li authored and 李通洲 committed 2024-06-12 15:52:09 +08:00
1 parent ebfcd7195e
commit 5bb4dabaec
7 files changed
+89 -17

No files matched your search

+6 -3
View File
@@ -15,15 +15,18 @@
#include <arpa/inet.h>
#endif
const char* ffDetectUsers(FFlist* users)
const char* ffDetectUsers(FFUsersOptions* options, FFlist* users)
{
struct utmpx* n = NULL;
setutxent();
next:
while((n = getutxent()))
while ((n = getutxent()))
{
if(n->ut_type != USER_PROCESS)
if (n->ut_type != USER_PROCESS)
continue;
if (options->myselfOnly && !ffStrbufEqualS(&instance.state.platform.userName, n->ut_user))
continue;
FF_LIST_FOR_EACH(FFUserResult, user, *users)