getutxent() not returning values when using 10.4u SDK
getutxent() not returning values when using 10.4u SDK
- Subject: getutxent() not returning values when using 10.4u SDK
- From: Rosyna <email@hidden>
- Date: Thu, 24 Jul 2008 13:51:55 -0700
If I call setutxent()/getutxent()/endutxent() when using the 10.5 SDK
while on 10.5, I correctly get the various fields filled out. If I use
the 10.4u SDK only the username is filled out. The ut_type and ut_pid
and ut_tv fields are all empty.
Why would they be empty when the only change is the SDK?
#include <utmpx.h>
#include <stdio.h>
inline const char * getType(short type) {
char * result = NULL;
switch (type) {
case BOOT_TIME:
result = "Boot Time";
break;
case DEAD_PROCESS:
result = "Dead Process";
break;
case EMPTY:
result = "Empty";
break;
case INIT_PROCESS:
result = "Init Process";
break;
case LOGIN_PROCESS:
result = "Login Process";
break;
case NEW_TIME:
result = "New Time";
break;
case OLD_TIME:
result = "Old Time";
break;
case RUN_LVL:
result = "Run Level";
break;
case USER_PROCESS:
result = "User Process";
break;
default:
result = "Unknown";
break;
}
return result;
}
int main()
{
int nlines = 0;
struct utmpx * ux = NULL;
setutxent();
while (ux = getutxent()) {
printf("Line[%i]: %s @ %s (%s)\n", nlines++, ux->ut_user, ux->ut_host,
getType(ux->ut_type));
}
endutxent();
return 0;
}
---
Sincerely,
Rosyna Keller
Technical Support/Carbon troll/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden