Index: barnowl
===================================================================
--- barnowl	(revision de18326f12c18fd92f275bf46bca509343b79063)
+++ barnowl	(revision b14f8cb653b1fe2fceef27a11f94daf59dbf3f9d)
@@ -7,10 +7,12 @@
 EXE="$0.bin"
 
-if ! test -x "$EXE"; then
+if test ! -x "$EXE"; then
     echo "Cannot find barnowl.bin" >&2
     exit 1
 fi
 
-export BARNOWL_DATA_DIR="$SRCDIR/perl/"
-export BARNOWL_BIN_DIR="$SRCDIR/"
+BARNOWL_DATA_DIR="$SRCDIR/perl/"
+BARNOWL_BIN_DIR="$SRCDIR/"
+export BARNOWL_DATA_DIR
+export BARNOWL_BIN_DIR
 exec "$EXE" "$@"
Index: cmd.c
===================================================================
--- cmd.c	(revision 4c7c21f786a0416a755645b78db0b851f75f8748)
+++ cmd.c	(revision aad166ad0f5eceb67f7f3b3f5866425dc5305b24)
@@ -5,6 +5,4 @@
 #include "owl.h"
 
-extern const owl_cmd commands_to_init[];
-
 /**************************************************************************/
 /***************************** COMMAND DICT *******************************/
@@ -13,6 +11,5 @@
 int owl_cmddict_setup(owl_cmddict *cd) {
   owl_cmddict_init(cd);
-  if (0 != owl_cmddict_add_from_list(cd, commands_to_init)) return(-1);
-  return(0);
+  return owl_cmd_add_defaults(cd);
 }
 
Index: commands.c
===================================================================
--- commands.c	(revision b9d22f7e2565410f576612a2516c57b1c6a6b17b)
+++ commands.c	(revision 117c21c0235aa38aa0cca39aeddf3fdddbe2c317)
@@ -8,39 +8,41 @@
 /* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */
 #define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \
-        { name, summary, usage, description, ctx, \
+        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
           NULL, fn, NULL, NULL, NULL, NULL, NULL, NULL }
 
 /* fn is "void foo(void)" */
 #define OWLCMD_VOID(name, fn, ctx, summary, usage, description) \
-        { name, summary, usage, description, ctx, \
+        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
           NULL, NULL, fn, NULL, NULL, NULL, NULL, NULL }
 
 /* fn is "void foo(int)" */
 #define OWLCMD_INT(name, fn, ctx, summary, usage, description) \
-        { name, summary, usage, description, ctx, \
+        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
           NULL, NULL, NULL, fn, NULL, NULL, NULL, NULL }
 
 #define OWLCMD_ALIAS(name, actualname) \
-        { name, OWL_CMD_ALIAS_SUMMARY_PREFIX actualname, "", "", OWL_CTX_ANY, \
-          actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+        { g_strdup(name), g_strdup(OWL_CMD_ALIAS_SUMMARY_PREFIX actualname), g_strdup(""), g_strdup(""), OWL_CTX_ANY, \
+          g_strdup(actualname), NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 
 /* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */
 #define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \
-        { name, summary, usage, description, ctx, \
+        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
           NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL }
 
 /* fn is "void foo(void)" */
 #define OWLCMD_VOID_CTX(name, fn, ctx, summary, usage, description) \
-        { name, summary, usage, description, ctx, \
+        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
           NULL, NULL, NULL, NULL, NULL, ((void(*)(void*))(fn)), NULL, NULL }
 
 /* fn is "void foo(int)" */
 #define OWLCMD_INT_CTX(name, fn, ctx, summary, usage, description) \
-        { name, summary, usage, description, ctx, \
+        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
           NULL, NULL, NULL, NULL, NULL, NULL, ((void(*)(void*,int))fn), NULL }
 
 
-const owl_cmd commands_to_init[]
-  = {
+int owl_cmd_add_defaults(owl_cmddict *cd)
+{
+  owl_cmd commands_to_init[] = {
+
   OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY,
 	      "send a login or logout notification",
@@ -1036,5 +1038,12 @@
   { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 
-};
+  };
+
+  int ret = owl_cmddict_add_from_list(cd, commands_to_init);
+  owl_cmd *cmd;
+  for (cmd = commands_to_init; cmd->name != NULL; cmd++)
+    owl_cmd_cleanup(cmd);
+  return ret;
+}
 
 void owl_command_info(void)
Index: configure.ac
===================================================================
--- configure.ac	(revision db4f7c3971ebebc3047c4f7d8ad15232b6e0f486)
+++ configure.ac	(revision 9d43dcc114c45fb1d94dec67eb38456bded0dc0d)
@@ -8,4 +8,5 @@
 
 AC_PROG_CC
+AC_PROG_CC_C99
 
 AC_ARG_WITH([stack-protector],
@@ -80,6 +81,5 @@
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_HEADER_STDBOOL
-AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h)
+AC_CHECK_HEADERS(stdbool.h strings.h sys/ioctl.h sys/filio.h unistd.h)
 
 dnl Add CFLAGS for embeded perl
@@ -130,4 +130,5 @@
 AX_CFLAGS_WARN_ALL([AM_CFLAGS])
 AX_C_CHECK_FLAG([-Wstrict-prototypes],[],[],[AM_CFLAGS="$AM_CFLAGS -Wstrict-prototypes"])
+AX_C_CHECK_FLAG([-Wwrite-strings],[],[],[AM_CFLAGS="$AM_CFLAGS -Wwrite-strings"])
 
 dnl Shut gcc up about zero-length format strings; the warning's apparently for
@@ -143,5 +144,5 @@
                                  test "$HAVE_DES_ECB_ENCRYPT"])
 
-AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=500"
+AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600"
 dnl Define _BSD_SOURCE because zephyr needs caddr_t.
 AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE"
Index: libfaim/aim.h
===================================================================
--- libfaim/aim.h	(revision 63de71c9b2d28eacc7b3d3d3c8f9cd3c561e8a9d)
+++ libfaim/aim.h	(revision fe73d0c8bf42966a7f576c0ee9158753d7685592)
@@ -18,15 +18,5 @@
 
 #include "config.h"
-#ifdef HAVE_STDBOOL_H
 #include <stdbool.h>
-#else
-#ifndef HAVE__BOOL
-#define _Bool signed char
-#endif
-#define bool _Bool
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-#endif  /* HAVE_STDBOOL_H */
 
 #include <stdio.h>
Index: owl.h
===================================================================
--- owl.h	(revision c5c56862661bd0620b4ac76332d0be3522a6d28b)
+++ owl.h	(revision c5c56862661bd0620b4ac76332d0be3522a6d28b)
@@ -14,17 +14,8 @@
 #include "compat/compat.h"
 
-#ifdef HAVE_STDBOOL_H
 #include <stdbool.h>
-#else
-#ifndef HAVE__BOOL
-#define _Bool signed char
-#endif
-#define bool _Bool
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-#endif  /* HAVE_STDBOOL_H */
 
 #ifndef OWL_PERL
+#define NCURSES_ENABLE_STDBOOL_H 1
 #include <curses.h>
 #include <panel.h>
@@ -238,5 +229,5 @@
   void *pval_default;  /* for types other and string */
   int   ival_default;  /* for types int and bool     */
-  char *validsettings;		/* documentation of valid settings */
+  const char *validsettings;	/* documentation of valid settings */
   char *summary;		/* summary of usage */
   char *description;		/* detailed description */
Index: perlconfig.c
===================================================================
--- perlconfig.c	(revision f21bc36d3c2f7832115e83c340991128fcab2261)
+++ perlconfig.c	(revision f21bc36d3c2f7832115e83c340991128fcab2261)
@@ -215,4 +215,5 @@
       owl_message_set_zwriteline(m, val);
     } else if (!strcmp(key, "time")) {
+      g_free(m->timestr);
       m->timestr = g_strdup(val);
       strptime(val, "%a %b %d %T %Y", &tm);
@@ -492,5 +493,5 @@
   PUTBACK;
 
-  call_pv("BarnOwl::Hooks::_new_command", G_SCALAR|G_VOID|G_EVAL);
+  call_pv("BarnOwl::Hooks::_new_command", G_VOID|G_EVAL);
 
   SPAGAIN;
Index: scripts/locker-build
===================================================================
--- scripts/locker-build	(revision 0fd5bd5b752dc0f63b57b5dbc92888f10736c27a)
+++ scripts/locker-build	(revision 4f5e38f21e47c38220a1df0800c3cbbf76df8510)
@@ -102,6 +102,6 @@
     esac
 
-    CFLAGS="-I$BARNOWL/include" \
-        LDFLAGS="-L$BARNOWL/lib $opt_rpath$BARNOWL/lib" \
+    CPPFLAGS="-I$BARNOWL/include -I/usr/athena/include" \
+        LDFLAGS="-L$BARNOWL/lib -L/usr/athena/lib $opt_rpath$BARNOWL/lib" \
         ./configure --exec-prefix="/mit/barnowl/arch/$ATHENA_SYS" \
         --prefix="/mit/barnowl/builds/barnowl-$VERS" --mandir=/mit/barnowl/man \
Index: select.c
===================================================================
--- select.c	(revision f0d5ef52c48abd4954c21397e5fba9605d8f713f)
+++ select.c	(revision f0d5ef52c48abd4954c21397e5fba9605d8f713f)
@@ -17,4 +17,5 @@
   if (loop) {
     g_main_loop_quit(loop);
+    g_main_loop_unref(loop);
     loop = NULL;
   }
Index: tester.c
===================================================================
--- tester.c	(revision 4c7c21f786a0416a755645b78db0b851f75f8748)
+++ tester.c	(revision 4e37d563a402f9cd571a92fc4e2862c58fe3c51a)
@@ -32,4 +32,5 @@
   char *perlerr;
   int status = 0;
+  SCREEN *screen;
 
   if (argc <= 1) {
@@ -41,5 +42,5 @@
   wnull = fopen("/dev/null", "w");
   rnull = fopen("/dev/null", "r");
-  newterm("xterm", wnull, rnull);
+  screen = newterm("xterm", wnull, rnull);
   /* initialize global structures */
   owl_global_init(&g);
@@ -91,4 +92,5 @@
   /* probably not necessary, but tear down the screen */
   endwin();
+  delscreen(screen);
   fclose(rnull);
   fclose(wnull);
@@ -218,6 +220,6 @@
   owl_string_appendf_quoted(g, "%q foo %q%q %s %", "hello", "world is", "can't");
   FAIL_UNLESS("owl_string_appendf",
-              !strcmp(g_string_free(g, false),
-                      "hello foo 'world is'\"can't\" %s %"));
+              !strcmp(g->str, "hello foo 'world is'\"can't\" %s %"));
+  g_string_free(g, true);
 
   /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
@@ -230,5 +232,6 @@
   owl_list l;
   int numfailed=0;
-  char *av="aval", *bv="bval", *cv="cval", *dv="dval";
+  char *av = g_strdup("aval"), *bv = g_strdup("bval"), *cv = g_strdup("cval"),
+    *dv = g_strdup("dval");
 
   printf("# BEGIN testing owl_dict\n");
@@ -259,4 +262,9 @@
   owl_list_cleanup(&l, g_free);
   owl_dict_cleanup(&d, NULL);
+
+  g_free(av);
+  g_free(bv);
+  g_free(cv);
+  g_free(dv);
 
   /*  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n"); */
Index: variable.c
===================================================================
--- variable.c	(revision 89fe67e8ef88e425a2eefc618f7279ddd77e1a69)
+++ variable.c	(revision 9efc1548ab2dc2472510012ea9e9a0eebff50b98)
@@ -7,29 +7,29 @@
 
 #define OWLVAR_BOOL(name,default,summary,description) \
-        { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_BOOL, NULL, default, "on,off", g_strdup(summary), g_strdup(description), NULL, \
         NULL, NULL, NULL, NULL, NULL, NULL }
 
 #define OWLVAR_BOOL_FULL(name,default,summary,description,validate,set,get) \
-        { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_BOOL, NULL, default, "on,off", g_strdup(summary), g_strdup(description), NULL, \
         validate, set, NULL, get, NULL, NULL }
 
 #define OWLVAR_INT(name,default,summary,description) \
-        { name, OWL_VARIABLE_INT, NULL, default, "<int>", summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, "<int>", g_strdup(summary), g_strdup(description), NULL, \
         NULL, NULL, NULL, NULL, NULL, NULL }
 
 #define OWLVAR_INT_FULL(name,default,summary,description,validset,validate,set,get) \
-        { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \
         validate, set, NULL, get, NULL, NULL }
 
 #define OWLVAR_PATH(name,default,summary,description) \
-        { name, OWL_VARIABLE_STRING, default, 0, "<path>", summary,description,  NULL, \
+        { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, "<path>", g_strdup(summary), g_strdup(description),  NULL, \
         NULL, NULL, NULL, NULL, NULL, NULL }
 
 #define OWLVAR_STRING(name,default,summary,description) \
-        { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, "<string>", g_strdup(summary), g_strdup(description), NULL, \
         NULL, NULL, NULL, NULL, NULL, NULL }
 
 #define OWLVAR_STRING_FULL(name,default,validset,summary,description,validate,set,get) \
-        { name, OWL_VARIABLE_STRING, default, 0, validset, summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, validset, g_strdup(summary), g_strdup(description), NULL, \
         validate, set, NULL, get, NULL, NULL }
 
@@ -38,5 +38,5 @@
  * correspond to the values that may be specified. */
 #define OWLVAR_ENUM(name,default,summary,description,validset) \
-        { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \
         owl_variable_enum_validate, \
         NULL, owl_variable_enum_set_fromstring, \
@@ -45,5 +45,5 @@
 
 #define OWLVAR_ENUM_FULL(name,default,summary,description,validset,validate, set, get) \
-        { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \
+        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \
         validate, \
         set, owl_variable_enum_set_fromstring, \
@@ -51,5 +51,7 @@
         NULL }
 
-static owl_variable variables_to_init[] = {
+int owl_variable_add_defaults(owl_vardict *vd)
+{
+  owl_variable variables_to_init[] = {
 
   OWLVAR_STRING( "personalbell" /* %OwlVarStub */, "off",
@@ -439,5 +441,12 @@
     NULL, NULL, NULL, NULL, NULL, NULL }
 
-};
+  };
+
+  int ret = owl_variable_dict_add_from_list(vd, variables_to_init);
+  owl_variable *var;
+  for (var = variables_to_init; var->name != NULL; var++)
+    owl_variable_cleanup(var);
+  return ret;
+}
 
 /**************************************************************************/
@@ -557,6 +566,11 @@
 
 int owl_variable_dict_setup(owl_vardict *vd) {
+  owl_dict_create(vd);
+  return owl_variable_add_defaults(vd);
+}
+
+int owl_variable_dict_add_from_list(owl_vardict *vd, owl_variable *variables_to_init)
+{
   owl_variable *var, *cur;
-  owl_dict_create(vd);
   for (var = variables_to_init; var->name != NULL; var++) {
     cur = g_new(owl_variable, 1);
@@ -583,4 +597,5 @@
       if (!cur->delete_fn)
 	cur->delete_fn = owl_variable_delete_default;
+      cur->pval_default = g_strdup(var->pval_default);
       cur->set_fn(cur, cur->pval_default);
       break;
@@ -717,5 +732,5 @@
 }
 
-void owl_variable_delete(owl_variable *v)
+void owl_variable_cleanup(owl_variable *v)
 {
   if (v->delete_fn) v->delete_fn(v);
@@ -723,4 +738,11 @@
   g_free(v->summary);
   g_free(v->description);
+  if (v->type == OWL_VARIABLE_STRING)
+    g_free(v->pval_default);
+}
+
+void owl_variable_delete(owl_variable *v)
+{
+  owl_variable_cleanup(v);
   g_free(v);
 }
Index: window.h
===================================================================
--- window.h	(revision 4cc49bce5bdc20cd8da2b4e305f60d04ae879d4f)
+++ window.h	(revision fe73d0c8bf42966a7f576c0ee9158753d7685592)
@@ -5,15 +5,5 @@
 #include <glib-object.h>
 
-#ifdef HAVE_STDBOOL_H
 #include <stdbool.h>
-#else
-#ifndef HAVE__BOOL
-#define _Bool signed char
-#endif
-#define bool _Bool
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-#endif  /* HAVE_STDBOOL_H */
 
 G_BEGIN_DECLS
Index: zcrypt.c
===================================================================
--- zcrypt.c	(revision 3b8a563ae4e07b1064fe005714793565ac720dc4)
+++ zcrypt.c	(revision 5b197f71370f5a5b3c3c09935c5679d6c90fa4c2)
@@ -11,5 +11,4 @@
 #include <unistd.h>
 #include <sys/types.h>
-#include <zephyr/zephyr.h>
 #include <glib.h>
 #include <string.h>
