Esempio n. 1
0
struct utmp *utmp_next() /* return pointer to next struct */
{
	struct utmp *recp;
	if(fd_utmp == -1)
		return NULLUT;
	if(cur_rec == num_recs && utmp_reload() == 0)
		return NULLUT;
	/* get address of next record */
	recp = (struct utmp *) &utmpbuf[cur_rec * UTSIZE];
	cur_rec++;
	return recp;
}
Esempio n. 2
0
struct utmp * utmp_next()
{
	struct utmp * recp;
	if ( fd_utmp == -1 )					// error?
		return NULLUT;
	if ( cur_rec == num_recs && utmp_reload() == 0)		// any more?
		return NULLUT; 
		
	recp = ( struct utmp*) &utmpbuf[cur_rec * UTSIZE];	// get address of next record
	cur_rec++;
	return recp;
}
struct utmp *utmp_next()
{
	struct utmp *recp;

	if (fd_utmp == -1)
		return NULLUT;
	if (cur_rec == num_recs && utmp_reload() == 0)
		return NULLUT;
	recp = ( struct utmp *) &utmpbuf[cur_rec * UTSIZE];
	cur_rec++;
	return recp;
}
Esempio n. 4
0
struct utmp *utmp_next()   /* next utmp loading  */
{
        struct utmp *recp;   //utmp 

        if ( fd_utmp == -1 )        // null check                    
                return NULLUT;
        if ( cur_rec==num_recs && utmp_reload()==0 )    
                return NULLUT;
                                        
        recp = ( struct utmp *) &utmpbuf[cur_rec * UTSIZE]; // loading utmp
        cur_rec++; // recursive ++
        return recp;
}
Esempio n. 5
0
struct utmp *utmp_next()
{
        struct utmp *recp;

        if ( fd_utmp == -1 )                            /* error ?      */
                return NULL;
        if ( cur_rec==num_recs && utmp_reload()==0 )    /* any more ?   */
                return NULL;
                                        /* get address of next record   */
        recp = (struct utmp *) &utmpbuf[cur_rec * UTSIZE];
        cur_rec++;
        return recp;
}
Esempio n. 6
0
struct utmp * utmp_next()
{
	struct utmp *recp;
	if(fd_utmp == -1)
		return NULLUT;
	if(cur_rec == num_recs && utmp_reload() ==0)
		return NULLUT;
//一次读取一个结构体
	recp = (struct utmp *)&utmpbuf[cur_rec * UTSIZE];
//当前记录的位置
	cur_rec++;
//结构体内容
	return recp;
}
Esempio n. 7
0
struct utmp *utmp_next()
{
     struct utmp *recp;
     //如果文件读取失败,则返回null
     if (fd_utmp == -1)
	  return NULLUT;

     //没有下一条记录了,文件读取结束
     if (cur_rec == num_recs && utmp_reload() == 0)
	  return NULLUT;

     //读取记录,并且cur_rec加1
     recp = (struct utmp *)&utmpbuf[cur_rec * UTSIZE];
     cur_rec++;
     return recp;
}
Esempio n. 8
0
struct utmp* utmp_next()
{
  struct utmp *putmp;

  while(1)
  {
    if (cur_record == num_record && utmp_reload() == 0)
    {
      return NULL;
    }

    putmp = (struct utmp*)(utmpbuf + UTMP_SIZE * cur_record);
    cur_record++;

    if (putmp->ut_type == USER_PROCESS)
    {
      return putmp;
    }
  }
}