summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-15 17:52:05 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-15 17:52:05 -0700
commit410307f62b859c16bfb78a41e3582d62a26e77d7 (patch)
tree93120acab0f9cca537aa5b946ed6cbbeb45c8cda
parent04456faafc6a670a2f3b0c0aeb59b41edbc52f86 (diff)
unifdef -USYSV
Remove code for pre-POSIX System V variants that have never been supported in X11R7 modular builds. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--command.c2
-rw-r--r--miscfuncs.c78
-rw-r--r--tocutil.c4
3 files changed, 0 insertions, 84 deletions
diff --git a/command.c b/command.c
index 0e12c7f..ae411bf 100644
--- a/command.c
+++ b/command.c
@@ -32,9 +32,7 @@
#include <X11/Xpoll.h>
#include <sys/ioctl.h>
#include <signal.h>
-#ifndef SYSV
#include <sys/wait.h>
-#endif /* SYSV */
#if defined(SVR4) && !defined(DGUX)
#include <sys/filio.h>
#endif
diff --git a/miscfuncs.c b/miscfuncs.c
index 13b5f51..bead900 100644
--- a/miscfuncs.c
+++ b/miscfuncs.c
@@ -8,92 +8,14 @@
#ifndef X_NOT_POSIX
#include <dirent.h>
#else
-#ifdef SYSV
-#include <dirent.h>
-#else
#include <sys/dir.h>
#ifndef dirent
#define dirent direct
#endif
#endif
-#endif
#include <stdlib.h>
-#if defined(SYSV) && (defined(i386) || defined(MOTOROLA))
-
-/* These systems don't have the ftruncate() system call, so we emulate it.
- * This emulation can only shorten, not lengthen.
- * For convenience, we pass in the name of the file, even though the
- * real ftruncate doesn't.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#define CHUNKSIZE 1024
-
-int ftruncate_emu(
- int fd,
- off_t length,
- char *name)
-{
- char tmp_file[15];
- int new_fid, bytes_left, i;
- unsigned char buffer[CHUNKSIZE];
- struct stat stat_val;
-
- /* Open a temp file. */
- sprintf(tmp_file, ".xmhtmp%d~", getpid());
- (void) unlink(tmp_file);
- new_fid = open(tmp_file, O_RDWR | O_CREAT);
- lseek(fd, (off_t)0, 0);
-
- /* Copy original file to temp file. */
- for (i = 0; i < length / CHUNKSIZE; i++) {
- if (read(fd, buffer, CHUNKSIZE) != CHUNKSIZE) {
- (void)fprintf(stderr, "xmh: read error in ftruncate emulation\n");
- return -1;
- }
- else if (write(new_fid, buffer, CHUNKSIZE) != CHUNKSIZE) {
- (void)fprintf(stderr, "xmh: write error in ftruncate emulation\n");
- return -1;
- }
- }
- bytes_left = length % CHUNKSIZE;
- if (read(fd, buffer, bytes_left) != bytes_left) {
- (void)fprintf(stderr, "xmh: read error in ftruncate() emulation\n");
- return -1;
- }
- else if (write(new_fid, buffer, bytes_left) != bytes_left) {
- (void)fprintf(stderr, "xmh: write error in ftruncate() emulation\n");
- return -1;
- }
-
- /* Set mode of temp file to that of original file. */
- (void) fstat(fd, &stat_val);
- (void) chmod(tmp_file, stat_val.st_mode);
-
- /* Close files, delete original, rename temp file to original. */
- myclose(new_fid);
- myclose(fd);
- (void) unlink(name); /* remove original */
- (void) rename(tmp_file, name); /* rename temp file */
-
- /* If we weren't going to close the file right away in the one
- place this is called from, we'd have to do something like this:
- new_fid = myopen(name, O_RDWR, 0666);
- if (new_fid != fd) {
- dup2(new_fid, fd);
- close(new_fid);
- }
- but the file does get closed, so we don't bother. */
-
- return 0;
-}
-#endif /* SYSV variant that needs ftruncate emulation */
/*
diff --git a/tocutil.c b/tocutil.c
index eacea43..e31297c 100644
--- a/tocutil.c
+++ b/tocutil.c
@@ -493,12 +493,8 @@ void TUSaveTocFile(Toc toc)
if (fid < 0 && toc->length != toc->origlength)
fid = myopen(toc->scanfile, O_RDWR, 0666);
if (fid >= 0) {
-#if defined(SYSV) && (defined(i386) || defined(MOTOROLA))
- (void) ftruncate_emu(fid, toc->length, toc->scanfile);
-#else
(void) ftruncate(fid, toc->length);
myclose(fid);
-#endif
toc->origlength = toc->length;
}
toc->needscachesave = FALSE;