1
0

adding utmp

This commit is contained in:
Daniel Tartavel 2020-05-07 17:10:00 +02:00
parent 9bf19ae69f
commit 6ba7083faf

15
main.c
View File

@ -5,6 +5,7 @@
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <utmp.h>
#define HOSTNAME "lalis" #define HOSTNAME "lalis"
@ -18,8 +19,18 @@ int isinarray( int pid, int array[], int n )
{ {
return x; return x;
} }
} return 0;
} }
return 0;
int getutmp( int pid )
{
struct utmp * utmp;
while ( (utmp = getutent()) == NULL )
{
printf("toto");
}
endutent();
} }
int null2space( char str[] ) int null2space( char str[] )
@ -92,6 +103,7 @@ int getprocinfo( int ppid, char cmdline[], char cmd[], char user[] )
int retval = 0; int retval = 0;
char * pos; char * pos;
getutmp( pid );
while ( flag == 0) while ( flag == 0)
{ {
r = getpids( pid, child_pid ); r = getpids( pid, child_pid );
@ -147,6 +159,7 @@ int main()
{ {
FILE *fh; FILE *fh;
FILE *fh1; FILE *fh1;
struct utmp * utmp;
int n_ssh=10; int n_ssh=10;
int id; int id;
int pid; int pid;