Fixes for dtfile on OpenBSD, plus missing prototypes. Use statfs() on BSD to find...
authorPascal Stumpf <Pascal.Stumpf@cubes.de>
Fri, 10 Aug 2012 13:09:04 +0000 (15:09 +0200)
committerJon Trulson <jon@radscan.com>
Fri, 10 Aug 2012 20:13:45 +0000 (14:13 -0600)
cde/programs/dtfile/Desktop.c
cde/programs/dtfile/FileManip.c
cde/programs/dtfile/Filter.c
cde/programs/dtfile/Find.c
cde/programs/dtfile/Main.c
cde/programs/dtfile/MkDir.c
cde/programs/dtfile/SharedProcs.c
cde/programs/dtfile/SharedProcs.h
cde/programs/dtfile/Trash.c
cde/programs/dtfile/dtcopy/sharedFuncs.c

index 2619769f6422ad350a56215c0cdc0fa8194ad5ca..a090af20088a92fc10970b13ee62dfe7f8d8ecd9 100644 (file)
 #include <Xm/PushBG.h>
 #include <Xm/RowColumn.h>
 #include <Xm/CascadeBG.h>
+#include <Xm/LabelG.h>
 #include <Xm/SeparatoG.h>
 #include <Xm/VirtKeys.h>
 
index dd785d793db94ad9991f65df228c152ac8fa05e9..91f631c48a719336431e61bcdd1b03954b4e8a4d 100644 (file)
@@ -64,7 +64,7 @@
 #    define ROOTINO UFSROOTINO
 #  endif       /* sco */
 #else
-#  if defined(linux)
+#  if defined(linux) || defined(CSRG_BASED)
 #    define ROOTINO 2
 #  endif
 #  include <sys/param.h>
@@ -994,7 +994,8 @@ FileManip(
    if (lstat (to, &s2) >= 0)                      /* <to> exists */
    {
       if ((stat (to, &s3) >= 0) &&
-#if defined(__hp_osf) || (__ultrix) || defined(__osf__) || defined(linux)
+#if defined(__hp_osf) || (__ultrix) || defined(__osf__) || defined(linux) || \
+       defined(CSRG_BASED)
            (((s3.st_mode & S_IFMT) == S_IFDIR)          /* if is a directory */
            || ((s3.st_mode & S_IFMT) == S_IFSOCK)) )    /* or a net special */
 #else
index 7ff8145820a711ed2aa01ded4dd10bf1e23955b2..5ee2137e5093b93ada2feaeba7fef79a849c8397 100644 (file)
 #include "Filter.h"
 #include "Help.h"
 
+char **DtDtsDataTypeNames(void);
 
 static char * FILE_FILTER = "FileFilter";
 
index 61a6b341c55c71ab5a0917b4aa0b62d931aa28e0..094d2854ce1f04a07972a1114402b4f20ca718f0 100644 (file)
@@ -1811,7 +1811,7 @@ ExecuteFind(
    if (access_priv == -1 && geteuid() != root_user)
    {
 #else
-#  if defined(__hp_osf) || defined(__ultrix) || defined(__osf__) || defined(linux)
+#  if defined(__hp_osf) || defined(__ultrix) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
    setreuid(geteuid(),-1);
    if (access ((char *) path, R_OK) == -1)
    {
@@ -1908,10 +1908,10 @@ ExecuteFind(
 #ifdef __osf__
    oldSig = signal(SIGCHLD, sigchld_handler);
 #else
-   oldSig = signal(SIGCLD, SIG_DFL);
+   oldSig = signal(SIGCHLD, SIG_DFL);
 #endif /* __osf__ */
    find_rec->popenId = findpopen(command, "r",&(find_rec->childpid));
-   signal (SIGCLD, oldSig);
+   signal (SIGCHLD, oldSig);
 
    if (find_rec->popenId == NULL)
    {
index cba5527210bb7cea946f6dc3d5a5fa505981d0a2..caf0fc373367f35550982faa257e5fbe6fcd435f 100644 (file)
@@ -1020,7 +1020,7 @@ main(
     /* error handling follows, none for now */
         ;
 #else
-   (void) signal (SIGCLD, SIG_IGN);
+   (void) signal (SIGCHLD, SIG_IGN);
 #endif /* __osf__ */
    XtSetLanguageProc( NULL, NULL, NULL );
 
index 972050e833848f72f6aaa5b8cdebec2256695183..434c756a7b50fef87693f91f88c5ea98516bda70 100644 (file)
@@ -107,13 +107,13 @@ RunFileCommand(
   
    /* prepare to catch the command termination */
 
-   oldSig = signal (SIGCLD, SIG_DFL);
+   oldSig = signal (SIGCHLD, SIG_DFL);
 
    /* fork a process to run command */
 
    if ((child = fork ()) < 0)  /* fork failed */
    {
-      (void) signal (SIGCLD, oldSig);
+      (void) signal (SIGCHLD, oldSig);
       return (-1);
    }
 
@@ -126,7 +126,7 @@ RunFileCommand(
          wait_return = wait (&exit_value);
       } while (wait_return != child);
 
-      (void) signal (SIGCLD, oldSig); /* child stopped or terminated */
+      (void) signal (SIGCHLD, oldSig); /* child stopped or terminated */
 
       return (exit_value);      /* if exit_value == 0 then success */
    }
index 5da029456bc5407046850f4e282088e447a76ea8..333efe0873332f733e82576d0852bef7509a92ee 100644 (file)
@@ -130,6 +130,8 @@ extern XmWidgetExtData _XmGetWidgetExtData(
 #include "Main.h"
 #include "SharedProcs.h"
 
+extern char *pathcollapse();
+
 
 /* Defines */
 #define RW_ALL S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH
index ec2eae8dab7137d0bbab3e8e745696f7e837f0a6..fe5f6243a4f02ccec196bc2d679c9427ec31c3fd 100644 (file)
@@ -50,6 +50,9 @@
 
 /********    Public Function Declarations    ********/
 
+extern String _DtStripSpaces(
+                        String string) ;
+
 extern char * _DtPName(
                         register char *name) ;
 extern char * _DtFollowLink(
index a3b85e2b34570490270fb8f37951464ad5fa2235..2f7fa3d36fcd1975485dba8fec99f79178085ccd 100644 (file)
 #include <dirent.h>
 #include <unistd.h>
 #include <string.h>
+#if defined(CSRG_BASED)
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
 #include <ustat.h>
+#endif
 
 #include <Xm/RowColumn.h>
 #include <Xm/CascadeB.h>
@@ -4106,17 +4111,29 @@ CheckDeletePermission(
   char *parentdir,
   char *destinationPath)
 {
+#if defined(CSRG_BASED)
+  struct statfs statbuf;
+#else
   struct stat statbuf;
+#endif
   char fname[1024];
 
+#if defined(CSRG_BASED)
+  if (statfs(parentdir,&statbuf) < 0)  /* does not exist */
+#else
   if (lstat(parentdir,&statbuf) < 0)  /* does not exist */
+#endif
     return -1;
 
   /* check if we are root */
   if (getuid() == 0)
   {
     /* if NFS, need to check if server trusts root */
+#if defined(CSRG_BASED)
+    if (!strcmp(statbuf.f_fstypename, "nfs"))  /* Root user and nfs */
+#else
     if (FileSysType(statbuf.st_dev) < 0)  /* Root user and nfs */
+#endif
     {
        char *tmpfile;
        tmpfile = tempnam(parentdir,"quang");
@@ -4195,6 +4212,7 @@ CheckDeletePermissionRecur(
   return 0;
 }
 
+#if !defined(CSRG_BASED)
 static int
 FileSysType(
    int dev)
@@ -4204,6 +4222,7 @@ FileSysType(
      return -2;
   return u1.f_tinode;
 }
+#endif
 
 static int
 RestoreObject(
index 334c98cc5ff4f6410a45ad0677abbb410d94bd67..fa25453f16bd0cb73af4bad4eed7996df0caa222 100644 (file)
@@ -69,7 +69,7 @@
 #  define ROOTINO UFSROOTINO
 #endif
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #  include <sys/param.h>
 #  define ROOTINO 2
 #endif
 #include <stdio.h>
 #include <errno.h>
 #include <sys/types.h>
+#include <sys/mount.h>
 #include <pwd.h>
 #include <fcntl.h>
+#if !defined(CSRG_BASED)
 #include <ustat.h>
+#endif
 #include <dirent.h>
 
 
@@ -373,6 +376,7 @@ ImageInitialize( Display *display )
     return ;
 }  /*  end ImageInitialize */
 
+#if !defined(CSRG_BASED)
 static int
 CopyFileSysType(
    int dev)
@@ -382,6 +386,7 @@ CopyFileSysType(
      return -2;
   return u1.f_tinode;
 }
+#endif
 
 static int
 CopyCheckDeletePermissionRecur(
@@ -446,17 +451,29 @@ CopyCheckDeletePermission(
   char *parentdir,
   char *destinationPath)
 {
+#if defined(CSRG_BASED)
+  struct statfs statbuf;
+#else
   struct stat statbuf;
+#endif
   char fname[1024];
 
+#if defined(CSRG_BASED)
+  if (statfs(parentdir,&statbuf) < 0)  /* does not exist */
+#else
   if (lstat(parentdir,&statbuf) < 0)  /* does not exist */
+#endif
     return -1;
 
   /* check if we are root */
   if (getuid() == 0)
   {
     /* if NFS, need to check if server trusts root */
+#if defined(CSRG_BASED)
+    if (!strcmp(statbuf.f_fstypename, "nfs"))  /* Root user and nfs */
+#else
     if (CopyFileSysType(statbuf.st_dev) < 0)  /* Root user and nfs */
+#endif
     {
        char *tmpfile;
        tmpfile = tempnam(parentdir,"quang");