gsymcheck
|
00001 /* gEDA - GPL Electronic Design Automation 00002 * gsymcheck - gEDA Symbol Check 00003 * Copyright (C) 1998-2010 Ales Hvezda 00004 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details) 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00019 * MA 02111-1301 USA. 00020 */ 00021 00022 #include <config.h> 00023 00024 #include <stdio.h> 00025 #ifdef HAVE_UNISTD_H 00026 #include <unistd.h> 00027 #endif 00028 00029 #include <libgeda/libgeda.h> 00030 00031 #include "../include/struct.h" 00032 #include "../include/globals.h" 00033 #include "../include/prototype.h" 00034 00035 #define OPTIONS "qvh" 00036 00037 #ifndef OPTARG_IN_UNISTD 00038 extern char *optarg; 00039 extern int optind; 00040 #endif 00041 00042 void 00043 usage(char *cmd) 00044 { 00045 printf("Usage: %s [OPTIONS] filename1 ... filenameN\n", cmd); 00046 printf(" -h Print usage\n"); 00047 printf(" -q Quiet mode\n"); 00048 printf(" -v Verbose mode (cumulative: errors, warnings, info)\n"); 00049 printf(" Use this to get the actual symbol error messages\n"); 00050 printf("\nfilename1 ... filenameN are the symbols to check\n"); 00051 printf("\n"); 00052 exit(0); 00053 } 00054 00055 int 00056 parse_commandline(int argc, char *argv[]) 00057 { 00058 int ch; 00059 00060 while ((ch = getopt (argc, argv, OPTIONS)) != -1) { 00061 switch (ch) { 00062 00063 case 'v': 00064 verbose_mode++; 00065 break; 00066 00067 case 'q': 00068 quiet_mode=TRUE; 00069 break; 00070 00071 #if 0 00072 case 'f': 00073 printf("f arg: %s\n", optarg); 00074 break; 00075 #endif 00076 00077 case 'h': 00078 usage(argv[0]); 00079 break; 00080 00081 case '?': 00082 default: 00083 usage(argv[0]); 00084 break; 00085 } 00086 } 00087 00088 return(optind); 00089 }