~ubuntu-branches/ubuntu/wily/gargoyle-free/wily-proposed

« back to all changes in this revision

Viewing changes to terps/geas/geasglkterm.c

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Beucler
  • Date: 2009-09-11 20:09:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090911200943-idgzoyupq6650zpn
Tags: upstream-2009-08-25
ImportĀ upstreamĀ versionĀ 2009-08-25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*$Id: //depot/prj/geas/master/code/geasglkterm.c#4 $
 
2
  geasglkterm.c
 
3
 
 
4
  Bridge file between Geas and GlkTerm.  Only needed if using GlkTerm.
 
5
 
 
6
  Copyright (C) 2006 David Jones.  Distribution or modification in any
 
7
  form permitted.
 
8
 
 
9
  Unix specific (see the call to close()).
 
10
*/
 
11
 
 
12
#include <stddef.h>
 
13
#include <string.h>
 
14
 
 
15
#include <unistd.h>
 
16
 
 
17
#include "glk.h"
 
18
#include "glkstart.h"
 
19
 
 
20
const char *storyfilename = NULL;
 
21
int use_inputwindow = 0;
 
22
 
 
23
glkunix_argumentlist_t glkunix_arguments[] = {
 
24
    { "-w", glkunix_arg_NoValue,    "-w:       Use a separate input window."},
 
25
    { "", glkunix_arg_ValueFollows, "filename: The game file to load."},
 
26
    { NULL, glkunix_arg_End, NULL }
 
27
};
 
28
 
 
29
int
 
30
glkunix_startup_code(glkunix_startup_t *data)
 
31
{
 
32
  int i = 1;
 
33
 
 
34
  if (data->argc > 1 && strcmp (data->argv[i], "-w") == 0) {
 
35
      use_inputwindow = 1;
 
36
      i++;
 
37
  }
 
38
 
 
39
#ifdef GARGLK
 
40
  garglk_set_program_name("Geas 0.4");
 
41
  garglk_set_program_info(
 
42
        "Geas 0.4 by Mark Tilford and David Jones.\n"
 
43
        "Additional Glk support by Simon Baldwin.");
 
44
#endif
 
45
 
 
46
  if (i == data->argc - 1) {
 
47
      storyfilename = data->argv[i];
 
48
#ifdef GARGLK
 
49
      char *s = strrchr(storyfilename, '/');
 
50
      if (!s) s = strrchr(storyfilename, '\\');
 
51
      garglk_set_story_name(s ? s + 1 : storyfilename);
 
52
#endif
 
53
  }
 
54
 
 
55
  return 1;
 
56
}