~ubuntu-branches/ubuntu/saucy/cuyo/saucy

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2010-07-19 09:54:44 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100719095444-ecoegzo1vvvdwra9
Tags: 2.~-1.1.brl3-1ubuntu1
* Merge from debian unstable (LP: #607106). Remaining changes:
  - Don't register MimeType=application/x-executable in
    the .desktop file.
  - Remove UTF-8 in the .desktop file
  - 

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
 
44
44
void hilfe() {
45
 
  fprintf(stderr, _("usage: cuyo [-s] [ld-file]\n"));
46
 
  fprintf(stderr, _("  -s = small screen mode\n"));
 
45
  /* TRANSLATORS: "cuyo" is a program's name, "-s" is an option's name,
 
46
     "ld" is a file suffix. None of these should be translated. */
 
47
  fprintf(stderr, _(
 
48
    "usage: cuyo [-g <width>x<height>] [-h] [-f] [ld-file]\n"
 
49
    "  -g <width>x<height>  set window size\n"
 
50
    "  -f   fullscreen mode\n"
 
51
    "  -h   print this help message\n"
 
52
    ));
47
53
}
48
54
 
49
55
 
58
64
#if !HAVE_GETOPT
59
65
/* selbstprogrammiertes getopt()... funkioniert sehr eingeschr�nkt. */
60
66
 
 
67
 
 
68
#error Version without getopt has never been tested
 
69
 
61
70
int optind = 1;
 
71
char * optarg;
62
72
 
63
73
char getopt(int argc, char * const argv[], const char * optstring) {
64
74
  if (optind < argc && argv[optind][0] == '-') {
65
75
    char c = argv[optind++][1];
66
76
    const char * o = optstring;
67
77
    while (*o) {
68
 
      if (c == *o++) return c;
 
78
      char os = *o++;
 
79
      if (os != ':' && c == os) {
 
80
        if (*o == ':') {  /* Does the option require an argument? */
 
81
          if (argv[optind-1][2] != 0) {
 
82
            /* Argument without space, e.g. -d1 */
 
83
            optarg = &argv[optind-1][2];
 
84
          } else if (optind >= argc) {
 
85
            fprintf(stderr, _("Argument to -%c missing\n"), c);
 
86
            return '?';
 
87
          } else {
 
88
            /* Argument with space, e.g. -d 1 */
 
89
            optarg = argv[optind++];
 
90
          }
 
91
        }
 
92
        return c;
 
93
      }
69
94
    }
70
95
    fprintf(stderr, _("Unknown option '%c'\n"), c);
71
96
    return '?';
136
161
 
137
162
  /* Erst mal defaults setzen */
138
163
  gDebug = false;
139
 
  gKlein = false;
 
164
  //gKlein = false;
140
165
  gDateiUebergeben = false;
141
166
 
142
167
 
150
175
 
151
176
  /* Jetzt die --Optionen. */
152
177
 
153
 
  while ((opt_chr = getopt(argc, argv, "dsh")) != -1) {
 
178
  while ((opt_chr = getopt(argc, argv, "dhg:f")) != -1) {
154
179
    switch (opt_chr) {
155
180
      case 'd':
156
181
        gDebug = true;
157
182
        break;
158
 
      case 's':
159
 
        gKlein = true;
160
 
        break;
 
183
//       case 's':
 
184
//         //gKlein = true;
 
185
//      break;
161
186
      case 'h':
162
187
        hilfe();
163
188
        exit(0);
 
189
      case 'g': {
 
190
          int w, h;
 
191
          if (sscanf(optarg, "%dx%d", &w, &h) != 2) {
 
192
            fprintf(stderr, _("Could not parse option -g\n"));
 
193
            aufrufFehler();
 
194
          }
 
195
          UI::setGeometry(w, h);
 
196
        }
 
197
        break;
 
198
      case 'f':
 
199
        SDLTools::setFullscreen(true);
 
200
        break;
164
201
      case '?':
165
202
        aufrufFehler();
166
203
        break;
191
228
 
192
229
int main(int argc, char *argv[])
193
230
{
194
 
  
195
 
  /* Lokalisierung */
196
 
  /* PACKAGE und LOCALEDIR stammen aus config.h */
197
 
  //setlocale (LC_ALL, "");
198
 
  //bindtextdomain (PACKAGE, LOCALEDIR);
199
 
  //textdomain (PACKAGE);
200
 
 
201
 
 
 
231
 
 
232
  init_NLS();
202
233
 
203
234
  try {
 
235
 
 
236
    Version::init();
204
237
    
205
238
    /* Der Pfaditerator braucht unser 0tes Argument, um in lokalen
206
239
       Verzeichnissen nach den Daten-Dateien zu suchen. */