/* Copyright (c) 2004-2005, Dirk Krause All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above opyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Dirk Krause nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* {{{ include files */ #include "dkfig.h" $(trace-include) /* }}} include files */ /* {{{ version number */ #ifndef VERSNUMB #define VERSNUMB "(developer)" #endif /* static char versnumb[] = { VERSNUMB }; */ /* }}} version number */ /* {{{ system configuration directory */ #ifndef SYSCONFDIR #if DK_HAVE_FEATURE_BACKSLASH #define SYSCONFDIR "\\ETC" #else #define SYSCONFDIR "/etc" #endif #endif static char sysconfdir[] = { SYSCONFDIR }; /* }}} system configuration directory */ /* {{{ package name */ #ifndef PACKAGNAME #define PACKAGENAME "fig2vect" #endif static char packagename[] = { PACKAGENAME }; /* }}} package name */ /* {{{ functions */ /* {{{ silence_check */ $* Check whether the application must run silently (--silent option, no log messages to stdout/stderr) or as a filter (no output file name, output goes to stdout, no log messages to stdout). $* static void silence_check DK_P4(int,argc,char **,argv,int *,rs,int *,rf) { int isrs = 0; int isrf = 0; int i; int filenames; char *fn1, *ptr, **lfdptr; $? "+ silence_check %d %s %s %s", argc, TR_PTR(argv), TR_PTR(rs), TR_PTR(rf) lfdptr = argv; lfdptr++; i = 1; filenames = 0; fn1 = NULL; while(i < argc) { ptr = *lfdptr; if(*ptr == '-') { ptr++; switch(*ptr) { case 's': isrs = 1; break; case 'l': case 'o': { ptr++; if(!(*ptr)) { lfdptr++; i++; } } break; } } else { filenames++; if(!fn1) fn1 = ptr; } lfdptr++; i++; } switch(filenames) { case 0: { isrf = 1; } break; case 1: { if(!dksf_is_directory(fn1)) { isrf = 1; } } break; } if(isrs) if(rs) *rs = isrs; if(isrf) if(rf) *rf = isrf; $? "- silence_check %d %d", isrs, isrf } /* }}} silence_check */ /* {{{ print_version */ $* Print the version number. $* static char *version_text[] = { "fig2vect, version " VERSNUMB " (SCCS=1.105)", "Copyright (C) 2004 Dipl.-Ing. D. Krause", "Redistribution and use in source and binary forms, with or without", "modification, are permitted provided that the following conditions are met:", "* Redistributions of source code must retain the above copyright notice, this", " list of conditions and the following disclaimer.", "* Redistributions in binary form must reproduce the above copyright notice,", " this list of conditions and the following disclaimer in the documentation", " and/or other materials provided with the distribution.", "* Neither the name of the Dirk Krause nor the names of other contributors may", " be used to endorse or promote products derived from this software without", " specific prior written permission.", "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"", "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE", "ARE DISCLAIMED.", "IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY", "DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES", "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;", "LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND", "ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS", "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", NULL }; static void print_version DK_P0() { char **xptr; $? "+ print_version" xptr = version_text; while(*xptr) { fputs(*(xptr++), stdout); fputc('\n', stdout); } fputc('\n', stdout); xptr = dklic_get(); fputs("Libraries used:\n", stdout); #if HAVE_PNG_H fputs("libpng the official PNG reference library\n", stdout); #endif #if HAVE_JPEGLIB_H fputs("jpegsrc The Independent JPEG Group's free JPEG software\n", stdout); #endif #if HAVE_PNM_H fputs("netpbm The image conversion toolkit\n", stdout); #endif while(*xptr) { fputs(*(xptr++), stdout); fputc('\n', stdout); } fputc('\n', stdout); $? "- print_version" } /* }}} print_version */ /* {{{ print_help */ $* Print help text. $* static char *help_text[] = { "fig2vect - XFig to vector graphics converter", "", "fig2vect [-l ] [-o