Ejemplo n.º 1
0
int main(){
    struct utmp *utbufp, *utmp_next();
    if(utmp_open(UTMP_FILE) == -1){
        perror(UTMP_FILE);
        exit(1);
    }
    while((utbufp = utmp_next()) != ((struct tmp *)NULL))
        show_info(utbufp);
    utmp_close();
    return 0;
}
Ejemplo n.º 2
0
int main(void)
{
  struct utmp *utbufp, 			/* holds pointer to next rec */
	  *utmp_next();			/* returns pointer to next */
  
  if ( utmp_open( UTMP_FILE ) == -1 )
  {
    perror( UTMP_FILE );
    exit(1);
  }
  
  while ((utbufp = utmp_next()) != ((struct utmp *)NULL))
    show_info( utbufp );
  
  utmp_close();
  return 0;
}
Ejemplo n.º 3
0
int main()
{
    struct utmp * utbufp, // holds pointer to next rec
                * utmp_nex(); // returns pointer to next

    if (utmp_open(UTMP_FILE) == -1)
    {
        perror(UTMP_FILE);      // UTMP_FILE is in utmp.h
        exit(1);
    }

    while ((utbufp = utmp_next()) != ((struct utmp *)NULL))
    {
        // printf("%d %d\n", reclen, utmpfd);
        show_info(utbufp);
    }
    utmp_close();
    return 0;                   // went ok
}
Ejemplo n.º 4
0
Archivo: who3.c Proyecto: wyj2046/UUP
int main(  )
  {
  struct utmp* utbufp,
    * utmp_next(  );
  if ( utmp_open( UTMP_FILE ) == -1 )
    {
      perror( UTMP_FILE );
      exit( 1 );
      
    }

  while ( ( utbufp = utmp_next(  ) ) != ( (struct utmp*)NULL ))
    show_info( utbufp );

  utmp_close(  );

  return 0;
    
    /* struct utmp current_record; */
    /* int utmpfd; */
    /* int reclen = sizeof( current_record ); */

    /* if ( ( utmpfd = open( UTMP_FILE, O_RDONLY ) ) == -1 ) */
    /*   { */
    /*     perror( UTMP_FILE ); */
    /*     exit( 1 ); */
        
    /*   } */

    /* while ( read( utmpfd, &current_record, reclen ) == reclen ) */
    /*   { */
    /*     show_info( &current_record ); */
        
    /*   } */

    /* close( utmpfd ); */

    /* return 0; */
    
  }