AR = ar
OBJ = access.o break.o chmode.o close.o create.o filesize.o \
modtime.o lock.o open.o read.o remove.o stop.o \
- system.o time.o unlock.o write.o seek.o
+ system.o time.o unlock.o write.o seek.o rename.o
CSRC = access.c break.c chmode.c close.c create.c filesize.c \
modtime.c lock.c open.c read.c remove.c stop.c \
- system.c time.c unlock.c write.c seek.c
+ system.c time.c unlock.c write.c seek.c rename.c
SRC = Makefile system.h $(CSRC)
all: $(LIBSYS)
--- /dev/null
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+int
+sys_rename(path1, path2)
+ char *path1, *path2;
+{
+ unlink(path2);
+ return link(path1, path2) == 0 &&
+ unlink(path1) == 0;
+}
+
.ad
.SH NAME
sys_open, sys_close, sys_read, sys_write, sys_reset, sys_access,
-sys_modtime, sys_remove, sys_filesize, sys_chmode,
+sys_modtime, sys_remove, sys_rename, sys_filesize, sys_chmode,
sys_lock, sys_unlock,
sys_break, sys_stop, sys_time \- system call interface
.SH SYNOPSIS
.B int sys_remove(path)
.B char *path;
.PP
+.B int sys_rename(path1, path2)
+.B char *path1, *path2;
+.PP
.B long sys_filesize(path)
.B char *path;
.PP
A non-zero return value indicates successful action whereas 0
indicates that the given file does not exist or cannot be removed.
.PP
+.I Sys_rename
+renames file
+.I path1
+to
+.IR path2 .
+A non-zero return value indicates successful action. If
+.I path2
+exists, it is removed first.
+.PP
The function
.I sys_filesize
returns the size in bytes of the
.IR sys_read ,
.IR sys_write ,
.IR sys_reset ,
-.I sys_chmode
+.IR sys_chmode ,
+.IR sys_rename ,
and
.I sys_remove
return a value of zero upon any failure and a non-zero