Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getutxent() not returning values when using 10.4u SDK



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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.