From 6c0e8827047b2155558c0d8eea5144fd0877fa85 Mon Sep 17 00:00:00 2001 From: tengel Date: Wed, 20 Mar 2024 09:24:54 -0500 Subject: [PATCH] gtkslash 0.5.5 --- ChangeLog | 14 +++++++++---- NEWS | 8 +------ README | 4 ++-- aclocal.m4 | 2 +- configure | 4 ++-- configure.in | 2 +- gtkslash.c | 59 ++++++++++++++++++++++++++++++++++++++-------------- 7 files changed, 60 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 672a9d6..a389fad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,17 @@ -Sun Jan 03 1999 Troy Engel - * versioned to 0.5.4 +Mon Jan 11 1999 v0.5.5 Troy Engel + * replaced non ANSI C func strsep with strtok (Sun Solaris) + * replaced getenv("HOME") with glib equiv + * functions made static (fpetitje@bureauveritas.com) + * reworked g_malloc/g_free code, probably lost some mem leaks :) + * void main -> int main + * fixed RC buffer problem (darn \0) + +Sun Jan 03 1999 v0.5.4 Troy Engel * implemented autoconf/automake support (*nix, Bruce Smith) * *nix netscape launching cleaned up * removed bad list clearing (Bruce Smith) * repackaged in standard *nix format -Sun Dec 13 1998 Troy Engel - * versioned to 0.5.3 +Sun Dec 13 1998 v0.5.3 Troy Engel * initial public release diff --git a/NEWS b/NEWS index 6ff9354..58378c1 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1 @@ -Version 0.5.4 - * autoconf/automake *nix support - * better *nix netscape support - -Version 0.5.3 - * initial public release - +See ChangeLog diff --git a/README b/README index 015dc7b..903d838 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ gtkSlash - Slashdot headlines news-ticker http://www.sonic.net/~tengel/gtkslash/ ----------------------------------------- -01/03/99, v0.5.4 +01/11/99, v0.5.5 General @@ -18,7 +18,7 @@ gtkSlash requires Gtk+ (http://www.gtk.org) and curl file retrieval, respectively. Additionally, if you want to browse a news article from within gtkSlash you'll need some sort of web browser. Currently it is working just fine with -Gtk 1.1.3 (Windows) Gtk 1.1.9 (*nix) and curl 5.3 (both). +Gtk 1.1.3 (Windows) Gtk 1.1.12 (*nix) and curl 5.4 (both). If you are on Windows, the Gtk+ version which has been used is from Tor Lillqvist; he also ports Gdk and GIMP. If you don't diff --git a/aclocal.m4 b/aclocal.m4 index 95e6ee5..87213e8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -160,7 +160,7 @@ AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" + LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK is sufficiently new. (Also sanity dnl checks the results of gtk-config to some extent diff --git a/configure b/configure index 1725c5d..6ef1b3f 100755 --- a/configure +++ b/configure @@ -526,7 +526,7 @@ else fi -GTKSLASH_VERSION=0.5.4 +GTKSLASH_VERSION=0.5.5 AUTOMAKE_OPTIONS=no-dependencies VERSION=$GTKSLASH_VERSION @@ -1097,7 +1097,7 @@ echo "configure:1084: checking for GTK - version >= $min_gtk_version" >&5 ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" + LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" diff --git a/configure.in b/configure.in index 6aa0e13..4fc1631 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script. dnl $Id$ dnl --------------------------------------------------------------------------- AC_INIT(gtkslash.c) -GTKSLASH_VERSION=0.5.4 +GTKSLASH_VERSION=0.5.5 dnl --------------------------------------------------------------------------- dnl for automake: diff --git a/gtkslash.c b/gtkslash.c index dbadc2a..c31feab 100644 --- a/gtkslash.c +++ b/gtkslash.c @@ -52,7 +52,7 @@ #define MSG_RETR_ERR "Error retrieving ultramode.txt!" #define MSG_LAUNCH "Launching web browser..." #define MSG_LAUNCH_ERR "Error launching browser!" -#define MSG_IDLE "Status: Idle (gtkSlash 0.5.4)" +#define MSG_IDLE "Status: Idle (gtkSlash 0.5.5)" /* read from RC file */ gint refresh_timeout; @@ -67,6 +67,7 @@ BOOL comments_flat; GtkWidget *status; /* retrieves a line from a linefeed delimited textfile */ +static gchar *app_getLine(FILE *file) { char *tmp, in; int cnt = 0, retIn; @@ -100,6 +101,7 @@ gchar *app_getLine(FILE *file) { } /* loads ultramode.txt into our clist */ +static BOOL app_loadFile(GtkWidget *list, const gchar *fname) { gchar *line; gchar *article[4], *link; @@ -117,15 +119,19 @@ BOOL app_loadFile(GtkWidget *list, const gchar *fname) { } /* loop till we find the first record delim */ while (strncmp(line, "%%", 2) != 0) { + g_free(line); line = app_getLine(fHnd); } gtk_clist_clear(GTK_CLIST(list)); gtk_clist_freeze(GTK_CLIST(list)); link = NULL; while (line) { + gboolean bGotit = FALSE; + g_free(line); /* should be %% */ for (i = 0 ; isort_column) { clist->sort_type = (clist->sort_type == GTK_SORT_ASCENDING) ? @@ -369,12 +391,14 @@ void app_click_column(GtkCList *clist, gint column, gpointer data) { gtk_clist_sort(clist); } +static BOOL app_parse_rc() { gchar *home_env, *fname; gint retval; - home_env = getenv("HOME"); - fname = g_malloc(sizeof(gchar) * (strlen(home_env) + 15)); + home_env = g_get_home_dir(); + /* /home/foobar + /. + myrc + \0 */ + fname = g_malloc(sizeof(gchar) * (strlen(home_env)+2+strlen(APP_RC)+1)); strcpy(fname, home_env); strcat(fname, DIR_CHAR); strcat(fname, DOT_CHAR); @@ -388,10 +412,12 @@ BOOL app_parse_rc() { #ifdef WIN32 gchar tmp[MAX_BUFF]; GetWindowsDirectory(tmp, sizeof(tmp)); - fname = g_malloc(sizeof(gchar) * (sizeof(tmp) + 1 + sizeof(APP_RC))); + /* c:\windows + \ + myrc + \0 */ + fname = g_malloc(sizeof(gchar) * (sizeof(tmp) + 1 + sizeof(APP_RC) + 1)); strcpy(fname, tmp); #else - fname = g_malloc(sizeof(gchar) * (4 + 1 + strlen(APP_RC))); + /* /etc + / + myrc + \0 */ + fname = g_malloc(sizeof(gchar) * (4 + 1 + strlen(APP_RC) + 1)); strcpy(fname, "/etc"); #endif strcat(fname, DIR_CHAR); @@ -412,6 +438,7 @@ BOOL app_parse_rc() { return retval; } +static void app_window() { GtkWidget *window, *vbox, *clist, *scrolled_win, *hbox, *but; gchar *titles[4] = {"Title", "Author", "Topic", "Comments"}; @@ -486,7 +513,7 @@ void app_window() { #ifdef WIN32 int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd) { #else -void main(int argc, char **argv) { +int main(int argc, char **argv) { #endif #ifdef WIN32 @@ -506,8 +533,7 @@ void main(int argc, char **argv) { if (argc == 1) { argv[0] = g_malloc(sizeof(char) * (len + 1)); strcpy(argv[0], lpCmdLine); - } - else { + } else { work = g_malloc(sizeof(char) * (len + 1)); strcpy(work, lpCmdLine); twrk = (char *) strtok(work, " "); @@ -526,4 +552,5 @@ void main(int argc, char **argv) { app_parse_rc(); app_window(); gtk_main(); + return(0) ; }