Updated copyright text/header in most source files.
[geda-gaf/peter-b.git] / gsymcheck / src / parsecmd.c
blob9a0d15d0eee619293be6c74c7344869c8f4f935a
1 /* gEDA - GPL Electronic Design Automation
2 * gsymcheck - gEDA Symbol Check
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <config.h>
23 #include <stdio.h>
24 #ifdef HAVE_UNISTD_H
25 #include <unistd.h>
26 #endif
28 #include <libgeda/libgeda.h>
30 #include "../include/struct.h"
31 #include "../include/globals.h"
32 #include "../include/prototype.h"
34 #define OPTIONS "qvh"
36 #ifndef OPTARG_IN_UNISTD
37 extern char *optarg;
38 extern int optind;
39 #endif
41 void
42 usage(char *cmd)
44 printf("Usage: %s [OPTIONS] filename1 ... filenameN\n", cmd);
45 printf(" -h Print usage\n");
46 printf(" -q Quiet mode\n");
47 printf(" -v Verbose mode (cumulative: errors, warnings, info)\n");
48 printf(" Use this to get the actual symbol error messages\n");
49 printf("\nfilename1 ... filenameN are the symbols to check\n");
50 printf("\n");
51 exit(0);
54 int
55 parse_commandline(int argc, char *argv[])
57 int ch;
59 while ((ch = getopt (argc, argv, OPTIONS)) != -1) {
60 switch (ch) {
62 case 'v':
63 verbose_mode++;
64 break;
66 case 'q':
67 quiet_mode=TRUE;
68 break;
70 #if 0
71 case 'f':
72 printf("f arg: %s\n", optarg);
73 break;
74 #endif
76 case 'h':
77 usage(argv[0]);
78 break;
80 case '?':
81 default:
82 usage(argv[0]);
83 break;
87 return(optind);