Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/bensch/orxonox.cc @ 1822

Last change on this file since 1822 was 1814, checked in by bensch, 21 years ago

orxonox/brnaches/bensch: added autoproject configuration

File size: 2.6 KB
RevLine 
[1814]1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
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, or (at your option)
9   any later version.
10
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.
15
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 Foundation,
18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
19
20*/
21
22#include <stdio.h>
23#include <sys/types.h>
24#include <getopt.h>
25#include "system.h"
26
27#define EXIT_FAILURE 1
28
29extern "C" {
30  char *xstrdup (char *p);
31}
32
33static void usage (int status);
34
35/* The name the program was run with, stripped of any leading path. */
36char *program_name;
37
38/* Option flags and variables */
39
40int want_quiet;                 /* --quiet, --silent */
41
42static struct option const long_options[] =
43{
44  {"quiet", no_argument, 0, 'q'},
45  {"silent", no_argument, 0, 'q'},
46  {"verbose", no_argument, 0, 'v'},
47  {"help", no_argument, 0, 'h'},
48  {"version", no_argument, 0, 'V'},
49  {NULL, 0, NULL, 0}
50};
51
52static int decode_switches (int argc, char **argv);
53
54int
55main (int argc, char **argv)
56{
57  int i;
58
59  program_name = argv[0];
60
61  i = decode_switches (argc, argv);
62
63  /* do the work */
64
65  exit (0);
66}
67
68/* Set all the option flags according to the switches specified.
69   Return the index of the first non-option argument.  */
70
71static int
72decode_switches (int argc, char **argv)
73{
74  int c;
75
76
77  while ((c = getopt_long (argc, argv, 
78                           "q"  /* quiet or silent */
79                           "v"  /* verbose */
80                           "h"  /* help */
81                           "V", /* version */
82                           long_options, (int *) 0)) != EOF)
83    {
84      switch (c)
85        {
86        case 'q':               /* --quiet, --silent */
87          want_quiet = 1;
88          break;
89        case 'V':
90          printf ("orxonox %s\n", VERSION);
91          exit (0);
92
93        case 'h':
94          usage (0);
95
96        default:
97          usage (EXIT_FAILURE);
98        }
99    }
100
101  return optind;
102}
103
104
105static void
106usage (int status)
107{
108  printf (_("%s - \
109the future of 3D-vertical-scrollers\n"), program_name);
110  printf (_("Usage: %s [OPTION]... [FILE]...\n"), program_name);
111  printf (_("\
112Options:
113  -q, --quiet, --silent      inhibit usual output
114  --verbose                  print more information
115  -h, --help                 display this help and exit\n\
116  -V, --version              output version information and exit\n\
117"));
118  exit (status);
119}
Note: See TracBrowser for help on using the repository browser.