+struct state {
+ Display *dpy;
+ Window window;
+ int Width, Height;
+ GC fg_gc, bg_gc, text_fg_gc, text_bg_gc;
+ char *words;
+ int x, y;
+ XFontStruct *font;
+
+ unsigned long interval;
+ Pixmap left1, left2, right1, right2;
+ Pixmap left_front, right_front, front, down;
+
+ char *program, *orig_program;
+
+ int state; /* indicates states: walking or getting passwd */
+ int first_time;
+
+ void (*next_fn) (struct state *);
+
+ int move_length, move_dir;
+
+ int walk_lastdir;
+ int walk_up;
+ Pixmap walk_frame;
+
+ int X, Y, talking;
+
+ struct {
+ int x, y, width, height;
+ } s_rect;
+
+ char word_buf[BUFSIZ];
+};
+
+static char *get_words (struct state *);
+static void walk (struct state *, int dir);
+static void talk (struct state *, int erase);
+static void talk_1 (struct state *);
+static int think (struct state *);
+static unsigned long look (struct state *);
+
+#define IS_MOVING 1