/*
  Copyright (C) 2005 SKYRIX Software AG

  This file is part of SOPE.

  SOPE is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the
  Free Software Foundation; either version 2, or (at your option) any
  later version.

  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
  License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with SOPE; see the file COPYING.  If not, write to the
  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.
*/

#include "common.h"

static void usage(NSArray *args) {
  printf("Usage: %s [[[month] year] startday]\n\n"
         "Arguments:\n"
         "  month    - month as a decimal (1-12)\n"
         "  year     - year  as a decimal (1976-2030)\n"
         "  startday - first column in matrix (Sunday=0...Saturday=6)\n"
         , [[args objectAtIndex:0] cString]);
}

static int doCalArgs(NSArray *args) {
  NSCalendarDate *now;
  unsigned startDayOfWeek, month, year;

  if ([args containsObject:@"--help"] || [args containsObject:@"-h"]) {
    usage(args);
    return 0;
  }

  now = [NSCalendarDate date];
  startDayOfWeek = 1 /* Monday */;
  month          = [now monthOfYear];
  year           = [now yearOfCommonEra];
  
  return 0;
}

int main(int argc, char **argv, char **env) {
  NSAutoreleasePool *pool;
  int res;
  
  pool = [[NSAutoreleasePool alloc] init];
#if LIB_FOUNDATION_LIBRARY  
  [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
  
  res = doCalArgs([[NSProcessInfo processInfo] argumentsWithoutDefaults]);
  
  [pool release];
  exit(0);
  /* static linking */
  [NGExtensions class];
  return 0;
}
