]> err.no Git - sope/commitdiff
started ngcal tool
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 18 Aug 2005 15:08:50 +0000 (15:08 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 18 Aug 2005 15:08:50 +0000 (15:08 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1050 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-core/samples/ChangeLog
sope-core/samples/GNUmakefile
sope-core/samples/ngcal.m [new file with mode: 0644]

index 5ffca0a874c0505df1c60dda48b01c7bd57a2a8e..7bfb072c3eb5c368c3e922ea47fcaf366a151fd5 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-18  Helge Hess  <helge.hess@skyrix.com>
+
+       * prepared new ngcal tool for testing calendar calculations
+         (unfinished)
+
 2005-08-10  Helge Hess  <helge.hess@opengroupware.org>
 
        * EOQualTool.m: fixed gcc 4.0 warnings
index a6e2bd84c40b155e0b2cd7ea252b90ec3bc9ef61..07114da43d31c2e2f91a9cfb5167db7d7bd65fae 100644 (file)
@@ -13,7 +13,8 @@ TOOL_NAME = \
        httpu_notify    \
        parserule       \
        testurl         \
-       sope-rsrclookup
+       sope-rsrclookup \
+       ngcal
 
 ifneq ($(OBJC_RUNTIME_LIB),apple)
 TOOL_NAME += subclassing
@@ -30,6 +31,7 @@ parserule_OBJC_FILES     = parserule.m
 httpu_notify_OBJC_FILES  = httpu_notify.m
 testurl_OBJC_FILES       = testurl.m
 sope-rsrclookup_OBJC_FILES = sope-rsrclookup.m
+ngcal_OBJC_FILES         = ngcal.m
 
 -include GNUmakefile.preamble
 include $(GNUSTEP_MAKEFILES)/tool.make
diff --git a/sope-core/samples/ngcal.m b/sope-core/samples/ngcal.m
new file mode 100644 (file)
index 0000000..e08781f
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+  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;
+}