* Fixes for problems with the preference initialization code (Guy)
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 29 Oct 1998 15:59:00 +0000 (15:59 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 29 Oct 1998 15:59:00 +0000 (15:59 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@77 f5534014-38df-0310-8fa8-9805f1628bb7

ethereal.c
prefs.c

index fe12d4755ba1be2adf4aac966adc7b27c4ef54dd..8cdb4a12975c7a36be4654270ef6419464d51a21 100644 (file)
@@ -1,6 +1,6 @@
 /* ethereal.c
  *
- * $Id: ethereal.c,v 1.9 1998/10/28 21:38:07 gerald Exp $
+ * $Id: ethereal.c,v 1.10 1998/10/29 15:58:59 gerald Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -386,11 +386,11 @@ main(int argc, char *argv[])
   cf.snap      = 68;
   cf.count     = 0;
 
-  read_prefs();
-    
   /* Let GTK get its args */
   gtk_init (&argc, &argv);
 
+  read_prefs();
+    
   /* Now get our args */
   while ((opt = getopt(argc, argv, "b:B:c:hi:m:nP:r:s:t:T:w:v")) != EOF) {
     switch (opt) {
diff --git a/prefs.c b/prefs.c
index 92f3f06f601fe2c0345a1fb496974488a94bc00c..e18d64535f3e07802f51597fdeef9201d462e016 100644 (file)
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
 /* prefs.c
  * Routines for handling preferences
  *
- * $Id: prefs.c,v 1.8 1998/10/28 21:38:09 gerald Exp $
+ * $Id: prefs.c,v 1.9 1998/10/29 15:59:00 gerald Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -33,6 +33,9 @@
 
 #include <gtk/gtk.h>
 
+#include <ctype.h>
+#include <errno.h>
+
 #include "ethereal.h"
 #include "packet.h"
 #include "file.h"
@@ -42,7 +45,7 @@
 #include "util.h"
 
 /* Internal functions */
-static int  set_prefs(gchar*, gchar*);
+static int  set_pref(gchar*, gchar*);
 static void write_prefs();
 static void prefs_main_ok_cb(GtkWidget *, gpointer);
 static void prefs_main_save_cb(GtkWidget *, gpointer);
@@ -204,8 +207,10 @@ read_prefs() {
   }
     
   if ((pf = fopen(pf_path, "r")) == NULL) {
-    simple_dialog(ESD_TYPE_WARN, NULL,
-      "Can't open preferences file\n\"%s\".");
+    if (errno != ENOENT) {
+      simple_dialog(ESD_TYPE_WARN, NULL,
+        "Can't open preferences file\n\"%s\".", pf_path);
+    }
     return;
   }
     
@@ -333,7 +338,7 @@ write_prefs() {
     
   if ((pf = fopen(pf_path, "w")) == NULL) {
      simple_dialog(ESD_TYPE_WARN, NULL,
-      "Can't open preferences file\n\"%s\".");
+      "Can't open preferences file\n\"%s\".", pf_path);
    return;
  }