Updated copyright text/header in most source files.
[geda-gaf/peter-b.git] / gschem / src / parsecmd.c
blob8b72d6a4a7db3b1470e8ff8199742371e0088264
1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
20 #include <config.h>
22 #include <stdio.h>
23 #ifdef HAVE_UNISTD_H
24 #include <unistd.h>
25 #endif
27 #include "gschem.h"
29 #ifdef HAVE_LIBDMALLOC
30 #include <dmalloc.h>
31 #endif
33 #define OPTIONS "hqvr:s:o:pt"
35 #ifndef OPTARG_IN_UNISTD
36 extern char *optarg;
37 extern int optind;
38 #endif
40 /*! \todo Finish function documentation!!!
41 * \brief
42 * \par Function Description
45 void usage(char *cmd)
47 printf(_("Usage: %s [OPTIONS] schematic_filename1 ... schematic_filenameN\n"
48 " -q Quiet mode\n"
49 " -v Verbose mode on\n"
50 " -r filename Rc filename\n"
51 " -s filename Script (guile) filename\n"
52 " -o filename Output filename (for printing)\n"
53 " -p Automatically place the window\n"
54 " -t Print stroke information\n"
55 " -h Help; this message\n"
56 "\n"), cmd);
57 exit(0);
60 /*! \todo Finish function documentation!!!
61 * \brief
62 * \par Function Description
65 int parse_commandline(int argc, char *argv[])
67 int ch;
69 while ((ch = getopt (argc, argv, OPTIONS)) != -1) {
70 switch (ch) {
71 case 'v':
72 verbose_mode = TRUE;
73 break;
75 case 't':
76 stroke_info_mode = TRUE;
77 break;
79 case 'q':
80 quiet_mode = TRUE;
81 break;
83 case 'r':
84 rc_filename = g_strdup (optarg);
85 break;
87 case 's':
88 script_filename = g_strdup (optarg);
89 break;
91 case 'o':
92 output_filename = g_strdup (optarg);
93 break;
95 case 'p':
96 auto_place_mode = TRUE;
97 break;
99 case 'h':
100 usage(argv[0]);
101 break;
103 case '?':
104 default:
105 usage(argv[0]);
106 break;
110 if (quiet_mode) {
111 verbose_mode = FALSE;
114 return(optind);