File: mmain.c

package info (click to toggle)
lmemory 0.6c-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,272 kB
  • sloc: sh: 4,797; ansic: 2,504; makefile: 37
file content (57 lines) | stat: -rw-r--r-- 1,297 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* 
 *  Linux memory game
 *  By Xiaoguang Zhang
 */

#define _GNU_SOURCE

#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include "lmemory.h"

/* Global variable definitions */
const char *indicator[5] = {"Little One","Beginner","Skilled","Master","Daemon"};
int lmem_level;
int match_card;
int same_card;
int click_count;
GtkWidget * default_pixmap[NUM];
GtkWidget * second_pixmap[NUM];
GtkWidget * button[NUM];
GtkWidget *frame;
gint lmem_state[NUM];
char *lmem_image_dir;

int
main (int argc, char *argv[])
{
  gint x, z, i, j, k;
  char buf[40];
  struct stat statbuf;


  gtk_init (&argc, &argv);

/* read LMEM_PIX_DIR environment variable first before resorting to default
  path for pixmap files --- contributed by philippe.capdepuy@libertysurf.fr */

  lmem_image_dir = getenv("LMEM_PIX_DIR");
  if (stat (lmem_image_dir, &statbuf))
      asprintf (&lmem_image_dir, "%s/pixmaps/", DATADIR);
  if (stat (lmem_image_dir, &statbuf))
      lmem_image_dir = "/usr/share/pixmaps/";
  if (stat (lmem_image_dir, &statbuf))
      lmem_image_dir = "/usr/share/icons/";
  printf ("Using `%s' for image dir\n", lmem_image_dir);

  /* create a new window and setup the pixmaps */
  lmem_setup();

  gtk_main ();

  return 0;
}