BeOS support.

Ryan C. Gordon icculus at clutteredmind.org
Sat Feb 23 15:27:08 EST 2002


I haven't done more than make a cursory glance at the code based on some
similar work in Candy Cruncher, but here's a patch to fix two things in
BeOS:

1) When checking the $PATH for a valid executable, make sure that the
match is a regular file (I had /boot/apps in my $PATH, which passed the
access("/boot/apps/mozilla", X_OK) test, but mozilla is a directory with
the executable bit set. Not sure why this never bit anyone else, since
it's a general Unix fix.

2) Added NetPositive (BeOS's default browser) as an "X11" browser, and
made it so that BeOS systems always think they're running X11 so they'll
try Mozilla, etc, too.

I haven't tried building this on BeOS yet, but it's a start.

--ryan.


-------------- next part --------------
Index: check.c
===================================================================
RCS file: /cvs/cvsroot/loki_setup/check.c,v
retrieving revision 1.1
diff -u -r1.1 check.c
--- check.c	2002/01/28 01:13:30	1.1
+++ check.c	2002/02/23 20:20:29
@@ -86,7 +86,10 @@
 
             /* See if it exists, and update path */
             if ( access(temppath, X_OK) == 0 ) {
-                ++found;
+                /* make sure it's not a directory... */
+                struct stat s;
+                if ((stat(temppath, &s) == 0) && (S_ISREG(s.st_mode)))
+                    ++found;
             }
             path = last+1;
 
Index: loki_launchurl.c
===================================================================
RCS file: /cvs/cvsroot/loki_setup/loki_launchurl.c,v
retrieving revision 1.3
diff -u -r1.3 loki_launchurl.c
--- loki_launchurl.c	2002/01/28 01:13:30	1.3
+++ loki_launchurl.c	2002/02/23 20:20:29
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <unistd.h>
 
 #include "loki_launchurl.h"
@@ -66,7 +67,10 @@
 
         /* See if it exists, and update path */
         if ( access(temppath, X_OK) == 0 ) {
-            ++found;
+            /* make sure it's not a directory... */
+            struct stat s;
+            if ((stat(temppath, &s) == 0) && (S_ISREG(s.st_mode)))
+                ++found;
         }
         path = last+1;
 
@@ -106,6 +110,9 @@
           "opera",
           "opera -newwindow %s &" },
         { RUNNING_X11,
+          "NetPositive",  /* this is BeOS's default browser. */
+          "NetPositive %s &" },
+        { RUNNING_X11,
           "konqueror",
           "konqueror %s &" },
         { RUNNING_X11,
@@ -124,17 +131,21 @@
           "lynx",
           "lynx %s" }
     };
-    environment running;
-    int i, status;
+    environment running = RUNNING_X11;  /* default for BeOS */
+    int i;
+    int status = -1;
     char *command;
     char command_string[4*PATH_MAX];
 
     /* Check for DISPLAY environment variable - assume X11 if exists */
+/* BeOS will default to "X11", which is a little white lie. */
+#if (!defined __BEOS__)
     if ( getenv("DISPLAY") ) {
         running = RUNNING_X11;
     } else {
         running = RUNNING_TEXT;
     }
+#endif
 
     /* See what web browser is available */
     command = getenv("LOKI_BROWSER");
@@ -150,8 +161,6 @@
     if ( command ) {
         sprintf(command_string, command, url, url);
         status = system(command_string);
-    } else {
-        status = -1;
     }
     return status;
 }


More information about the Lokisetup mailing list