Snippets

Takehiko NOZAKI V1 UNIX(unix-jun72) build patch for Cygwin

Created by Takehiko NOZAKI

File patch-unix-jun72.txt Added

  • Ignore whitespace
  • Hide word diff
+diff --git a/build/Makefile b/build/Makefile
+index 7b23f41..a77cc82 100644
+--- a/build/Makefile
++++ b/build/Makefile
+@@ -105,7 +105,7 @@ $(ALLSRCS) patched : $(CLEANSRCS)
+ unix usyms : $(KSRCS)
+ 	@echo Building kernel...
+ 	@$(AS) u?.s
+-	@$(NM) a.out | sort > usyms
++	@$(NM) a.out | LANG=C sort > usyms
+ 	@mv a.out unix
+ 
+ # build a prototype filesystems
+@@ -143,6 +143,7 @@ tape : protofs
+ 
+ install : rf0.dsk rk0.dsk
+ 	@echo Installing...
++	@mkdir -p ../images
+ 	@cp rf0.dsk rk0.dsk ../boot/m792low.load ../images
+ 	
+ # clean intermediate files
+diff --git a/patches/core/initorig.patch b/patches/core/initorig.patch
+index 3f13b20..01c4590 100644
+--- a/patches/core/initorig.patch
++++ b/patches/core/initorig.patch
+@@ -1,5 +1,5 @@
+---- init.clean	2008-06-25 08:39:57.000000000 -1000
+-+++ init.s	2008-06-25 08:40:08.000000000 -1000
++--- build/init.clean	2024-02-21 09:38:45.071459600 +0900
+++++ build/init.s	2024-02-21 09:38:48.915208600 +0900
+ @@ -1,4 +1,5 @@
+  / init -- process control initialization
+ +.. = 40014
+diff --git a/tools/apout/bsd_ioctl.c b/tools/apout/bsd_ioctl.c
+index 3fd1e0f..d1496e9 100644
+--- a/tools/apout/bsd_ioctl.c
++++ b/tools/apout/bsd_ioctl.c
+@@ -6,6 +6,9 @@
+ #ifdef EMU211
+ #include "defines.h"
+ #include <sys/ioctl.h>
++#if !defined(FIOCLEX) || !defined(FIOSETOWN)
++#include <fcntl.h>
++#endif
+ #include <termios.h>
+ #include "bsdtrap.h"
+ #ifdef __linux__
+@@ -20,8 +23,12 @@
+ #define TR_TIOCSETP	0x40067409	/* 0x8 is a write */
+ #define	TR_TIOCSETN	0x8006740a
+ #define	TR_TIOCSETC	0x80067411
++#if defined(TIOCGETD)
+ #define TR_TIOCGETD	0x40027400
++#endif
++#if defined(TIOCSETD)
+ #define TR_TIOCSETD	0x80027401
++#endif
+ #define TR_TIOCGETC	0x40067412
+ #define TR_TIOCGLTC	0x40067474
+ #define TR_TIOCSLTC	0x80067475
+@@ -132,8 +139,12 @@ int trap_ioctl()
+       case TR_TIOCSETP:	  fprintf(dbg_file, "TIOCSETP "); break;
+       case TR_TIOCSETN:	  fprintf(dbg_file, "TIOCSETN "); break;
+       case TR_TIOCSETC:	  fprintf(dbg_file, "TIOCSETC "); break;
++#if defined(TIOCGETD)
+       case TR_TIOCGETD:	  fprintf(dbg_file, "TIOCGETD "); break;
++#endif
++#if defined(TIOCSETD)
+       case TR_TIOCSETD:	  fprintf(dbg_file, "TIOCSETD "); break;
++#endif
+       case TR_TIOCGETC:	  fprintf(dbg_file, "TIOCGETC "); break;
+       case TR_TIOCGLTC:	  fprintf(dbg_file, "TIOCGLTC "); break;
+       case TR_TIOCSLTC:	  fprintf(dbg_file, "TIOCSLTC "); break;
+@@ -171,12 +182,18 @@ int trap_ioctl()
+       i = trap_settermios(uarg1, larg1, uarg4); break;
+ 
+     case TR_FIOCLEX:
++#if defined(FIOCLEX)
+       i = ioctl(uarg1, FIOCLEX, NULL); break;
++#else
++      i = fcntl(uarg1, F_SETFD, FD_CLOEXEC); break;
++#endif
++#if defined(TIOCGETD)
+     case TR_TIOCGETD:
+       shortptr = (int16_t *) &dspace[uarg4];
+       i = ioctl(uarg1, TIOCGETD, &val);
+       if (i==0) *shortptr= val;
+       break;
++#endif
+     case TR_TIOCGPGRP:
+       shortptr = (int16_t *) &dspace[uarg4];
+       i = ioctl(uarg1, TIOCGPGRP, &val);
+@@ -185,15 +202,21 @@ int trap_ioctl()
+     case TR_TIOCSPGRP:
+       shortptr = (int16_t *) &dspace[uarg4];
+       val= *shortptr; i = ioctl(uarg1, TIOCSPGRP, &val); break;
++#if defined(TIOCSETD)
+     case TR_TIOCSETD:
+       shortptr = (int16_t *) &dspace[uarg4];
+       val= *shortptr; i = ioctl(uarg1, TIOCSETD, &val); break;
++#endif
+     case TR_FIOSETOWN:
+       shortptr = (int16_t *) &dspace[uarg4];
+       val= *shortptr;
+ 				/* Something wrong here, wonder why! */
+       TrapDebug((dbg_file, "fd %d val %d ",uarg1,val));
++#if defined(FIOSETOWN)
+       i = ioctl(uarg1, FIOSETOWN, &val); break;
++#else
++      i = fcntl(uarg1, F_SETOWN, val); break;
++#endif
+     case TR_TIOCMGET:
+       shortptr = (int16_t *) &dspace[uarg4];
+       i = ioctl(uarg1, TIOCMGET, &val);
+diff --git a/tools/apout/bsdtrap.c b/tools/apout/bsdtrap.c
+index 2c450d5..ff3017e 100644
+--- a/tools/apout/bsdtrap.c
++++ b/tools/apout/bsdtrap.c
+@@ -57,11 +57,16 @@ bsdtrap()
+     char *buf, *buf2;
+     int16_t *shortptr;
+     long larg1;
++#ifdef STREAM_BUFFERING
+     char *fmode;				/* used with fdopen only */
++#endif
+     struct stat stbuf;				/* used in STAT */
+     struct tr_stat *tr_stbuf;			/* used in STAT */
+     struct tr_timeval *tr_del, *tr_oldel;	/* used in ADJTIME */
+-    struct timeval del, oldel;			/* used in ADJTIME */
++    struct timeval del;				/* used in ADJTIME */
++#if !defined(NO_ADJTIME)
++    struct timeval oldel;			/* used in ADJTIME */
++#endif
+     struct timeval utv[2];			/* used in UTIMES */
+     struct tr_timezone *tr_zone;		/* used in GETTIMEOFDAY */
+     struct timezone zone;			/* used in GETTIMEOFDAY */
+@@ -222,9 +227,11 @@ bsdtrap()
+     case S_RMDIR:				/* DONE */
+ 	buf = xlate_filename((char *)&dspace[uarg1]);
+ 	i = rmdir(buf); break;
++#if !defined(NO_ACCT)
+     case S_ACCT:				/* DONE */
+ 	buf = xlate_filename((char *)&dspace[uarg1]);
+ 	i = acct(buf); break;
++#endif
+     case S_WRITEV:				/* DONE */
+     case S_READV:				/* DONE */
+ 	ivec= (struct iovec *)malloc(uarg3 * sizeof(struct iovec));
+@@ -323,6 +330,7 @@ dostat:
+ 	copylong(tr_oldel->tv_sec,  utv[1].tv_sec);
+ 	copylong(tr_oldel->tv_usec, utv[1].tv_usec);
+ 	break;
++#if !defined(NO_ADJTIME)
+     case S_ADJTIME:				/* DONE */
+ 	tr_del = (struct tr_timeval *) &dspace[uarg1];
+ 						/* Convert tr_del to del */
+@@ -336,6 +344,7 @@ dostat:
+ 	    copylong(tr_oldel->tv_usec, oldel.tv_usec);
+ 	}
+ 	break;
++#endif
+     case S_GETTIMEOFDAY:			/* DONE */
+ 	tr_del = (struct tr_timeval *)	 &dspace[uarg1];
+ 	tr_zone = (struct tr_timezone *) &dspace[uarg2];
+@@ -385,17 +394,21 @@ dostat:
+ 	i = stat(buf, &stbuf);	/* If file is a directory */
+ 	if (i == 0 && (stbuf.st_mode & S_IFDIR)) {
+ 	    i = bsdopen_dir(buf);
++#ifdef STREAM_BUFFERING
+ 	    fmode = "w+";
++#endif
+             TrapDebug((dbg_file, "(dir) on %s ",buf));
+ 	} else {
+ #ifdef NEED_MAP_FCNTL
+ 	    sarg2= map_fcntl(sarg2);
+ #endif
++#ifdef STREAM_BUFFERING
+  	    switch (sarg2 & O_ACCMODE) {
+               case O_RDONLY: fmode = "r"; break;
+               case O_WRONLY: fmode = "w"; break;
+               default: fmode = "w+"; break;
+             }
++#endif
+ 	    i = open(buf, sarg2, sarg3);
+             TrapDebug((dbg_file, "on %s ",buf));
+             TrapDebug((dbg_file, "sarg2 is %d, sarg3 is 0x%x ",sarg2,sarg3));
+@@ -506,9 +519,11 @@ dostat:
+ 	regs[1] = i & 0xffff;
+ 	i= (i >> 16) & 0xffff;
+ 	break;
++#if !defined(NO_SETHOSTID)
+     case S_SETHOSTID:				/* DONE */
+ 	larg1 = (sarg2 << 16) | uarg3;
+ 	sethostid(larg1); i=0; break;
++#endif
+     case S_GETUID:				/* DONE */
+ 	i = getuid(); break;
+     case S_SETUID:				/* DONE */
+@@ -559,7 +574,7 @@ dostat:
+ 	tr_sock= (struct tr_sockaddr *)&dspace[uarg2];
+ 	sock.sa_family= tr_sock->sa_family;
+ 	ll_word(uarg3, len);
+-#ifndef __linux__
++#if !defined(NO_SALEN)
+ 	sock.sa_len=len;
+ #endif
+ 	memcpy(sock.sa_data, tr_sock->sa_data, len);
+@@ -573,7 +588,7 @@ dostat:
+ 	tr_sock= (struct tr_sockaddr *)&dspace[uarg2];
+ 	sock.sa_family= tr_sock->sa_family;
+ 	ll_word(uarg3, len);
+-#ifndef __linux__
++#if !defined(NO_SALEN)
+ 	sock.sa_len=len;
+ #endif
+ 	memcpy(sock.sa_data, tr_sock->sa_data, len);
+@@ -587,7 +602,7 @@ dostat:
+ 	tr_sock= (struct tr_sockaddr *)&dspace[uarg2];
+ 	sock.sa_family= tr_sock->sa_family;
+ 	ll_word(uarg3, len);
+-#ifndef __linux__
++#if !defined(NO_SALEN)
+ 	sock.sa_len=len;
+ #endif
+ 	memcpy(sock.sa_data, tr_sock->sa_data, len);
+@@ -601,7 +616,7 @@ dostat:
+ 	tr_sock= (struct tr_sockaddr *)&dspace[uarg2];
+ 	sock.sa_family= tr_sock->sa_family;
+ 	len= sarg3;
+-#ifndef __linux__
++#if !defined(NO_SALEN)
+ 	sock.sa_len= sarg3;
+ #endif
+ 	memcpy(sock.sa_data, tr_sock->sa_data, len);
+@@ -611,7 +626,7 @@ dostat:
+ 	tr_sock= (struct tr_sockaddr *)&dspace[uarg2];
+ 	sock.sa_family= tr_sock->sa_family;
+ 	len= sarg3;
+-#ifndef __linux__
++#if !defined(NO_SALEN)
+ 	sock.sa_len= sarg3;
+ #endif
+ 	memcpy(sock.sa_data, tr_sock->sa_data, len);
+@@ -621,7 +636,7 @@ dostat:
+ 	tr_sock= (struct tr_sockaddr *)&dspace[uarg5];
+ 	sock.sa_family= tr_sock->sa_family;
+ 	ll_word(uarg6, len);
+-#ifndef __linux__
++#if !defined(NO_SALEN)
+ 	sock.sa_len=len;
+ #endif
+ 	memcpy(sock.sa_data, tr_sock->sa_data, len);
+diff --git a/tools/apout/defines.h b/tools/apout/defines.h
+index 1f27603..59fb5eb 100644
+--- a/tools/apout/defines.h
++++ b/tools/apout/defines.h
+@@ -7,6 +7,7 @@
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
++#include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -47,6 +48,7 @@
+ 
+ #ifdef __linux__
+ # define NO_CHFLAGS
++# define NO_SALEN
+ # define NO_STFLAGS
+ # define NO_GETPGID
+ # define NEED_MAP_FCNTL
+@@ -68,30 +70,20 @@
+ # define Reboot(x) exit(0)
+ #endif
+ 
+-#if !defined(__FreeBSD__) && !defined(__NetBSD__) && \
+-    !defined(__OpenBSD__) && !defined(__linux__) && !defined(__APPLE__)
+-# define NEED_INT_N
++#ifdef __CYGWIN__
++# define NO_ACCT
++# define NO_ADJTIME
++# define NO_CHFLAGS
++# define NO_SALEN
++# define NO_SETHOSTID
++# define NO_STFLAGS
++# define OXTABS XTABS
++# define VDSUSP VSUSP
+ #endif
+ 
+-/* Type definitions for PDP data types. You may need to
+- * define NEED_INT_N if your system  doesn't provide the
+- * types defined below. If you do this, the best way is
+- * to add some #if .. #define .. #endif lines above,
+- * rather then modifying the ones below. If you make
+- * changes to the #if's above, then I would  be very
+- * happy to include them.
+- *
+- * Warren Toomey: wkt@tuhs.org
+- */
+-
+-#ifdef NEED_INT_N
+-typedef char int8_t;
+-typedef short int16_t;
+-typedef long int32_t;
+-typedef unsigned char u_int8_t;
+-typedef unsigned short u_int16_t;
+-typedef unsigned long u_int32_t;
+-#endif
++#define u_int8_t uint8_t
++#define u_int16_t uint16_t
++#define u_int32_t uint32_t
+ 
+ /* Macro defines for debug output, makes
+  * the code look somewhat cleaner
+diff --git a/tools/apout/fp.c b/tools/apout/fp.c
+index 3b69cb3..b5f5b51 100644
+--- a/tools/apout/fp.c
++++ b/tools/apout/fp.c
+@@ -42,7 +42,7 @@ int INTMODE=0;		/* 0 = integers, 1 = longs */
+ /* Temporary variables */
+ FLOAT Srcflt;		/* Float specified by FSRC field */
+ pdpfloat *fladdr;	/* Address of float  in dspace */
+-int   AC;		/* Accumulator field in ir */
++extern int   AC;	/* Accumulator field in ir */
+ int32_t srclong;	/* Longword from source address */
+ int32_t dstlong;	/* Longword for destination address */
+ static char *buf, *buf2; /* for copylong */
+diff --git a/tools/apout/v7trap.c b/tools/apout/v7trap.c
+index 00a2f31..4f1d685 100644
+--- a/tools/apout/v7trap.c
++++ b/tools/apout/v7trap.c
+@@ -68,7 +68,7 @@ v7trap()
+     int whence;
+     u_int16_t argbase;
+     int trapnum;
+-    long larg;
++    long larg = 0;
+     char *buf, *buf2;
+     char *fmode;		/* used with fdopen only */
+     time_t tim;
+@@ -692,9 +692,9 @@ static int v7signal(int sig, int val)
+ 
+   switch(val) {
+     case V7_SIG_IGN:
+-      return((int)signal(v7sig[sig], SIG_IGN));
++      return((intptr_t)signal(v7sig[sig], SIG_IGN));
+     case V7_SIG_DFL:
+-      return((int)signal(v7sig[sig], SIG_DFL));
++      return((intptr_t)signal(v7sig[sig], SIG_DFL));
+     default:
+       return(0);      /* No handling of this as yet */
+   }
+diff --git a/tools/disaout/opset.c b/tools/disaout/opset.c
+index 9745d76..4359ca5 100644
+--- a/tools/disaout/opset.c
++++ b/tools/disaout/opset.c
+@@ -358,7 +358,9 @@ void branch(char *str, int addr, int ins)
+  */
+ int printins(int addr)
+ {
++#if 0
+   unsigned int type;
++#endif
+   int byte;
+   int incr = 2;
+   int syscall;
+@@ -374,7 +376,9 @@ int printins(int addr)
+   /* Get the instruction from the ispace array */
+   int ins = ispace[addr] + (ispace[addr + 1] << 8);
+ 
++#if 0
+   type = DSYM;
++#endif
+   for (p = optab;; p++) {
+     if ((ins & ~p->mask) == p->val) {
+       break;
+@@ -389,7 +393,9 @@ int printins(int addr)
+   switch (p->itype) {
+ 
+   case JMP:
++#if 0
+     type = ISYM;
++#endif
+ 
+   case SINGLE:
+     if (byte) {
+@@ -405,7 +411,9 @@ int printins(int addr)
+     break;
+ 
+   case JSR:
++#if 0
+     type = ISYM;
++#endif
+ 
+   case DOUBLE:
+     if (byte) {
+diff --git a/tools/fixaout.py b/tools/fixaout.py
+index ce5ac90..ca768d2 100755
+--- a/tools/fixaout.py
++++ b/tools/fixaout.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ """
+ Convert an 0407 binary into an 0405 binary, under the assumption
+ that the code starts at 040014 (by ".. = 40014").
+@@ -6,6 +6,7 @@ See tools/as.
+ """
+ 
+ import struct
++from io import open
+ 
+ def words(bs) :
+     l = len(bs) / 2
+@@ -15,17 +16,17 @@ def unwords(ws) :
+     return struct.pack('<%dH' % l, *ws)
+ 
+ def read(fn) :
+-    f = file(fn, 'rb')
++    f = open(fn, 'rb')
+     d = f.read()
+     f.close()
+     return d
+ 
+ def write(fn, d) :
+-    f = file(fn, 'wb')
++    f = open(fn, 'wb')
+     f.write(d)
+     f.close()
+ 
+ d1 = words(read('a.out'))
+ hdr = d1[:8]
+-d = [0405, 12+hdr[1], 0, 0, hdr[4], 0] + d1[8:]
++d = [0o405, 12+hdr[1], 0, 0, hdr[4], 0] + d1[8:]
+ write("a.out", unwords(d))
+diff --git a/tools/mkfs.c b/tools/mkfs.c
+index a463044..1403f0b 100644
+--- a/tools/mkfs.c
++++ b/tools/mkfs.c
+@@ -128,7 +128,7 @@ void write_superblock(void)
+     printf("Writing inodelist from block 2\n");
+   }
+   fseek(diskfh, 2 * BLKSIZE, SEEK_SET);
+-  if (debug) printf("Writing %d inodes, each size %d, total %d\n",
++  if (debug) printf("Writing %d inodes, each size %ld, total %ld\n",
+ 	   icount, sizeof(struct v1inode), icount * sizeof(struct v1inode));
+   fwrite(&inodelist[1], sizeof(struct v1inode), icount - 1, diskfh);
+   if (debug) {
+@@ -361,7 +361,7 @@ void write_dir(struct directory *d, char *name)
+   }
+ 
+   if (debug)
+-    printf("Writing dir %s, size %d, %d blks from block %d (offset 0x%x) on\n",
++    printf("Writing dir %s, size %ld, %ld blks from block %d (offset %#x) on\n",
+ 	   name, d->numentries * sizeof(struct v1dirent),
+ 	   d->numentries / DIRENTPERBLOCK, d->block,
+ 	   d->block * BLKSIZE);
+@@ -683,7 +683,9 @@ int main(int argc, char *argv[])
+ {
+   int i, ch;
+   int numiblocks;
++#if 0
+   int fs_size;			/* Equal to disksize minus any swap */
++#endif
+ 
+   /* Get any optional arguments */
+   while ((ch = getopt(argc, argv, "dp:")) != -1) {
+@@ -707,10 +709,14 @@ int main(int argc, char *argv[])
+     /* XXX: I can't seem to go past 4864 to 4872 blocks, and I haven't */
+     /* worked out why yet. */
+     disksize = RK_SIZE;
++#if 0
+     fs_size = RK_SIZE;
++#endif
+   } else {
+     disksize = RF_SIZE;
++#if 0
+     fs_size = RF_NOSWAPSIZE;
++#endif
+     makedevflag = 1;
+   }
+ 
+diff --git a/tools/mktape.py b/tools/mktape.py
+index 1682606..4ad2df6 100755
+--- a/tools/mktape.py
++++ b/tools/mktape.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ """
+ Make a tape for 1st ed cold boot.
+ 
+@@ -15,6 +15,7 @@ metadata:
+ 
+ import os, re, sys
+ from struct import pack
++from io import open
+ 
+ # unfortunately the permission bits and uids weren't preserved
+ # so we have to restore them based on this table...
+@@ -120,12 +121,12 @@ noisy = 0
+ 
+ def uMode(s) :
+     m = 0
+-    if s[0] == 'u' : m |= 040 | 020
+-    if s[0] == 'x' : m |= 020
+-    if s[1] == 'r' : m |= 010
+-    if s[2] == 'w' : m |= 004
+-    if s[3] == 'r' : m |= 002
+-    if s[4] == '2' : m |= 001
++    if s[0] == 'u' : m |= 0o40 | 0o20
++    if s[0] == 'x' : m |= 0o20
++    if s[1] == 'r' : m |= 0o10
++    if s[2] == 'w' : m |= 0o04
++    if s[3] == 'r' : m |= 0o02
++    if s[4] == '2' : m |= 0o01
+     return m
+ 
+ # preprocess the perms table to form perm :: path -> (mode, uid)
+@@ -138,31 +139,31 @@ def pad(d) :
+     "pad to 512-byte boundary"
+     l = len(d)
+     m = ((l + 511) & ~511) - l
+-    return d + ("\0" * m)
++    return d + str.encode("\0" * m)
+ 
+ def sMode(m) :
+     return (
+-        ("-","s")[(m & 040) != 0] +
+-        ("-","x")[(m & 020) != 0] +
+-        ("-","r")[(m & 010) != 0] +
+-        ("-","w")[(m & 004) != 0] +
+-        ("-","r")[(m & 002) != 0] +
+-        ("-","w")[(m & 001) != 0] )
++        ("-","s")[(m & 0o40) != 0] +
++        ("-","x")[(m & 0o20) != 0] +
++        ("-","r")[(m & 0o10) != 0] +
++        ("-","w")[(m & 0o04) != 0] +
++        ("-","r")[(m & 0o02) != 0] +
++        ("-","w")[(m & 0o01) != 0] )
+ 
+ def wrFile(out, fn, d, mode, uid) :
+     "write out file."
+     if noisy :
+-        print sMode(mode), uid, fn
++        print(sMode(mode), uid, fn)
+     meta = pack("<HBB", len(d), mode, uid) + fn
+     out.write(pad(meta))
+     out.write(pad(d))
+ 
+ def wrEof(out) :
+-    wrFile(out, "", "", 0, 0)
++    wrFile(out, b"", b"", 0, 0)
+     
+ def copyFile(root, out, fn) :
+     "copy file from local filesystem to tape."
+-    f = file(fn, 'rb')
++    f = open(fn, 'rb')
+     d = f.read()
+     f.close()
+     s = os.stat(fn)
+@@ -170,19 +171,19 @@ def copyFile(root, out, fn) :
+         fn = fn[len(root):]
+     # get the perm from the table, if not present, just make it
+     # uid=1 mode = 37.
+-    mode,uid = perms.get(fn, (037, 1))
+-    if not fn in perms : print "making up mode"
+-    wrFile(out, fn, d, mode, uid)
++    mode,uid = perms.get(fn, (0o37, 1))
++    if not fn in perms : print("making up mode")
++    wrFile(out, str.encode(fn), d, mode, uid)
+ 
+ def main() :
+     if len(sys.argv) < 2 :
+-        print "usage: %s root files" % sys.argv[0]
++        print("usage: %s root files" % sys.argv[0])
+         raise SystemExit(1)
+     root = sys.argv[1]
+     files = sys.argv[2:]
+ 
+-    f = file("tape", "wb")
+-    f.write("\0" * (512 * 65))		# start at block 65
++    f = open("tape", "wb")
++    f.write(str.encode("\0" * (512 * 65)))	# start at block 65
+     for fn in files :
+         copyFile(root, f, fn)
+     wrEof(f)
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.