SOPE_ROOT=../..
SOPE_OBJ_ROOT=$(GNUSTEP_BUILD_DIR)/$(SOPE_ROOT)
+ifeq ($(FOUNDATION_LIB),apple)
+ifeq ($(frameworks),yes)
+BUNDLE_INSTALL_DIR := /Library/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/
+endif
+endif
+
+
ADDITIONAL_INCLUDE_DIRS += \
-I$(SOPE_ROOT)/sope-xml \
-I$(SOPE_ROOT)/sope-core/NGExtensions
XmlRpc \
samples
-ifneq ($(frameworks),yes)
-
SUBPROJECTS += STXSaxDriver
ifeq ($(HAS_LIBRARY_xml2),yes)
SUBPROJECTS += libxmlSAXDriver
endif
-endif
-
include $(GNUSTEP_MAKEFILES)/aggregate.make
+2005-08-16 Helge Hess <helge.hess@opengroupware.org>
+
+ * saxxml.m: print a usage information in case no arguments are given or
+ the --help argument is used. Print SAX driver lookup directories when
+ --dirs option is given
+
2005-05-03 Helge Hess <helge.hess@opengroupware.org>
* fixed gcc 4.0 warnings, changed for new DOM implemention names
@end
+@interface SaxXMLReaderFactory(Pathes)
+- (NSArray *)saxReaderSearchPathes;
+@end
+
+static void usage(const char *n) {
+ fprintf(stderr,
+ "Usage: %s <file1> <file2> ...\n"
+ "\n"
+ "Arguments (Defaults):\n"
+ " -XMLReader <classname> - select the SAX driver class\n"
+ " --dirs - just print the dirs containing drivers\n"
+ "\n"
+ "Samples:\n"
+ " %s /etc/X11/xkb/rules/xfree86.xml\n"
+ " %s -XMLReader STXSaxDriver structured-document.stx\n"
+ " %s -XMLReader VSiCalSaxDriver event.ics\n"
+ " %s -XMLReader VSvCardSaxDriver steve.vcf\n"
+ , n, n, n, n, n);
+}
+
+static void listSaxScanDirs(void) {
+ NSArray *a;
+ unsigned i, count;
+
+ a = [[SaxXMLReaderFactory standardXMLReaderFactory] saxReaderSearchPathes];
+ for (i = 0, count = [a count]; i < count; i++)
+ printf("%s\n", [[a objectAtIndex:i] cString]);
+
+ if (i == 0) {
+ fprintf(stderr, "found no search pathes!\n");
+ exit(1);
+ }
+}
+
int main(int argc, char **argv, char **env) {
id<NSObject,SaxXMLReader> parser;
id sax;
NSString *path;
NSAutoreleasePool *pool;
NSString *cwd;
+ BOOL hadPath = NO;
pool = [[NSAutoreleasePool alloc] init];
#if LIB_FOUNDATION_LIBRARY
paths = [[[NSProcessInfo processInfo] arguments] objectEnumerator];
[paths nextObject];
- while ((path = [paths nextObject])) {
+ while ((path = [paths nextObject]) != nil) {
NSAutoreleasePool *pool;
+ if ([path isEqualToString:@"--help"]) {
+ usage(argv[0]);
+ exit(0);
+ }
+
+ if ([path isEqualToString:@"--dirs"]) {
+ listSaxScanDirs();
+ exit(0);
+ }
+
if ([path hasPrefix:@"-"]) { /* consume defaults */
[paths nextObject];
continue;
}
+
+ hadPath = YES;
pool = [[NSAutoreleasePool alloc] init];
[pool release];
}
+
+ if (!hadPath) {
+ usage(argv[0]);
+ exit(1);
+ }
/* cleanup */