From 6ba7083faf0729f250fc969ae30903b3bbf2d9e8 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Thu, 7 May 2020 17:10:00 +0200 Subject: [PATCH] adding utmp --- main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 2b14afe..431faa0 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,7 @@ #include #include #include +#include #define HOSTNAME "lalis" @@ -18,8 +19,18 @@ int isinarray( int pid, int array[], int n ) { return x; } + } return 0; +} + +int getutmp( int pid ) +{ + struct utmp * utmp; + while ( (utmp = getutent()) == NULL ) + { + printf("toto"); } - return 0; + endutent(); + } int null2space( char str[] ) @@ -92,6 +103,7 @@ int getprocinfo( int ppid, char cmdline[], char cmd[], char user[] ) int retval = 0; char * pos; + getutmp( pid ); while ( flag == 0) { r = getpids( pid, child_pid ); @@ -147,6 +159,7 @@ int main() { FILE *fh; FILE *fh1; + struct utmp * utmp; int n_ssh=10; int id; int pid;