Index: .cvsignore =================================================================== RCS file: /usr/cvsroot/gastman/.cvsignore,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 .cvsignore --- .cvsignore 24 Feb 2003 06:00:37 -0000 1.1.1.1 +++ .cvsignore 22 Mar 2003 21:23:06 -0000 @@ -1 +1,5 @@ gastman +gastman.o +gtklink.o +gui.o +md5.o Index: Makefile =================================================================== RCS file: /usr/cvsroot/gastman/Makefile,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 Makefile --- Makefile 11 Mar 2003 06:00:38 -0000 1.1.1.2 +++ Makefile 22 Mar 2003 21:23:06 -0000 @@ -7,13 +7,15 @@ # # For GTK 1.2 # -GTKFLAGS=$(shell if [ -z "$(GTK2FLAGS)" ]; then echo `gtk-config --cflags`; else echo $(GTK2FLAGS); fi) -GTKLIBS=$(shell if [ -z "$(GTK2LIBS)" ]; then echo `gtk-config --libs`; else echo $(GTK2LIBS); fi) +GTKFLAGS=$(shell if [ -z "$(GTK2FLAGS)" ]; then echo `gtk12-config --cflags`; else echo $(GTK2FLAGS); fi) +GTKLIBS=$(shell if [ -z "$(GTK2LIBS)" ]; then echo `gtk12-config --libs`; else echo $(GTK2LIBS); fi) #GTKFLAGS=$(shell gtk-config --cflags) #GTKLIBS=$(shell gtk-config --libs) -CFLAGS=-Wall -g $(GTKFLAGS) -Iinclude -DGTK_ENABLE_BROKEN -LIBS=$(GTKLIBS) -ldb +GLIBFLAGS=$(shell echo `glib12-config --cflags`) + +CFLAGS=-Wall -g $(GTKFLAGS) $(GLIBFLAGS) -Iinclude -DGTK_ENABLE_BROKEN +LIBS=$(GTKLIBS) $(shell if [ -f /etc/master.passwd ]; then echo ""; else echo "-ldb "; fi) LIBS+=$(shell if [ -f /usr/lib/libgdk_pixbuf.so ]; then echo -lgdk_pixbuf ; fi) OBJS=gastman.o gui.o gtklink.o md5.o @@ -28,8 +30,10 @@ for x in art/*.xpm; do \ install -m 644 $$x $(INSTALL_PREFIX)/usr/share/gastman/icons/`basename $$x`; \ done + clean: rm -f *.o gastman gastman: $(OBJS) - $(CC) -o gastman $(OBJS) $(LIBS) + $(CC) -o gastman $(OBJS) $(GLIBFLAGS) $(LIBS) + Index: gastman.c =================================================================== RCS file: /usr/cvsroot/gastman/gastman.c,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 gastman.c --- gastman.c 11 Mar 2003 06:00:38 -0000 1.1.1.3 +++ gastman.c 22 Mar 2003 21:23:07 -0000 @@ -10,6 +10,9 @@ */ #ifndef _WIN32 +#ifdef __FreeBSD__ +#include +#endif #include #include #include Index: gui.c =================================================================== RCS file: /usr/cvsroot/gastman/gui.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 gui.c --- gui.c 12 Feb 2003 13:59:25 -0000 1.1.1.1 +++ gui.c 22 Mar 2003 21:23:08 -0000 @@ -572,7 +572,11 @@ key.size = strlen(cur->ident) + 1; data.data = tmp; data.size = strlen(tmp) + 1; +#ifdef __FreeBSD__ + if ((res = db->put(db, &key, &data, 0))) +#else if ((res = db->put(db, NULL, &key, &data, 0))) +#endif fprintf(stderr, "Unable to save '%s' location\n", cur->ident); } @@ -723,7 +727,11 @@ memset(&data, 0, sizeof(data)); key.data = obj->ident; key.size = strlen(obj->ident) + 1; +#ifdef __FreeBSD__ + if (!(res = db->get(db, &key, &data, 0))) { +#else if (!(res = db->get(db, NULL, &key, &data, 0))) { +#endif if (((char *)data.data)[data.size - 1] != '\0') fprintf(stderr, "Not null terminated?!? (%s, %d)\n", (char *)data.data, data.size); else if (sscanf((char *)data.data, "%d:%d", &x, &y) != 2) @@ -807,6 +815,10 @@ char *fn = loc_file(); int res; if (fn) { +#ifdef __FreeBSD__ + if (!(db = dbopen(NULL, O_CREAT | O_RDWR, 0664, DB_BTREE, NULL))) { + fprintf(stderr, "Unable to open db\n"); +#else if (!(res = db_create(&db, NULL, 0))) { if ((res = db->open(db, fn,NULL, DB_BTREE, DB_CREATE, 0664))) fprintf(stderr, "Unable to open db: %s\n", db_strerror(res)); @@ -814,6 +826,7 @@ fprintf(stderr, "Unable to create db: %s\n", db_strerror(res)); db->close(db, 0); db = NULL; +#endif } } gtk_init(argc, argv); @@ -1368,11 +1381,18 @@ key.size = strlen(tmp2) + 1; data.data = tmp; data.size = strlen(tmp) + 1; +#ifdef __FreeBSD__ + if ((res = db->put(db, &key, &data, 0))) +#else if ((res = db->put(db, NULL, &key, &data, 0))) +#endif fprintf(stderr, "Unable to save window location\n"); } +#ifdef __FreeBSD__ + db->close(db); +#else db->close(db, 0); - +#endif } gtk_exit(0); return 0; @@ -1788,7 +1808,11 @@ snprintf(tmp2, sizeof(tmp2), "[%s]window", gastman_curhost()); key.data = tmp2; key.size = strlen(tmp2) + 1; +#ifdef __FreeBSD__ + if (!(res = db->get(db, &key, &data, 0))) { +#else if (!(res = db->get(db, NULL, &key, &data, 0))) { +#endif if (((char *)data.data)[data.size - 1] != '\0') fprintf(stderr, "Not null terminated?!?\n"); else if (sscanf((char *)data.data, "%d:%d", &xwin, &ywin) != 2)