I ported rsync-2.5.5 a few years ago:
Below and attached is the diff from the original rsync-2.5.5.tar.gz.
I also created /usr/local/bin/rsync.sh since we put rsync in a non-standard
location:
----------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
# This is a script to help provide a wrapper around rsync for usability reasons
/usr/local/bin/rsync -e ssh --rsync-path=/usr/local/bin/rsync "$@"
exit $?
# example:
# rsync.sh -av --delete --dry-run zxmvs01@z001:/area/host/lsm/products/
/area/host/lsm/products
# rsync.sh -a --delete --stats --progress --one-file-system /u/<FS_NAME>/
/u/plc5611/tmp/<FS_NAME>
----------------------------------------------------------------------------------------------------------------------------
diff -cr rsync-2.5.5/Makefile.in rsync-2.5.5-new/Makefile.in
*** rsync-2.5.5/Makefile.in Mon Mar 25 05:36:56 2002
--- rsync-2.5.5-new/Makefile.in Wed May 15 11:32:50 2002
***************
*** 24,35 ****
.SUFFIXES: .c .o
LIBOBJ=lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
! lib/permstring.o \
! @LIBOBJS@
ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
zlib/zutil.o zlib/adler32.o
! OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o
main.o checksum.o match.o syscall.o log.o backup.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o
fileio.o batch.o \
clientname.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o
authenticate.o
--- 24,34 ----
.SUFFIXES: .c .o
LIBOBJ=lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
! lib/permstring.o @LIBOBJS@
ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
zlib/zutil.o zlib/adler32.o
! OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o
main.o checksum.o match.o syscall.o log.o backup.o cpconv.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o
fileio.o batch.o \
clientname.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o
authenticate.o
***************
*** 45,51 ****
# note that the -I. is needed to handle config.h when using VPATH
.c.o:
@OBJ_SAVE@
! $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< @CC_SHOBJ_FLAG@
@OBJ_RESTORE@
all: rsync
--- 45,51 ----
# note that the -I. is needed to handle config.h when using VPATH
.c.o:
@OBJ_SAVE@
! $(CC) -I. -I$(srcdir) $(CFLAGS) @CC_SHOBJ_FLAG@ -c $<
@OBJ_RESTORE@
all: rsync
diff -cr rsync-2.5.5/lib/getaddrinfo.c rsync-2.5.5-new/lib/getaddrinfo.c
*** rsync-2.5.5/lib/getaddrinfo.c Fri Dec 14 06:33:12 2001
--- rsync-2.5.5-new/lib/getaddrinfo.c Tue May 14 14:12:24 2002
***************
*** 259,266 ****
--- 259,278 ----
/* error check for hints */
if (hints->ai_addrlen || hints->ai_canonname ||
hints->ai_addr || hints->ai_next)
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390 Open Edition, use
EAI_MAX
+ */
+ ERR(EAI_MAX); /* xxx */
+ #else
ERR(EAI_BADHINTS); /* xxx */
+ #endif
+ #if defined(__MVS__)
+ /* when compiling on OS390 Open Edition AI_MASK appears to be */
+ /* undefined, include expansion literally here */
+ if (hints->ai_flags & ~(AI_PASSIVE | AI_CANONNAME |
AI_NUMERICHOST))
+ #else
if (hints->ai_flags & ~AI_MASK)
+ #endif
ERR(EAI_BADFLAGS);
switch (hints->ai_family) {
case PF_UNSPEC:
***************
*** 294,306 ****
--- 306,330 ----
case SOCK_DGRAM:
if (pai->ai_protocol != IPPROTO_UDP &&
pai->ai_protocol != ANY)
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390 Open
Edition, use
+ EAI_MAX */
+ ERR(EAI_MAX); /*xxx*/
+ #else
ERR(EAI_BADHINTS); /*xxx*/
+ #endif
pai->ai_protocol = IPPROTO_UDP;
break;
case SOCK_STREAM:
if (pai->ai_protocol != IPPROTO_TCP &&
pai->ai_protocol != ANY)
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390 Open
Edition, use
+ EAI_MAX */
+ ERR(EAI_MAX); /*xxx*/
+ #else
ERR(EAI_BADHINTS); /*xxx*/
+ #endif
pai->ai_protocol = IPPROTO_TCP;
break;
default:
***************
*** 350,356 ****
--- 374,386 ----
pai->ai_socktype = SOCK_STREAM;
pai->ai_protocol = IPPROTO_TCP;
} else
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390
Open
+ Edition, use EAI_MAX */
+ ERR(EAI_MAX); /*xxx*/
+ #else
ERR(EAI_PROTOCOL); /*xxx*/
+ #endif
}
}
}
***************
*** 401,410 ****
--- 431,450 ----
switch (afdl[i].a_af) {
case AF_INET:
v4a = ((struct in_addr *)pton)->s_addr;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop
it
+ (???) */
if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
pai->ai_flags &= ~AI_CANONNAME;
+ #endif
v4a >>= IN_CLASSA_NSHIFT;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop
it
+ (???) */
if (v4a == 0 || v4a == IN_LOOPBACKNET)
+ #else
+ if (v4a == 0)
+ #endif
pai->ai_flags &= ~AI_CANONNAME;
break;
#ifdef INET6
diff -cr rsync-2.5.5/lib/getnameinfo.c rsync-2.5.5-new/lib/getnameinfo.c
*** rsync-2.5.5/lib/getnameinfo.c Wed Dec 5 14:40:03 2001
--- rsync-2.5.5-new/lib/getnameinfo.c Tue May 14 14:08:56 2002
***************
*** 135,144 ****
--- 135,152 ----
switch (sa->sa_family) {
case AF_INET:
v4a = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop it (???) */
if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
flags |= NI_NUMERICHOST;
+ #endif
v4a >>= IN_CLASSA_NSHIFT;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop it (???) */
if (v4a == 0 || v4a == IN_LOOPBACKNET)
+ #else
+ if (v4a == 0)
+ #endif
flags |= NI_NUMERICHOST;
break;
#ifdef INET6
diff -cr rsync-2.5.5/authenticate.c rsync-2.5.5-new/authenticate.c
*** rsync-2.5.5/authenticate.c Thu Jan 24 03:33:45 2002
--- rsync-2.5.5-new/authenticate.c Thu May 16 08:20:53 2002
***************
*** 253,258 ****
--- 253,267 ----
return NULL;
}
+ #if defined(__MVS__)
+ /* translate module password read from config file to ASCII */
+ translate_buffer_to_isolatin( (unsigned char *) secret, strlen( secret
) );
+ /* The other side doesn't base64-decode the challenge but uses the
ASCII */
+ /* representation. We must do equally, so translate the b64_challenge.
*/
+ translate_buffer_to_isolatin( (unsigned char *) b64_challenge, strlen(
+ b64_challenge ) );
+ #endif
+
generate_hash(secret, b64_challenge, pass2);
memset(secret, 0, sizeof(secret));
***************
*** 281,286 ****
--- 290,304 ----
if (!pass || !*pass) {
pass = "";
}
+
+ #if defined(__MVS__)
+ /* translate console read user password to ASCII */
+ translate_buffer_to_isolatin( (unsigned char *) pass, strlen( pass ) );
+ /* The other side has worked with the ASCII base64 representation of */
+ /* the challenge. We must do equally, so translate it back to ASCII */
+ translate_buffer_to_isolatin( (unsigned char *) challenge, strlen(
challenge )
+ );
+ #endif
generate_hash(pass, challenge, pass2);
io_printf(fd, "%s %s\n", user, pass2);
diff -cr rsync-2.5.5/cpconv.c rsync-2.5.5-new/cpconv.c
*** rsync-2.5.5/cpconv.c Thu May 16 10:34:41 2002
--- rsync-2.5.5-new/cpconv.c Thu May 16 08:31:31 2002
***************
*** 0 ****
--- 1,110 ----
+ /*
+ * This table translates ISO8859-1 to EBCDIC-1047.
+ *
+ * It was generated by piping the 256 character codes
+ * 0x00...0xff through iconv -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b1, 0x9f, 0xb2, 0x6a, 0xb5,
+ 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
+ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
+ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
+ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
+ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
+ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
+ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
+ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
+ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
+ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
+ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf
+ };
+
+ /*
+ * This table translates EBCDIC-1047 to ISO8859-1.
+ *
+ * It was generated by piping the 256 character codes
+ * 0x00...0xff through iconv -f IBM-1047 -t ISO8859-1
+ */
+ static unsigned char ebcdic_to_isolatin[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
+ 0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
+ 0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
+ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
+ 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 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5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f
+ };
+
+ /*
+ * Convert buffer in place
+ */
+ static void translate_buffer( unsigned char * pConversionTable, unsigned char
*
+ pBuffer, int pLength )
+ {
+ unsigned char * lStop = pBuffer + pLength;
+
+ while (pBuffer < lStop)
+ {
+ *pBuffer = pConversionTable[*pBuffer];
+ ++pBuffer;
+ }
+ }
+
+ /*
+ * These are the exported functions
+ */
+ void translate_buffer_from_isolatin( unsigned char * pBuffer, int pLength )
+ {
+ translate_buffer( isolatin_to_ebcdic, pBuffer, pLength );
+ }
+
+ void translate_buffer_to_isolatin( unsigned char * pBuffer, int pLength )
+ {
+ translate_buffer( ebcdic_to_isolatin, pBuffer, pLength );
+ }
+
diff -cr rsync-2.5.5/exclude.c rsync-2.5.5-new/exclude.c
*** rsync-2.5.5/exclude.c Mon Feb 18 20:10:28 2002
--- rsync-2.5.5-new/exclude.c Fri May 10 14:12:39 2002
***************
*** 290,300 ****
exit_cleanup(RERR_UNSUPPORTED);
}
write_int(f,l+2);
! write_buf(f,"+ ",2);
} else {
write_int(f,l);
}
! write_buf(f,pattern,l);
}
write_int(f,0);
--- 290,300 ----
exit_cleanup(RERR_UNSUPPORTED);
}
write_int(f,l+2);
! write_sbuf(f,"+ ");
} else {
write_int(f,l);
}
! write_sbuf(f,pattern);
}
write_int(f,0);
diff -cr rsync-2.5.5/flist.c rsync-2.5.5-new/flist.c
*** rsync-2.5.5/flist.c Thu Mar 14 22:20:20 2002
--- rsync-2.5.5-new/flist.c Tue May 14 11:24:51 2002
***************
*** 265,282 ****
static int to_wire_mode(mode_t mode)
{
! if (S_ISLNK(mode) && (_S_IFLNK != 0120000)) {
! return (mode & ~(_S_IFMT)) | 0120000;
! }
! return (int) mode;
}
static mode_t from_wire_mode(int mode)
{
! if ((mode & (_S_IFMT)) == 0120000 && (_S_IFLNK != 0120000)) {
! return (mode & ~(_S_IFMT)) | _S_IFLNK;
}
! return (mode_t) mode;
}
--- 265,301 ----
static int to_wire_mode(mode_t mode)
{
! int lPortableFlags;
!
! if (S_ISLNK(mode)) lPortableFlags = 0120000;
! else if (S_ISBLK(mode)) lPortableFlags = 0060000;
! else if (S_ISCHR(mode)) lPortableFlags = 0020000;
! else if (S_ISSOCK(mode)) lPortableFlags = 0140000;
! else if (S_ISFIFO(mode)) lPortableFlags = 0010000;
! else if (S_ISDIR(mode)) lPortableFlags = 0040000;
! else if (S_ISREG(mode)) lPortableFlags = 0100000;
! else lPortableFlags = 0;
!
! return (lPortableFlags | (((int) mode) & 07777));
}
static mode_t from_wire_mode(int mode)
{
! mode_t lPlatformFlags;
!
! switch (mode & (07777 ^ -1))
! {
! case 0120000: lPlatformFlags = S_IFLNK; break;
! case 0060000: lPlatformFlags = S_IFBLK; break;
! case 0020000: lPlatformFlags = S_IFCHR; break;
! case 0140000: lPlatformFlags = S_IFSOCK; break;
! case 0010000: lPlatformFlags = S_IFIFO; break;
! case 0040000: lPlatformFlags = S_IFDIR; break;
! case 0100000: lPlatformFlags = S_IFREG; break;
! default: lPlatformFlags = 0; break;
}
!
! return (mode_t) (lPlatformFlags | (mode & 07777));
}
***************
*** 381,387 ****
write_int(f, l2);
else
write_byte(f, l2);
! write_buf(f, fname + l1, l2);
write_longint(f, file->length);
if (!(flags & SAME_TIME))
--- 400,406 ----
write_int(f, l2);
else
write_byte(f, l2);
! write_sbuf(f, fname + l1);
write_longint(f, file->length);
if (!(flags & SAME_TIME))
***************
*** 403,409 ****
#if SUPPORT_LINKS
if (preserve_links && S_ISLNK(file->mode)) {
write_int(f, strlen(file->link));
! write_buf(f, file->link, strlen(file->link));
}
#endif
--- 422,428 ----
#if SUPPORT_LINKS
if (preserve_links && S_ISLNK(file->mode)) {
write_int(f, strlen(file->link));
! write_sbuf(f, file->link);
}
#endif
diff -cr rsync-2.5.5/io.c rsync-2.5.5-new/io.c
*** rsync-2.5.5/io.c Fri Mar 22 06:14:44 2002
--- rsync-2.5.5-new/io.c Thu May 16 08:20:52 2002
***************
*** 307,312 ****
--- 307,316 ----
read_loop(fd, line, remaining);
line[remaining] = 0;
+ #if defined(__MVS__)
+ translate_buffer_from_isolatin( (unsigned char *) line,
remaining );
+ #endif
+
rprintf((enum logcode) tag, "%s", line);
remaining = 0;
}
***************
*** 377,382 ****
--- 381,391 ----
void read_sbuf(int f,char *buf,size_t len)
{
read_buf (f,buf,len);
+
+ #if defined(__MVS__)
+ translate_buffer_from_isolatin( (unsigned char *) buf, len );
+ #endif
+
buf[len] = 0;
}
***************
*** 610,618 ****
}
/* write a string to the connection */
! static void write_sbuf(int f,char *buf)
{
! write_buf(f, buf, strlen(buf));
}
--- 619,633 ----
}
/* write a string to the connection */
! void write_sbuf(int f,char *buf)
{
! int lLength = strlen(buf);
!
! #if defined(__MVS__)
! translate_buffer_to_isolatin( (unsigned char *) buf, lLength );
! #endif
!
! write_buf(f, buf, lLength );
}
***************
*** 633,639 ****
{
while (maxlen) {
buf[0] = 0;
! read_buf(f, buf, 1);
if (buf[0] == 0)
return 0;
if (buf[0] == '\n') {
--- 648,654 ----
{
while (maxlen) {
buf[0] = 0;
! read_sbuf(f, buf, 1);
if (buf[0] == 0)
return 0;
if (buf[0] == '\n') {
***************
*** 694,699 ****
--- 709,719 ----
io_flush();
stats.total_written += (len+4);
+
+ #if defined(__MVS__)
+ translate_buffer_to_isolatin( (unsigned char *) buf, len );
+ #endif
+
mplex_write(multiplex_out_fd, code, buf, len);
return 1;
}
diff -cr rsync-2.5.5/log.c rsync-2.5.5-new/log.c
*** rsync-2.5.5/log.c Mon Feb 18 20:51:12 2002
--- rsync-2.5.5-new/log.c Thu May 16 08:20:54 2002
***************
*** 94,99 ****
--- 94,104 ----
el->buf = malloc(len+4);
if (!el->buf) exit_cleanup(RERR_MALLOC);
memcpy(el->buf+4, buf, len);
+
+ #if defined(__MVS__)
+ translate_buffer_to_isolatin( (unsigned char *) el->buf+4, len );
+ #endif
+
SIVAL(el->buf, 0, ((code+MPLEX_BASE)<<24) | len);
el->len = len+4;
el->written = 0;
diff -cr rsync-2.5.5/proto.h rsync-2.5.5-new/proto.h
*** rsync-2.5.5/proto.h Mon Mar 25 04:51:17 2002
--- rsync-2.5.5-new/proto.h Thu May 16 08:20:52 2002
***************
*** 55,60 ****
--- 55,62 ----
int daemon_main(void);
void setup_protocol(int f_out,int f_in);
int claim_connection(char *fname,int max_connections);
+ void translate_buffer_from_isolatin( unsigned char * pBuffer, int pLength );
+ void translate_buffer_to_isolatin( unsigned char * pBuffer, int pLength );
int check_exclude(char *name, struct exclude_struct **local_exclude_list,
STRUCT_STAT *st);
void add_exclude_list(const char *pattern, struct exclude_struct ***list, int
include);
***************
*** 107,112 ****
--- 109,115 ----
void write_int(int f,int32 x);
void write_longint(int f, int64 x);
void write_buf(int f,char *buf,size_t len);
+ void write_sbuf(int f,char *buf);
void write_byte(int f,unsigned char c);
int read_line(int f, char *buf, size_t maxlen);
void io_printf(int fd, const char *format, ...);
diff -cr rsync-2.5.5/uidlist.c rsync-2.5.5-new/uidlist.c
*** rsync-2.5.5/uidlist.c Mon Mar 1 22:16:50 1999
--- rsync-2.5.5-new/uidlist.c Fri May 10 14:15:48 2002
***************
*** 203,209 ****
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_buf(f, list->name, len);
list = list->next;
}
--- 203,209 ----
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_sbuf(f, list->name);
list = list->next;
}
***************
*** 218,224 ****
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_buf(f, list->name, len);
list = list->next;
}
write_int(f, 0);
--- 218,224 ----
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_sbuf(f, list->name);
list = list->next;
}
write_int(f, 0);
diff -cr rsync-2.5.5/util.c rsync-2.5.5-new/util.c
*** rsync-2.5.5/util.c Wed Mar 20 02:09:49 2002
--- rsync-2.5.5-new/util.c Thu May 16 08:20:55 2002
***************
*** 853,863 ****
--- 853,903 ----
const uchar *s1 = (const uchar *)cs1;
const uchar *s2 = (const uchar *)cs2;
+ #if defined(__MVS__)
+ uchar c1;
+ uchar c2;
+ #endif
+
while (*s1 && *s2 && (*s1 == *s2)) {
s1++; s2++;
}
+ #if defined(__MVS__)
+ /*
+ *This is a horrible hack.* The problem is that send_file_list()
and
+ recv_file_list() (flist.c) *separately* sort the file list
*after*
+ it has been transmitted between the two peers. This way, if the
sort
+ yields different results on different platforms, the files get
mixed
+ up in the transfer. As stated above, this has already caused
problems
+ which were addressed by providing an own function u_strcmp()
for string
+ comparison which is it's only purpose. Alas, this implementation
+ depends on the layout of the character set used by every
platform.
+ Particulary, it yields different results on an EBCDIC machine as
+ opposed to an ASCII machine. (In EBCDIC, the character values
of the
+ uppercase letters are greater than those of the lowercase
letters,
+ and those of the numbers are the highest of all.)
+
+ The problem would better be corrected in the correct place,
that is
+ doing the sort of the file list (duplicate removal, as I
understand
+ the goal of the procedure) exactly once *before* its
transmission.
+ This would, of course, introduce an incompatibility with
existing
+ rsync servers that *do* the sort after the transmission. This
would
+ have to be handled by establishing a new protocol version.
+
+ For now, I'll keep compatibility with existing rsync servers by
+ leaving the sort where it is and converting EBCDIC to ASCII
before
+ comparing characters.
+
+ Hartmut Schaefer, May 14, 2002
+ */
+ c1 = *s1;
+ translate_buffer_to_isolatin( &c1, 1 );
+ c2 = *s2;
+ translate_buffer_to_isolatin( &c2, 1 );
+ return (int)c1 - (int)c2;
+ #else
return (int)*s1 - (int)*s2;
+ #endif
}
static OFF_T last_ofs;
diff -cr rsync-2.5.5/fileio.c rsync-2.5.5-new/fileio.c
*** rsync-2.5.5/fileio.c Sat Jan 26 00:07:34 2002
--- rsync-2.5.5-new/fileio.c Thu May 16 08:20:51 2002
***************
*** 75,80 ****
--- 75,84 ----
{
int ret = 0;
+ #if defined(__MVS__)
+ translate_buffer_from_isolatin( (unsigned char *) buf, len );
+ #endif
+
if (!sparse_files) {
return write(f,buf,len);
}
***************
*** 193,198 ****
--- 197,208 ----
has changed mid transfer! */
memset(map->p+read_offset+nread, 0, read_size - nread);
}
+
+ #if defined(__MVS__)
+ translate_buffer_to_isolatin( (unsigned char *) map->p +
read_offset,
+ read_size );
+ #endif
+
map->p_fd_offset += nread;
}
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
diff -cr rsync-2.5.5/Makefile.in rsync-2.5.5-new/Makefile.in
*** rsync-2.5.5/Makefile.in Mon Mar 25 05:36:56 2002
--- rsync-2.5.5-new/Makefile.in Wed May 15 11:32:50 2002
***************
*** 24,35 ****
.SUFFIXES: .c .o
LIBOBJ=lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
! lib/permstring.o \
! @LIBOBJS@
ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
zlib/zutil.o zlib/adler32.o
! OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o
main.o checksum.o match.o syscall.o log.o backup.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o
fileio.o batch.o \
clientname.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o
authenticate.o
--- 24,34 ----
.SUFFIXES: .c .o
LIBOBJ=lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
! lib/permstring.o @LIBOBJS@
ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
zlib/zutil.o zlib/adler32.o
! OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o
main.o checksum.o match.o syscall.o log.o backup.o cpconv.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o
fileio.o batch.o \
clientname.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o
authenticate.o
***************
*** 45,51 ****
# note that the -I. is needed to handle config.h when using VPATH
.c.o:
@OBJ_SAVE@
! $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< @CC_SHOBJ_FLAG@
@OBJ_RESTORE@
all: rsync
--- 45,51 ----
# note that the -I. is needed to handle config.h when using VPATH
.c.o:
@OBJ_SAVE@
! $(CC) -I. -I$(srcdir) $(CFLAGS) @CC_SHOBJ_FLAG@ -c $<
@OBJ_RESTORE@
all: rsync
diff -cr rsync-2.5.5/lib/getaddrinfo.c rsync-2.5.5-new/lib/getaddrinfo.c
*** rsync-2.5.5/lib/getaddrinfo.c Fri Dec 14 06:33:12 2001
--- rsync-2.5.5-new/lib/getaddrinfo.c Tue May 14 14:12:24 2002
***************
*** 259,266 ****
--- 259,278 ----
/* error check for hints */
if (hints->ai_addrlen || hints->ai_canonname ||
hints->ai_addr || hints->ai_next)
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390 Open Edition, use
EAI_MAX
+ */
+ ERR(EAI_MAX); /* xxx */
+ #else
ERR(EAI_BADHINTS); /* xxx */
+ #endif
+ #if defined(__MVS__)
+ /* when compiling on OS390 Open Edition AI_MASK appears to be */
+ /* undefined, include expansion literally here */
+ if (hints->ai_flags & ~(AI_PASSIVE | AI_CANONNAME |
AI_NUMERICHOST))
+ #else
if (hints->ai_flags & ~AI_MASK)
+ #endif
ERR(EAI_BADFLAGS);
switch (hints->ai_family) {
case PF_UNSPEC:
***************
*** 294,306 ****
--- 306,330 ----
case SOCK_DGRAM:
if (pai->ai_protocol != IPPROTO_UDP &&
pai->ai_protocol != ANY)
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390 Open
Edition, use
+ EAI_MAX */
+ ERR(EAI_MAX); /*xxx*/
+ #else
ERR(EAI_BADHINTS); /*xxx*/
+ #endif
pai->ai_protocol = IPPROTO_UDP;
break;
case SOCK_STREAM:
if (pai->ai_protocol != IPPROTO_TCP &&
pai->ai_protocol != ANY)
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390 Open
Edition, use
+ EAI_MAX */
+ ERR(EAI_MAX); /*xxx*/
+ #else
ERR(EAI_BADHINTS); /*xxx*/
+ #endif
pai->ai_protocol = IPPROTO_TCP;
break;
default:
***************
*** 350,356 ****
--- 374,386 ----
pai->ai_socktype = SOCK_STREAM;
pai->ai_protocol = IPPROTO_TCP;
} else
+ #if defined(__MVS__)
+ /* hints seem to be unknown to OS390
Open
+ Edition, use EAI_MAX */
+ ERR(EAI_MAX); /*xxx*/
+ #else
ERR(EAI_PROTOCOL); /*xxx*/
+ #endif
}
}
}
***************
*** 401,410 ****
--- 431,450 ----
switch (afdl[i].a_af) {
case AF_INET:
v4a = ((struct in_addr *)pton)->s_addr;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop
it
+ (???) */
if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
pai->ai_flags &= ~AI_CANONNAME;
+ #endif
v4a >>= IN_CLASSA_NSHIFT;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop
it
+ (???) */
if (v4a == 0 || v4a == IN_LOOPBACKNET)
+ #else
+ if (v4a == 0)
+ #endif
pai->ai_flags &= ~AI_CANONNAME;
break;
#ifdef INET6
diff -cr rsync-2.5.5/lib/getnameinfo.c rsync-2.5.5-new/lib/getnameinfo.c
*** rsync-2.5.5/lib/getnameinfo.c Wed Dec 5 14:40:03 2001
--- rsync-2.5.5-new/lib/getnameinfo.c Tue May 14 14:08:56 2002
***************
*** 135,144 ****
--- 135,152 ----
switch (sa->sa_family) {
case AF_INET:
v4a = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop it (???) */
if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
flags |= NI_NUMERICHOST;
+ #endif
v4a >>= IN_CLASSA_NSHIFT;
+ #if ! defined(__MVS__)
+ /* this is unknown on OS390 Open Edition, drop it (???) */
if (v4a == 0 || v4a == IN_LOOPBACKNET)
+ #else
+ if (v4a == 0)
+ #endif
flags |= NI_NUMERICHOST;
break;
#ifdef INET6
diff -cr rsync-2.5.5/authenticate.c rsync-2.5.5-new/authenticate.c
*** rsync-2.5.5/authenticate.c Thu Jan 24 03:33:45 2002
--- rsync-2.5.5-new/authenticate.c Thu May 16 08:20:53 2002
***************
*** 253,258 ****
--- 253,267 ----
return NULL;
}
+ #if defined(__MVS__)
+ /* translate module password read from config file to ASCII */
+ translate_buffer_to_isolatin( (unsigned char *) secret, strlen( secret
) );
+ /* The other side doesn't base64-decode the challenge but uses the
ASCII */
+ /* representation. We must do equally, so translate the b64_challenge.
*/
+ translate_buffer_to_isolatin( (unsigned char *) b64_challenge, strlen(
+ b64_challenge ) );
+ #endif
+
generate_hash(secret, b64_challenge, pass2);
memset(secret, 0, sizeof(secret));
***************
*** 281,286 ****
--- 290,304 ----
if (!pass || !*pass) {
pass = "";
}
+
+ #if defined(__MVS__)
+ /* translate console read user password to ASCII */
+ translate_buffer_to_isolatin( (unsigned char *) pass, strlen( pass ) );
+ /* The other side has worked with the ASCII base64 representation of */
+ /* the challenge. We must do equally, so translate it back to ASCII */
+ translate_buffer_to_isolatin( (unsigned char *) challenge, strlen(
challenge )
+ );
+ #endif
generate_hash(pass, challenge, pass2);
io_printf(fd, "%s %s\n", user, pass2);
diff -cr rsync-2.5.5/cpconv.c rsync-2.5.5-new/cpconv.c
*** rsync-2.5.5/cpconv.c Thu May 16 10:34:41 2002
--- rsync-2.5.5-new/cpconv.c Thu May 16 08:31:31 2002
***************
*** 0 ****
--- 1,110 ----
+ /*
+ * This table translates ISO8859-1 to EBCDIC-1047.
+ *
+ * It was generated by piping the 256 character codes
+ * 0x00...0xff through iconv -f ISO8859-1 -t IBM-1047
+ */
+ static unsigned char isolatin_to_ebcdic[] = {
+ 0x00, 0x01, 0x02,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, 0xaf, 0xbc,
+ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
+ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
+ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
+ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
+ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
+ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
+ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
+ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
+ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
+ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf
+ };
+
+ /*
+ * This table translates EBCDIC-1047 to ISO8859-1.
+ *
+ * It was generated by piping the 256 character codes
+ * 0x00...0xff through iconv -f IBM-1047 -t ISO8859-1
+ */
+ static unsigned char ebcdic_to_isolatin[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
+ 0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
+ 0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
+ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
+ 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
+ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
+ 0xe7,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x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f
+ };
+
+ /*
+ * Convert buffer in place
+ */
+ static void translate_buffer( unsigned char * pConversionTable, unsigned char
*
+ pBuffer, int pLength )
+ {
+ unsigned char * lStop = pBuffer + pLength;
+
+ while (pBuffer < lStop)
+ {
+ *pBuffer = pConversionTable[*pBuffer];
+ ++pBuffer;
+ }
+ }
+
+ /*
+ * These are the exported functions
+ */
+ void translate_buffer_from_isolatin( unsigned char * pBuffer, int pLength )
+ {
+ translate_buffer( isolatin_to_ebcdic, pBuffer, pLength );
+ }
+
+ void translate_buffer_to_isolatin( unsigned char * pBuffer, int pLength )
+ {
+ translate_buffer( ebcdic_to_isolatin, pBuffer, pLength );
+ }
+
diff -cr rsync-2.5.5/exclude.c rsync-2.5.5-new/exclude.c
*** rsync-2.5.5/exclude.c Mon Feb 18 20:10:28 2002
--- rsync-2.5.5-new/exclude.c Fri May 10 14:12:39 2002
***************
*** 290,300 ****
exit_cleanup(RERR_UNSUPPORTED);
}
write_int(f,l+2);
! write_buf(f,"+ ",2);
} else {
write_int(f,l);
}
! write_buf(f,pattern,l);
}
write_int(f,0);
--- 290,300 ----
exit_cleanup(RERR_UNSUPPORTED);
}
write_int(f,l+2);
! write_sbuf(f,"+ ");
} else {
write_int(f,l);
}
! write_sbuf(f,pattern);
}
write_int(f,0);
diff -cr rsync-2.5.5/flist.c rsync-2.5.5-new/flist.c
*** rsync-2.5.5/flist.c Thu Mar 14 22:20:20 2002
--- rsync-2.5.5-new/flist.c Tue May 14 11:24:51 2002
***************
*** 265,282 ****
static int to_wire_mode(mode_t mode)
{
! if (S_ISLNK(mode) && (_S_IFLNK != 0120000)) {
! return (mode & ~(_S_IFMT)) | 0120000;
! }
! return (int) mode;
}
static mode_t from_wire_mode(int mode)
{
! if ((mode & (_S_IFMT)) == 0120000 && (_S_IFLNK != 0120000)) {
! return (mode & ~(_S_IFMT)) | _S_IFLNK;
}
! return (mode_t) mode;
}
--- 265,301 ----
static int to_wire_mode(mode_t mode)
{
! int lPortableFlags;
!
! if (S_ISLNK(mode)) lPortableFlags = 0120000;
! else if (S_ISBLK(mode)) lPortableFlags = 0060000;
! else if (S_ISCHR(mode)) lPortableFlags = 0020000;
! else if (S_ISSOCK(mode)) lPortableFlags = 0140000;
! else if (S_ISFIFO(mode)) lPortableFlags = 0010000;
! else if (S_ISDIR(mode)) lPortableFlags = 0040000;
! else if (S_ISREG(mode)) lPortableFlags = 0100000;
! else lPortableFlags = 0;
!
! return (lPortableFlags | (((int) mode) & 07777));
}
static mode_t from_wire_mode(int mode)
{
! mode_t lPlatformFlags;
!
! switch (mode & (07777 ^ -1))
! {
! case 0120000: lPlatformFlags = S_IFLNK; break;
! case 0060000: lPlatformFlags = S_IFBLK; break;
! case 0020000: lPlatformFlags = S_IFCHR; break;
! case 0140000: lPlatformFlags = S_IFSOCK; break;
! case 0010000: lPlatformFlags = S_IFIFO; break;
! case 0040000: lPlatformFlags = S_IFDIR; break;
! case 0100000: lPlatformFlags = S_IFREG; break;
! default: lPlatformFlags = 0; break;
}
!
! return (mode_t) (lPlatformFlags | (mode & 07777));
}
***************
*** 381,387 ****
write_int(f, l2);
else
write_byte(f, l2);
! write_buf(f, fname + l1, l2);
write_longint(f, file->length);
if (!(flags & SAME_TIME))
--- 400,406 ----
write_int(f, l2);
else
write_byte(f, l2);
! write_sbuf(f, fname + l1);
write_longint(f, file->length);
if (!(flags & SAME_TIME))
***************
*** 403,409 ****
#if SUPPORT_LINKS
if (preserve_links && S_ISLNK(file->mode)) {
write_int(f, strlen(file->link));
! write_buf(f, file->link, strlen(file->link));
}
#endif
--- 422,428 ----
#if SUPPORT_LINKS
if (preserve_links && S_ISLNK(file->mode)) {
write_int(f, strlen(file->link));
! write_sbuf(f, file->link);
}
#endif
diff -cr rsync-2.5.5/io.c rsync-2.5.5-new/io.c
*** rsync-2.5.5/io.c Fri Mar 22 06:14:44 2002
--- rsync-2.5.5-new/io.c Thu May 16 08:20:52 2002
***************
*** 307,312 ****
--- 307,316 ----
read_loop(fd, line, remaining);
line[remaining] = 0;
+ #if defined(__MVS__)
+ translate_buffer_from_isolatin( (unsigned char *) line,
remaining );
+ #endif
+
rprintf((enum logcode) tag, "%s", line);
remaining = 0;
}
***************
*** 377,382 ****
--- 381,391 ----
void read_sbuf(int f,char *buf,size_t len)
{
read_buf (f,buf,len);
+
+ #if defined(__MVS__)
+ translate_buffer_from_isolatin( (unsigned char *) buf, len );
+ #endif
+
buf[len] = 0;
}
***************
*** 610,618 ****
}
/* write a string to the connection */
! static void write_sbuf(int f,char *buf)
{
! write_buf(f, buf, strlen(buf));
}
--- 619,633 ----
}
/* write a string to the connection */
! void write_sbuf(int f,char *buf)
{
! int lLength = strlen(buf);
!
! #if defined(__MVS__)
! translate_buffer_to_isolatin( (unsigned char *) buf, lLength );
! #endif
!
! write_buf(f, buf, lLength );
}
***************
*** 633,639 ****
{
while (maxlen) {
buf[0] = 0;
! read_buf(f, buf, 1);
if (buf[0] == 0)
return 0;
if (buf[0] == '\n') {
--- 648,654 ----
{
while (maxlen) {
buf[0] = 0;
! read_sbuf(f, buf, 1);
if (buf[0] == 0)
return 0;
if (buf[0] == '\n') {
***************
*** 694,699 ****
--- 709,719 ----
io_flush();
stats.total_written += (len+4);
+
+ #if defined(__MVS__)
+ translate_buffer_to_isolatin( (unsigned char *) buf, len );
+ #endif
+
mplex_write(multiplex_out_fd, code, buf, len);
return 1;
}
diff -cr rsync-2.5.5/log.c rsync-2.5.5-new/log.c
*** rsync-2.5.5/log.c Mon Feb 18 20:51:12 2002
--- rsync-2.5.5-new/log.c Thu May 16 08:20:54 2002
***************
*** 94,99 ****
--- 94,104 ----
el->buf = malloc(len+4);
if (!el->buf) exit_cleanup(RERR_MALLOC);
memcpy(el->buf+4, buf, len);
+
+ #if defined(__MVS__)
+ translate_buffer_to_isolatin( (unsigned char *) el->buf+4, len );
+ #endif
+
SIVAL(el->buf, 0, ((code+MPLEX_BASE)<<24) | len);
el->len = len+4;
el->written = 0;
diff -cr rsync-2.5.5/proto.h rsync-2.5.5-new/proto.h
*** rsync-2.5.5/proto.h Mon Mar 25 04:51:17 2002
--- rsync-2.5.5-new/proto.h Thu May 16 08:20:52 2002
***************
*** 55,60 ****
--- 55,62 ----
int daemon_main(void);
void setup_protocol(int f_out,int f_in);
int claim_connection(char *fname,int max_connections);
+ void translate_buffer_from_isolatin( unsigned char * pBuffer, int pLength );
+ void translate_buffer_to_isolatin( unsigned char * pBuffer, int pLength );
int check_exclude(char *name, struct exclude_struct **local_exclude_list,
STRUCT_STAT *st);
void add_exclude_list(const char *pattern, struct exclude_struct ***list, int
include);
***************
*** 107,112 ****
--- 109,115 ----
void write_int(int f,int32 x);
void write_longint(int f, int64 x);
void write_buf(int f,char *buf,size_t len);
+ void write_sbuf(int f,char *buf);
void write_byte(int f,unsigned char c);
int read_line(int f, char *buf, size_t maxlen);
void io_printf(int fd, const char *format, ...);
diff -cr rsync-2.5.5/uidlist.c rsync-2.5.5-new/uidlist.c
*** rsync-2.5.5/uidlist.c Mon Mar 1 22:16:50 1999
--- rsync-2.5.5-new/uidlist.c Fri May 10 14:15:48 2002
***************
*** 203,209 ****
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_buf(f, list->name, len);
list = list->next;
}
--- 203,209 ----
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_sbuf(f, list->name);
list = list->next;
}
***************
*** 218,224 ****
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_buf(f, list->name, len);
list = list->next;
}
write_int(f, 0);
--- 218,224 ----
int len = strlen(list->name);
write_int(f, list->id);
write_byte(f, len);
! write_sbuf(f, list->name);
list = list->next;
}
write_int(f, 0);
diff -cr rsync-2.5.5/util.c rsync-2.5.5-new/util.c
*** rsync-2.5.5/util.c Wed Mar 20 02:09:49 2002
--- rsync-2.5.5-new/util.c Thu May 16 08:20:55 2002
***************
*** 853,863 ****
--- 853,903 ----
const uchar *s1 = (const uchar *)cs1;
const uchar *s2 = (const uchar *)cs2;
+ #if defined(__MVS__)
+ uchar c1;
+ uchar c2;
+ #endif
+
while (*s1 && *s2 && (*s1 == *s2)) {
s1++; s2++;
}
+ #if defined(__MVS__)
+ /*
+ *This is a horrible hack.* The problem is that send_file_list()
and
+ recv_file_list() (flist.c) *separately* sort the file list
*after*
+ it has been transmitted between the two peers. This way, if the
sort
+ yields different results on different platforms, the files get
mixed
+ up in the transfer. As stated above, this has already caused
problems
+ which were addressed by providing an own function u_strcmp()
for string
+ comparison which is it's only purpose. Alas, this implementation
+ depends on the layout of the character set used by every
platform.
+ Particulary, it yields different results on an EBCDIC machine as
+ opposed to an ASCII machine. (In EBCDIC, the character values
of the
+ uppercase letters are greater than those of the lowercase
letters,
+ and those of the numbers are the highest of all.)
+
+ The problem would better be corrected in the correct place,
that is
+ doing the sort of the file list (duplicate removal, as I
understand
+ the goal of the procedure) exactly once *before* its
transmission.
+ This would, of course, introduce an incompatibility with
existing
+ rsync servers that *do* the sort after the transmission. This
would
+ have to be handled by establishing a new protocol version.
+
+ For now, I'll keep compatibility with existing rsync servers by
+ leaving the sort where it is and converting EBCDIC to ASCII
before
+ comparing characters.
+
+ Hartmut Schaefer, May 14, 2002
+ */
+ c1 = *s1;
+ translate_buffer_to_isolatin( &c1, 1 );
+ c2 = *s2;
+ translate_buffer_to_isolatin( &c2, 1 );
+ return (int)c1 - (int)c2;
+ #else
return (int)*s1 - (int)*s2;
+ #endif
}
static OFF_T last_ofs;
diff -cr rsync-2.5.5/fileio.c rsync-2.5.5-new/fileio.c
*** rsync-2.5.5/fileio.c Sat Jan 26 00:07:34 2002
--- rsync-2.5.5-new/fileio.c Thu May 16 08:20:51 2002
***************
*** 75,80 ****
--- 75,84 ----
{
int ret = 0;
+ #if defined(__MVS__)
+ translate_buffer_from_isolatin( (unsigned char *) buf, len );
+ #endif
+
if (!sparse_files) {
return write(f,buf,len);
}
***************
*** 193,198 ****
--- 197,208 ----
has changed mid transfer! */
memset(map->p+read_offset+nread, 0, read_size - nread);
}
+
+ #if defined(__MVS__)
+ translate_buffer_to_isolatin( (unsigned char *) map->p +
read_offset,
+ read_size );
+ #endif
+
map->p_fd_offset += nread;
}
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN