/*
Copyright (C) 2005 Gürkan Sengün <gurkan@phys.ethz.ch>
Public Domain

NSRealMemoryAvailable

systemTimeZone should be /etc/localtime
localTimeZone whatever TZ's set to
*/

#import <Foundation/Foundation.h>

void NSLog(NSString *format, ...)
{
    va_list args;
    va_start (args,format);
    NSString *string;
    string = [[NSString alloc] initWithFormat: format  arguments: args];
    va_end (args);
    printf ("%s\n", [string cString]);
    [string release];
}

int main(int argc, char **argv)
{
    char s[1024];
    CREATE_AUTORELEASE_POOL(pool);

    /* NSString *processName = [[NSProcessInfo processInfo] processName];
    NSString *today = [[NSDate date] description]; */

    NSLog(@"Program %@",    [[NSProcessInfo processInfo] processName]);
    NSLog(@"Arguments %s",  [[[[NSProcessInfo processInfo] arguments] componentsJoinedByString:@" "] cString]);
    NSLog(@"OSName %s",     [[[NSProcessInfo processInfo] operatingSystemName] cString]);
    NSLog(@"Hostname %s",   [[[NSProcessInfo processInfo] hostName] cString]);
    NSLog(@"Today %s",      [[[NSDate date] description] cString]);
    NSLog(@"Today %f",      [[NSDate date] timeIntervalSinceReferenceDate]);
    NSLog(@"Today %f",      [[NSDate date] timeIntervalSince1970]); /* like date +%s */
    NSLog(@"Hostaddress %s",[[[NSHost currentHost] address] cString]);
    NSLog(@"Hostname %s",   [[[NSHost currentHost] name] cString]);
    NSLog(@"Timezone %@",   [[NSTimeZone systemTimeZone] name]);
    NSLog(@"Abbr. TZ %@",   [[NSTimeZone localTimeZone] abbreviation]);
    NSLog(@"PID %d",        [[NSProcessInfo processInfo] processIdentifier]);
    NSLog(@"PName %@",      [[NSProcessInfo processInfo] processName]);
    NSLog(@"WoY %d",        [[NSCalendarDate calendarDate] weekOfYear]);
    NSLog(@"DoY %d",        [[NSCalendarDate calendarDate] dayOfYear]);
    NSLog(@"DoW %d",        [[NSCalendarDate calendarDate] dayOfWeek]);

    printf("Your name? ");
    if (NULL!=gets(s)) {
	printf("Hello %s.\n",s);
    }

    DESTROY(pool);
    return 0;
}
