adding utmp
This commit is contained in:
parent
9bf19ae69f
commit
6ba7083faf
15
main.c
15
main.c
@ -5,6 +5,7 @@
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <utmp.h>
|
||||
|
||||
#define HOSTNAME "lalis"
|
||||
|
||||
@ -18,8 +19,18 @@ int isinarray( int pid, int array[], int n )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
} return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
int getutmp( int pid )
|
||||
{
|
||||
struct utmp * utmp;
|
||||
while ( (utmp = getutent()) == NULL )
|
||||
{
|
||||
printf("toto");
|
||||
}
|
||||
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;
|
||||
|
Reference in New Issue
Block a user