archetyp@uxh.cso.uiuc.edu (Joseph R Pickert) (12/09/90)
Below are a couple of misc fixes for macminix, including a patch to a.out.h to fix the strip problem. Joe Pickert #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: README a.out.hdif cstart.cdif maccreate.cdif macfile.cdif PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(273 characters\) sed "s/^X//" >README <<'END_OF_README' X XTHESE PATCHES ARE RELATIVE TO THE ORIGINAL DISTRIBUTION X XEnclosed are some patches for: X X include/a.out.h: fixes for strip & nm X kernel/cstart.c: misc fixes X commands/mac/maccreate.c: fixes for partitions > 32767 blocks X commands/mac/macfile.c: fixes for macwrite END_OF_README if test 273 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f a.out.hdif -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"a.out.hdif\" else echo shar: Extracting \"a.out.hdif\" \(2508 characters\) sed "s/^X//" >a.out.hdif <<'END_OF_a.out.hdif' X*** 1.5.10/include/a.out.h Mon Jan 1 09:21:54 1990 X--- 1.5.10.2/include/a.out.h Mon Dec 3 14:50:06 1990 X*************** X*** 1,18 **** X /* The <a.out> header file describes the format of executable files. */ X X #ifndef _AOUT_H X #define _AOUT_H X X struct exec { /* a.out header */ X- unsigned char a_magic[2]; /* magic number */ X- unsigned char a_flags; /* flags, see below */ X unsigned char a_cpu; /* cpu id */ X! unsigned char a_hdrlen; /* length of header */ X! unsigned char a_unused; /* reserved for future use */ X unsigned short a_version; /* version stamp */ X /* not used */ X long a_text; /* size of text segement in bytes */ X long a_data; /* size of data segment in bytes */ X long a_bss; /* size of bss segment in bytes */ X long a_no_entry; /* in fact: entry point, a_entry */ X long a_total; /* total memory allocated */ X--- 1,19 ---- X /* The <a.out> header file describes the format of executable files. */ X+ /* This version is intended for the Atari ST & Macintosh */ X X #ifndef _AOUT_H X #define _AOUT_H X X struct exec { /* a.out header */ X unsigned char a_cpu; /* cpu id */ X! unsigned char a_flags; /* flags, see below */ X! unsigned char a_magic[2]; /* magic number */ X unsigned short a_version; /* version stamp */ X /* not used */ X+ unsigned char a_unused; /* reserved for future use */ X+ unsigned char a_hdrlen; /* length of header */ X long a_text; /* size of text segement in bytes */ X long a_data; /* size of data segment in bytes */ X long a_bss; /* size of bss segment in bytes */ X long a_no_entry; /* in fact: entry point, a_entry */ X long a_total; /* total memory allocated */ X*************** X*** 22,33 **** X long a_drsize; /* data relocation size */ X long a_tbase; /* text relocation base */ X long a_dbase; /* data relocation base */ X }; X X! #define A_MAGIC0 (unsigned char) 0x01 X! #define A_MAGIC1 (unsigned char) 0x03 X #define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||\ X (X).a_magic[1] != A_MAGIC1) X X /* CPU Id of TARGET machine */ X /* byte order coded in low order two bits */ X--- 23,34 ---- X long a_drsize; /* data relocation size */ X long a_tbase; /* text relocation base */ X long a_dbase; /* data relocation base */ X }; X X! #define A_MAGIC0 (unsigned char) 0x03 X! #define A_MAGIC1 (unsigned char) 0x01 X #define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||\ X (X).a_magic[1] != A_MAGIC1) X X /* CPU Id of TARGET machine */ X /* byte order coded in low order two bits */ END_OF_a.out.hdif if test 2508 -ne `wc -c <a.out.hdif`; then echo shar: \"a.out.hdif\" unpacked with wrong size! fi # end of overwriting check fi if test -f cstart.cdif -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cstart.cdif\" else echo shar: Extracting \"cstart.cdif\" \(1588 characters\) sed "s/^X//" >cstart.cdif <<'END_OF_cstart.cdif' X*** 1.5.10/kernel/cstart.c Thu Nov 1 09:59:22 1990 X--- 1.5.10.2/kernel/cstart.c Mon Dec 3 15:27:55 1990 X*************** X*** 27,36 **** X--- 27,37 ---- X }; X X PRIVATE struct romtable romversions[] ={ X {0x00, 0x75, 0x2e}, /* mac plus */ X {0x276, 0x276, 0x2e}, /* mac se */ X+ {0x37A, 0x37A, 0x2e}, /* mac portable */ X {0x76, 0x67b, 0x30}, /* mac II to mac IIcx */ X {0x67c, 0x7fff, 0x32} /* mac IIci and above */ X }; X PRIVATE int nvers = sizeof(romversions)/sizeof(struct romtable); X X*************** X*** 80,96 **** X code_base = memat; X data_base = memat+kc; X mem_bytes = (phys_bytes)memat + size; X X /* Initialize macintosh */ X- FlushEvents((short)-1, (short)0); X InitGraf((Ptr)&qd->thePort); X- InitCursor(); X InitFonts(); X InitWindows(); X InitMenus(); X InitDialogs(0L); X X /* record sizes */ X sizes[0] = kc >> CLICK_SHIFT; sizes[1] = kd >> CLICK_SHIFT; X sizes[2] = mc >> CLICK_SHIFT; sizes[3] = md >> CLICK_SHIFT; X sizes[4] = fc >> CLICK_SHIFT; sizes[5] = fd >> CLICK_SHIFT; X--- 81,98 ---- X code_base = memat; X data_base = memat+kc; X mem_bytes = (phys_bytes)memat + size; X X /* Initialize macintosh */ X InitGraf((Ptr)&qd->thePort); X InitFonts(); X InitWindows(); X InitMenus(); X+ TEInit(); X InitDialogs(0L); X+ InitCursor(); X+ FlushEvents((short)-1, (short)0); X X /* record sizes */ X sizes[0] = kc >> CLICK_SHIFT; sizes[1] = kd >> CLICK_SHIFT; X sizes[2] = mc >> CLICK_SHIFT; sizes[3] = md >> CLICK_SHIFT; X sizes[4] = fc >> CLICK_SHIFT; sizes[5] = fd >> CLICK_SHIFT; END_OF_cstart.cdif if test 1588 -ne `wc -c <cstart.cdif`; then echo shar: \"cstart.cdif\" unpacked with wrong size! fi # end of overwriting check fi if test -f maccreate.cdif -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"maccreate.cdif\" else echo shar: Extracting \"maccreate.cdif\" \(1503 characters\) sed "s/^X//" >maccreate.cdif <<'END_OF_maccreate.cdif' X*** 1.5.10/commands/mac/maccreate.c Fri Aug 10 11:38:28 1990 X--- 1.5.10.2/commands/mac/maccreate.c Tue Dec 4 08:47:16 1990 X*************** X*** 24,34 **** X { X char c; X extern int optind; X extern char *optarg; X long type = 0, creator = 0; X! int nblocks; X X while ((c = getopt(argc, argv, "c:t:")) != EOF) { X switch (c) { X case 'c': X strncpy(&creator, optarg, 4); X--- 24,34 ---- X { X char c; X extern int optind; X extern char *optarg; X long type = 0, creator = 0; X! long nblocks; X X while ((c = getopt(argc, argv, "c:t:")) != EOF) { X switch (c) { X case 'c': X strncpy(&creator, optarg, 4); X*************** X*** 40,50 **** X } X if ((argc - optind) < 2) X usage(argv[0]); X if (type == 0) type = totype("MXFS"); X if (creator == 0) creator = totype("MNIX"); X! nblocks = atoi(argv[optind++]); X for (; optind < argc; optind++) { X create(argv[optind], nblocks, type, creator); X } X } X X--- 40,50 ---- X } X if ((argc - optind) < 2) X usage(argv[0]); X if (type == 0) type = totype("MXFS"); X if (creator == 0) creator = totype("MNIX"); X! nblocks = atol(argv[optind++]); X for (; optind < argc; optind++) { X create(argv[optind], nblocks, type, creator); X } X } X X*************** X*** 56,65 **** X--- 56,66 ---- X } X X void X create(file, nblocks, type, creator) X char *file; X+ long nblocks; X long type, creator; X { X ParamBlockRec pbr; X ParamBlockRec iop; X int err; END_OF_maccreate.cdif if test 1503 -ne `wc -c <maccreate.cdif`; then echo shar: \"maccreate.cdif\" unpacked with wrong size! fi # end of overwriting check fi if test -f macfile.cdif -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"macfile.cdif\" else echo shar: Extracting \"macfile.cdif\" \(4776 characters\) sed "s/^X//" >macfile.cdif <<'END_OF_macfile.cdif' X*** 1.5.10/commands/mac/macfile.c Tue Jul 10 15:23:17 1990 X--- 1.5.10.2/commands/mac/macfile.c Tue Dec 4 08:47:30 1990 X*************** X*** 111,120 **** X--- 111,121 ---- X { X ParamBlockRec pbr; X int err; X register char *c; X char buf[100]; X+ long cnt; X X pbr.ioCompletion = 0; X pbr.ioNamePtr = c2pstr(file); X pbr.ioVRefNum = 0; X pbr.ParamBlkType.ioParam.ioVersNum = 0; X*************** X*** 124,143 **** X pbr.ParamBlkType.ioParam.ioBuffer = buf; X pbr.ParamBlkType.ioParam.ioReqCount = sizeof(buf); X pbr.ParamBlkType.ioParam.ioPosMode = 0; X pbr.ParamBlkType.ioParam.ioPosOffset = 0; X err = 0; X! while (err == 0) { X pbr.ParamBlkType.ioParam.ioActCount = 0; X err = PBRead(&pbr, 0); X! c = buf; X! while (pbr.ParamBlkType.ioParam.ioActCount--) { X! if (ascii && *c == '\r') *c = '\n'; X! putchar(*c++); X } X! } X! if (err != -39) X fprintf(stderr, "error reading %s, err = %d\n", p2cstr(file), err); X PBClose(&pbr,0); X } else X fprintf(stderr, "unable to open %s, err = %d\n", p2cstr(file), err); X } X--- 125,149 ---- X pbr.ParamBlkType.ioParam.ioBuffer = buf; X pbr.ParamBlkType.ioParam.ioReqCount = sizeof(buf); X pbr.ParamBlkType.ioParam.ioPosMode = 0; X pbr.ParamBlkType.ioParam.ioPosOffset = 0; X err = 0; X! while (err == 0) { X pbr.ParamBlkType.ioParam.ioActCount = 0; X err = PBRead(&pbr, 0); X! if (ascii) { X! c = buf; X! cnt = pbr.ParamBlkType.ioParam.ioActCount; X! while (cnt--) { X! if (*c == '\r') *c = '\n'; X! c++; X! } X } X! cnt = pbr.ParamBlkType.ioParam.ioActCount; X! fwrite(buf, 1, (int)pbr.ParamBlkType.ioParam.ioActCount, stdout); X! } X! if (err != -39) X fprintf(stderr, "error reading %s, err = %d\n", p2cstr(file), err); X PBClose(&pbr,0); X } else X fprintf(stderr, "unable to open %s, err = %d\n", p2cstr(file), err); X } X*************** X*** 168,180 **** X char *file; X int ascii; X { X ParamBlockRec pbr; X int err; X! register char c; X char buf[100]; X! int len; X X pbr.ioCompletion = 0; X pbr.ioNamePtr = c2pstr(file); X pbr.ioVRefNum = 0; X pbr.ParamBlkType.fileParam.ioFVersNum = 0; X--- 174,186 ---- X char *file; X int ascii; X { X ParamBlockRec pbr; X int err; X! register char *c; X char buf[100]; X! int cnt, len; X X pbr.ioCompletion = 0; X pbr.ioNamePtr = c2pstr(file); X pbr.ioVRefNum = 0; X pbr.ParamBlkType.fileParam.ioFVersNum = 0; X*************** X*** 189,199 **** X pbr.ParamBlkType.fileParam.ioFDirIndex = 0; X if ((err = PBGetFInfo(&pbr, 0)) != 0) { X fprintf(stderr, "Error getting info %s, err = %d\n", p2cstr(file), err); X return; X } X! if (ascii == 1) X pbr.ParamBlkType.fileParam.ioFlFndrInfo.fdType = totype("TEXT"); X else X pbr.ParamBlkType.fileParam.ioFlFndrInfo.fdType = totype("????"); X pbr.ioCompletion = 0; X pbr.ioNamePtr = file; X--- 195,205 ---- X pbr.ParamBlkType.fileParam.ioFDirIndex = 0; X if ((err = PBGetFInfo(&pbr, 0)) != 0) { X fprintf(stderr, "Error getting info %s, err = %d\n", p2cstr(file), err); X return; X } X! if (ascii) X pbr.ParamBlkType.fileParam.ioFlFndrInfo.fdType = totype("TEXT"); X else X pbr.ParamBlkType.fileParam.ioFlFndrInfo.fdType = totype("????"); X pbr.ioCompletion = 0; X pbr.ioNamePtr = file; X*************** X*** 213,241 **** X pbr.ParamBlkType.ioParam.ioPosOffset = 0; X if ((err = PBOpen(&pbr, 0)) != 0) { X fprintf(stderr, "Error opening %s, err = %d\n", p2cstr(file), err); X return; X } X! len = 0; X! while ((c = getchar()) != EOF) { X! if (ascii && c == '\n') c = '\r'; X! buf[len++] = c; X! if (len == sizeof(buf)) { X! if ((err = writebuf(&pbr, buf, len)) != 0) { X! PBClose(&pbr, 0); X! fprintf(stderr, "Error writing %s, err = %d\n", p2cstr(file), err); X! return; X! } X! len = 0; X! } X } X! if (len > 0) X! if ((err = writebuf(&pbr, buf, len)) != 0) { X! PBClose(&pbr, 0); X! fprintf(stderr, "Error writing %s, err = %d\n", p2cstr(file), err); X! return; X! } X PBClose(&pbr, 0); X } X X void X macdir(path) X--- 219,242 ---- X pbr.ParamBlkType.ioParam.ioPosOffset = 0; X if ((err = PBOpen(&pbr, 0)) != 0) { X fprintf(stderr, "Error opening %s, err = %d\n", p2cstr(file), err); X return; X } X! err = 0; X! while (err == 0 && (len = fread(buf, 1, sizeof(buf), stdin)) > 0) { X! if (ascii) { X! c = buf; X! cnt = len; X! while (cnt--) { X! if (*c == '\n') *c = '\r'; X! c++; X! } X! } X! err = writebuf(&pbr, buf, len); X } X! if (err != 0) X! fprintf(stderr, "Error writing %s, err = %d\n", p2cstr(file), err); X PBClose(&pbr, 0); X } X X void X macdir(path) END_OF_macfile.cdif if test 4776 -ne `wc -c <macfile.cdif`; then echo shar: \"macfile.cdif\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of shell archive. exit 0
paul@ukpoit.co.uk (Paul Wood) (12/18/90)
Thanks for your "misc patches". When applying them it highlighted a problem with the makefile in /usr/src/commands/mac. This makefile appears to be a direct copy of the makefile in /usr/src/commands, and while it is ok for making simple commands (commands with a single source file), all the more complex programs need "improved" makefiles (possibly the wrong makefiles were included in the Minix release???) (this is quite a few makefiles). If anybody is interested I can post or mail the makefile I created to make maccreate and macfile. It is a bit of a "frig" (UK English terminology, I don't know how USA English would say it). Also it is probably not the "optimum" solution. (My way of saying that it could be improved) Paul Wood | UUCP Mail: paul@ukpoit.co.uk | 31 Buttermere Drive | Bang-Style: ...!ukc!ukpoit!paul | Dronfield Woodhouse | Voice: +44 246 214256 | Sheffield | FAX: +44 246 214353 | England S18 5PX | Postline: 5403 4256 |