# Include <sys/types. h>
# Include <sys/sysctl. h>
-(Void) showPlatform {
Int mib [2];
Size_t len;
Char * machine;
Mib [0] = CTL_HW;
Mib [1] = HW_MACHINE;
Sysctl (mib, 2, NULL, & len, NULL, 0 );
Machine = malloc (len );
Sysctl (mib, 2, machine, & len, NULL, 0 );
NSString * platform = [NSString stringWithCString: machine encoding: NSASCIIStringEncoding];
Free (machine );
If ([platform is+tostring: @ "iPhone1, 1"]) platform = @ "iPhone 1G ";
If ([platform is+tostring: @ "iPhone1, 2"]) platform = @ "iPhone 3G ";
If ([platform is+tostring: @ "iPhone2, 1"]) platform = @ "iPhone 3GS ";
If ([platform isEqualToString: @ "iPhone3, 1"]) platform = @ "iPhone 4 ";
If ([platform is+tostring: @ "iPod1, 1"]) platform = @ "iPod Touch 1G ";
If ([platform is+tostring: @ "iPod2, 1"]) platform = @ "iPod Touch 2G ";
If ([platform is+tostring: @ "iPod3, 1"]) platform = @ "iPod Touch 3G ";
If ([platform isEqualToString: @ "iPod4, 1"]) platform = @ "iPod Touch 4G ";
If ([platform is+tostring: @ "iPad1, 1"]) platform = @ "iPad ";
If ([platform isdesktostring: @ "iPad2, 1"]) platform = @ "iPad 2 (WiFi )";
If ([platform isw.tostring: @ "iPad2, 2"]) platform = @ "iPad 2 (GSM )";
If ([platform isdesktostring: @ "iPad2, 3"]) platform = @ "iPad 2 (CDMA )";
If ([platform isEqualToString: @ "i386"]) platform = @ "Simulator ";
NSLog (@ "Device: % @", platform );
}