SOURCES = getdate.y posixtm.y \
argmatch.c backupfile.c basename.c dirname.c eaccess.c \
-error.c filemode.c fsusage.c getopt.c getopt1.c \
+error.c filemode.c fsusage.c full-write.c getopt.c getopt1.c \
getversion.c idcache.c isdir.c makepath.c \
-modechange.c mountlist.c savedir.c \
+modechange.c mountlist.c safe-read.c savedir.c \
stripslash.c xgetcwd.c xmalloc.c xstrdup.c userspec.c yesno.c \
fileblocks.c fnmatch.c ftruncate.c mkdir.c mktime.c rename.c stpcpy.c \
strdup.c strstr.c alloca.c
OBJECTS = getdate.o posixtm.o \
argmatch.o backupfile.o basename.o dirname.o eaccess.o \
-error.o filemode.o getopt.o getopt1.o \
+error.o filemode.o full-write.o getopt.o getopt1.o \
getversion.o idcache.o isdir.o makepath.o \
-modechange.o savedir.o \
+modechange.o safe-read.o savedir.o \
stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
@LIBOBJS@ @ALLOCA@
-/* safe-write.c -- an interface to write that retries after interrupts
+/* full-write.c -- an interface to write that retries after interrupts
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
#endif
/* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted.
- Return zero upon success, write's (negative) error code otherwise. */
+ Return LEN upon success, write's (negative) error code otherwise. */
int
-safe_write (desc, ptr, len)
+full_write (desc, ptr, len)
int desc;
char *ptr;
int len;
{
+ int total_written;
+
+ total_written = 0;
while (len > 0)
{
int written = write (desc, ptr, len);
#endif
return written;
}
+ total_written += written;
ptr += written;
len -= written;
}
- return 0;
+ return total_written;
}