Make it work in XENIX compilers.

This commit is contained in:
2026-02-13 13:54:12 +00:00
parent fc6a0afc87
commit e7941a0d66
9 changed files with 143 additions and 1 deletions

View File

@@ -0,0 +1,72 @@
# /****************************************************************************
# Aaru Data Preservation Suite
# -----------------------------------------------------------------------------
#
# Author(s) : Natalia Portillo
#
# --[ License ] ---------------------------------------------------------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# -----------------------------------------------------------------------------
# Copyright (C) 2011-2026 Natalia Portillo
# *****************************************************************************/
# Directory with main and log source files
MAINDIR = ../../../src
# Directory with main platform source files
SRCDIR = $(MAINDIR)/unix
# Directory with subplatform source files
PLATDIR =
# Object files
OBJS = $(MAINDIR)/log.o $(MAINDIR)/main.o $(SRCDIR)/attr.o $(SRCDIR)/dirdepth.o \
$(SRCDIR)/files.o $(SRCDIR)/links.o $(SRCDIR)/perms.o $(SRCDIR)/rsrcfork.o \
$(SRCDIR)/time.o $(SRCDIR)/volume.o $(SRCDIR)/xattr.o $(SRCDIR)/deleted.o \
$(SRCDIR)/filename.o $(SRCDIR)/frag.o $(SRCDIR)/os.o $(SRCDIR)/sparse.o \
$(SRCDIR)/mkdir.o
# Source files
SOURCE = $(MAINDIR)/log.c $(MAINDIR)/main.c $(SRCDIR)/attr.c $(SRCDIR)/dirdepth.c \
$(SRCDIR)/files.c $(SRCDIR)/links.c $(SRCDIR)/perms.c $(SRCDIR)/rsrcfork.c \
$(SRCDIR)/time.c $(SRCDIR)/volume.c $(SRCDIR)/xattr.c $(SRCDIR)/deleted.c \
$(SRCDIR)/filename.c $(SRCDIR)/frag.c $(SRCDIR)/os.c $(SRCDIR)/sparse.c \
$(SRCDIR)/mkdir.c
# Header files
HEADER = $(MAINDIR)/log.h $(MAINDIR)/main.h $(SRCDIR)/perms.h $(SRCDIR)/time.h \
$(SRCDIR)/volume.h
# Outfile
OUT = fssetter
# Linker flags
LFLAGS =
# Compiler flags. This needs the definitions on how to find statfs.h as there is no autodetection
# BSD 2.11 defines statfs to be in sys/mount.h
CFLAGS = -DHAVE_SYS_MOUNT_H
all: fssetter
fssetter: $(OBJS)
$(CC) -o $@ $^ $(LFLAGS)
%.o: %.c $(HEADER)
$(CC) $(CFLAGS) -c -o $@ $<
# clean house
clean:
rm -f $(OBJS) $(OUT)

View File

@@ -0,0 +1 @@
This directory contains the Makefile for XENIX.

View File

@@ -25,6 +25,9 @@ Copyright (C) 2011-2026 Natalia Portillo
#if defined(__STDC__) /* XENIX again */
#include <stddef.h>
#endif
#if defined(M_XENIX) && !defined(M_SYSV3)
typedef long size_t;
#endif
#include <stdio.h>
#include <string.h>

View File

@@ -39,6 +39,10 @@ Copyright (C) 2011-2026 Natalia Portillo
#include "../include/defs.h"
#include "../log.h"
#if M_XENIX
typedef long size_t;
#endif
#if defined(__STDC__)
void Fragmentation(const char* path, size_t clusterSize)
#else

View File

@@ -87,9 +87,11 @@ char path;
if(ret) { log_write("Error %d creating hard link.\n", errno); }
#if !defined(M_XENIX) && !defined(COHERENT) /* Predates symlinks */
ret = symlink("TARGET", "SYMBOLIC");
if(ret) { log_write("Error %d creating symbolic link.\n", errno); }
#endif
#if defined(__APPLE__) && defined(__MACH__)
ret = mkdir("TARGETDIR", 0755);

37
setter/src/unix/mkdir.c Normal file
View File

@@ -0,0 +1,37 @@
/****************************************************************************
Aaru Data Preservation Suite
-----------------------------------------------------------------------------
Author(s) : Natalia Portillo
--[ License ] ---------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------
Copyright (C) 2011-2026 Natalia Portillo
*****************************************************************************/
#include <sys/types.h>
#include <sys/stat.h>
#if defined(__STDC__)
int mkdir(const char *path, int mode)
#else
int mkdir(path, mode)
char *path;
int mode;
#endif
{
return mknod(path, S_IFDIR | mode, 0);
}

View File

@@ -29,6 +29,10 @@ Copyright (C) 2011-2026 Natalia Portillo
typedef int mode_t;
#endif
#if defined(M_XENIX)
typedef int mode_t;
#endif
typedef struct
{
char filename[256];

View File

@@ -38,6 +38,12 @@ Copyright (C) 2011-2026 Natalia Portillo
#include <sys/stat.h>
#include <unistd.h>
#ifdef M_XENIX
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
#include "../include/consts.h"
#include "../include/defs.h"
#include "../log.h"

View File

@@ -46,9 +46,14 @@ Copyright (C) 2011-2026 Natalia Portillo
#include <sys/vfs.h>
#endif /* Rhapsody DR1 */
#endif // __NeXT__
#endif /* __NeXT__ */
#ifdef M_XENIX
#undef HAVE_SYS_STATFS_H
#undef HAVE_SYS_MOUNT_H
typedef long size_t;
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
@@ -91,6 +96,14 @@ char *path;
size_t *clusterSize;
#endif
{
#ifdef M_XENIX
log_write("Volume information:\n");
log_write("\tPath: %s\n", path);
*clusterSize = 1024;
return;
#else
#ifdef HAVE_SYS_STATVFS_H
struct statvfs buf;
#else