summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mg/dired.c2
-rw-r--r--usr.bin/mg/fileio.c43
-rw-r--r--usr.bin/mg/sysdef.h10
3 files changed, 9 insertions, 46 deletions
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c
index 4c7ce9d3372..11111e3f810 100644
--- a/usr.bin/mg/dired.c
+++ b/usr.bin/mg/dired.c
@@ -188,7 +188,7 @@ int f, n;
}
if((stat = eread("Rename %s to: ", toname, NFILEN, EFNEW | EFCR, frname))
!= TRUE) return stat;
- return Xrename(frname, toname) >= 0;
+ return rename(frname, toname) >= 0;
}
#endif
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 52358e8d154..e2fa01f40fb 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,5 +1,5 @@
/*
- * sys V fileio.c
+ * POSIX fileio.c
*/
#include "def.h"
@@ -304,9 +304,6 @@ register char *fn;
#ifndef NO_STARTUP
#include <sys/file.h>
-#ifndef F_OK
-#define F_OK 04 /* for stupid Sys V */
-#endif
/*
* Find a startup file for the user and return its name. As a service
@@ -348,6 +345,7 @@ notfound:
#endif
#ifndef NO_DIRED
+#include <sys/wait.h>
#include "kbd.h"
/*
@@ -438,43 +436,6 @@ register char *fn;
cp[llength(lp) - 56] = '\0';
return lgetc(lp, 2) == 'd';
}
-
-/*
- * I, a System V novice, could only figure out how to do unlinkdir()
- * and rename() as exec's of the appropriate functions. So sue me.
- * --Stephen Walton, December 1987
- */
-
-unlinkdir(f)
-char *f;
-{
- int status, pid, wpid;
-
- if ((pid = fork()) == 0)
- execl("/bin/rmdir", "rmdir", f, (char *)NULL);
- else if (pid > 0)
- while ((wpid = wait(&status)) && wpid != pid)
- ;
- else
- return FALSE;
- return status == 0;
-}
-
-Xrename(f1, f2)
-char *f1, *f2;
-{
-
- int status, pid, wpid;
-
- if ((pid = fork()) == 0)
- execl("/bin/mv", "mv", f1, f2, (char *)NULL);
- else if (pid > 0)
- while ((wpid = wait(&status)) && wpid != pid)
- ;
- else
- return FALSE;
- return status == 0;
-}
#endif NO_DIRED
struct filelist {
diff --git a/usr.bin/mg/sysdef.h b/usr.bin/mg/sysdef.h
index 33d112cdd47..6da1d1937c0 100644
--- a/usr.bin/mg/sysdef.h
+++ b/usr.bin/mg/sysdef.h
@@ -8,7 +8,8 @@
#define KBLOCK 8192 /* Kill grow. */
#define GOOD 0 /* Good exit status. */
-#define MAXPATH 256 /* Maximum length of path for chdir */
+#define SYMBLINK 1 /* Handle symbolic links */
+#define MAXPATH PATH_MAX /* Maximum length of path for chdir */
typedef int RSIZE; /* Type for file/region sizes */
typedef short KCHAR; /* Type for internal keystrokes */
@@ -26,10 +27,11 @@ typedef short KCHAR; /* Type for internal keystrokes */
#define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */
#define fncmp strcmp /* file name comparison */
+#define unlinkdir(fn) rmdir(fn) /* unlink directory */
#define gettermtype() getenv("TERM") /* determine terminal type */
struct fileinfo {
- unsigned short fi_mode;
- unsigned short fi_uid;
- unsigned short fi_gid;
+ mode_t fi_mode;
+ uid_t fi_uid;
+ gid_t short fi_gid;
};