Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] cpmtools-2.20: new cpmcp options: substitute "/" and uppercase

110 views
Skip to first unread message

Martin

unread,
Apr 27, 2020, 10:07:14 AM4/27/20
to
For all users of "cpmtools"!
Especially Nathanael!

Thanks for letting me post this!


Tony Nicholson made many 8-inch floppy images available.
Many of them contain filenames with '/', as this character has
no special meaning under CP/M.

Sadly, the "cpmtools" package failes miserably when copying files
out of images on all systems using '/' as a directory seperator.


So I played a little bit with the source code:

"cpmcp" now automatically replaces any '/' with '_' when copying out
and also any '_' with '/' when copying into an image.

A new option '-s c' to specify another character or to diasable
the conversion.

An option '-u' to store all files in uppercase when copying out.


Compiling a fully working cpmtools package will need some knowledge,
since it often also depends on the libdsk package.

Testing was done, files with '/'s were copied out and back in successfully.


Hope this is useful
Martin



HOWTO CONVERT AND EXTRACT:

I tried to post a uuencoded form of the tgz but
it was rejected, so I post as a fallback solution
the "UNLOADed" version of "patchtgz.hex":

Converting back:

Copy the hexdump between the two "==== 8< ===="
into a file named "patchtgz.hex".

The file needs to be in MSDOS line endings format.
To convert it, you could do.

Note: The original file will be overwritten!

$ todos <patchtgz.hex >patchtgz.dos
$ mv patchtgz.dos patchtgz.hex

Transfer patchtgz.hex to your CP/M system or emulator
and load it.


A0>load patchtgz

FIRST ADDRESS 0100
LAST ADDRESS 05FF
BYTES READ 0500
RECORDS WRITTEN 0A


This will produce patchtgz.com, which in reality is
a gzipped tar archive containing my patch.


So after transfering it back, you can do:

Listing...

$ tar tvf patchtgz.com
drwxr-xr-x martin/users 0 2020-04-27 15:20 patches/
-rw-r--r-- martin/users 2839 2020-04-27 14:52 patches/filename_mangle




==== 8< ====
PATCHTGZ.COM;
:100100001F8B080057DCA65E0003ED566D6FDB36D3
:1001100010CE67FF8A8B80C49225DBA25FE4D49E59
:10012000D604C58215489AA0758002AE1128321DEA
:100130006B8B2581A2DD2486FFFB8E7A7766A7DD97
:10014000E0761FC6E7832452C7870FEF8E47860EDF
:100150007767346A1EFC4098885EB72BDEA4D735DB
:10016000E336E974E2778A03D2B6BAA4DBB54C0B66
:10017000ED08E9B55B07D0FD91A2322C22EE30806C
:1001800083B9C3B8E7BF664759F43304FD5C84699B
:10019000FCA7DE03F59D39BD9D3BFEFD03DDEB1C99
:1001A00022C05612EF6DF1EF765ABD2CFE2DAB2515
:1001B000E2DFE959D601987B55B103FFF3F8D7EB9D
:1001C000756834DD70EE860DB7A2EB7AA9757A0AF0
:1001D000F556CBB040C7E7099C9E56C00DFC8883FE
:1001E0003B4397B9F3C9686C2BB1B132A800FA91BF
:1001F0007B2E783E074E1FB96D6EF6858CA2079751
:1002000054F4EBA5FE45E83A51D25B22AF45347475
:1002100098C303662BB782BD02CD5AAD0250838FBF
:10022000942F980F7C4641C404FCC5FC8EB246ACAA
:1002300096106210137442DAE22D14E72296813789
:10024000C111CE3D55C5A78684ABD5AAD6ACC0AAF0
:10025000520798860CE54CD5884F28638672232C6C
:10026000FB7014C1A83E8569C0E60E1FE377281E07
:10027000F8E5CDF17FACA02FF60E88C7175F31D01F
:100280002DDA601B2124F86EC246A301138F51178B
:100290009DF0B407E69834A7DF17A1501993168490
:1002A000FA3F7466046ECA3BAA2FBEE5D82DE4AFB0
:1002B000AAFD06F90E27EF65965D0EDF1FF916E71A
:1002C000230B7DF4B84AC4F75AEC9AF57A8D491E8F
:1002D000EF8EB665900EEE8EF68941AC7477009A7B
:1002E00000EEB5884210720FB720D49AC5DE00F038
:1002F000A6A01EAA8926FB9E72EA2F55E5DDF5E52C
:10030000F0EAEAE2D3F9E550D1342D956C9F5F7D98
:10031000BC3C1BC639F5752614AAAA2BC620B3EA25
:10032000B07BD7C0C7D25086FD697FF636E438F47B
:10033000D0FEEDEA5C83E8AB87E790EA6AC23BDF78
:100340003134EAF3C5B6D1A87755897D29AA0A5474
:1003500087D53E4CE81249221B1FC831803B469D81
:100360003F0765AB295AA52BD86D34ABF6CBCDB77B
:100370003826A926DA36EB107FE7258FE4167A6156
:1003800011A14551E576CFCBD12E2EA85B5916424F
:100390004652424979F43A896C12FC72907196C5C2
:1003A0009CFA7C23CC7176BCE919A48DB5DE244679
:1003B0002BA99D9086FF5E04E05702C7C770C80353
:1003C000DC2F5ABEF4C4089D07AA87451CBC5F6297
:1003D000E301E8BAA7253F57895E482B7BC8D9605F
:1003E000A3074F1071F3189DE8446FEB643C106253
:1003F000A74170E7B0C7A7C6F3F3D317139245E43C
:10040000432634E2A3DBEBAB4FEF3FDF5E9F0D7F74
:10041000BFBD3CFB3C1E24E99C894E84663DABEC91
:1004200003F03C606EF8A40A0EE3C18978B688EC4C
:100430009FC3937F4A5349CAE3DF7F89352E47DE46
:10044000586F69F95A72E2743D3B8C84B424605A47
:10045000E236F4879D0E1924DE41DFE14B8B1B361B
:100460000F166148992A1A2F798A535284A6681D5B
:10047000DAD566552B6CD32DA5C67309953396AB8B
:100480001496B88F3EDC5C5C6C8C8064FA82F4C598
:10049000423357A43C8513D7D9077DC074DBED6C7C
:1004A000B1001C3C0C6E7CEF513D664150F8D510FC
:1004B000F658564429738389C8EDF436F226BE8E69
:1004C000744CA39767E8469E67131771CF5597D270
:1004D000AF1CEF85CB450ABEF7711EBC9104A5BFCA
:1004E0001BE9D9D23712D43477A6684E2B6E1EF88A
:1004F00048B5773AB1F6AE65BC2969DF484D1CE9CD
:10050000A74743169FC87BA641DED40CE5C86C4DB7
:100510008E22C51085FF437CF75163AF896D572745
:1005200063CD48035CEE34AAFDAAA69372A6AFF78A
:100530009F4AC5A8D7320AF94A32D22C7887858BD0
:10054000A74990D11D63300CD3B22CCDB6EB44DC5F
:10055000D7E08F85B820B2A71747D4163FBE3C61BD
:100560008FA23E564C1FFC4010E0641444D75194B7
:100570001E9DF9AC7741806EFAAFAFE512121212F0
:10058000121212121212121212121212121212124B
:1005900012121212FF1A7F01B116D24A002800006F
:1005A000000000000000000000000000000000004B
:1005B000000000000000000000000000000000003B
:1005C000000000000000000000000000000000002B
:1005D000000000000000000000000000000000001B
:1005E000000000000000000000000000000000000B
:1005F00000000000000000000000000000000000FB
:00010001FE
==== 8< ====


Steven Hirsch

unread,
Apr 27, 2020, 10:20:30 AM4/27/20
to
On 4/27/20 10:06 AM, Martin wrote:
> For all users of "cpmtools"!
> Especially Nathanael!
>
> Thanks for letting me post this!
>
>
> Tony Nicholson made many 8-inch floppy images available.
> Many of them contain filenames with '/', as this character has
> no special meaning under CP/M.
>
> Sadly, the "cpmtools" package failes miserably when copying files
> out of images on all systems using '/' as a directory seperator.
>
>
> So I played a little bit with the source code:
>
> "cpmcp" now automatically replaces any '/' with '_' when copying out
> and also any '_' with '/' when copying into an image.
>
> A new option '-s c' to specify another character or to diasable
> the conversion.
>
> An option '-u' to store all files in uppercase when copying out.
>
>
> Compiling a fully working cpmtools package will need some knowledge,
> since it often also depends on the libdsk package.
>
> Testing was done, files with '/'s were copied out and back in successfully.

Would you mind sending me the diffs for this? I've been maintaining my own
code base for cpmtools and would love to incorporate it. Please specify which
release you worked against? Thanks!

Nathanael

unread,
Apr 27, 2020, 10:22:06 AM4/27/20
to
On Monday, April 27, 2020 at 10:07:14 PM UTC+8, Martin wrote:

> Hope this is useful

*Chortle* I just finished extracting all the files from Tony's images and packing them up as .ARKs, with various workarounds for the "/" problem, then thought I'd see what's up on comp.os.cpm.

Only to discover you'd posted the patch 7 minutes before I got here. Nevertheless, I think this will be very useful in the future. Just one thing:

Vol. 154 contains a file with an "@" that also needs special handling.

--Nathanael

Martin

unread,
Apr 27, 2020, 11:14:24 AM4/27/20
to
The patch, and a very long detailed HOWTO to extract the .HEX is contained
at the bottom of my post.

I wrote it extra detailed, so you should have no problems converting it.

The diff was made with the last 2.21-snapshot but also works with the
stable release 2.20 since cpmcp.c didn't change.

Martin

Martin

unread,
Apr 27, 2020, 11:52:53 AM4/27/20
to
Hi Nathanael!

"@" is a legal character, why do you want to do something with it?


I'm using SIGM154.IMD in a short demonstration, what the patch adds.

0) In a subdirectory, a listing to get an overview.

$ cpmls -l ../SIGM154.IMD
0:
-rw-rw-rw- 0 Jan 01 1970 @sig/m.154
-rw-rw-rw- 5120 Jan 01 1970 abstract.154
-rw-rw-rw- 9216 Jan 01 1970 cpu8080.bqk
-rwxrwxrwx 2816 Jan 01 1970 crc.com
-rw-rw-rw- 3840 Jan 01 1970 direct.bqk
-rw-rw-rw- 8704 Jan 01 1970 extend80.bqk
-rwxrwxrwx 24320 Jan 01 1970 f83.com
-rw-rw-rw- 9216 Jan 01 1970 f83.doc
-rw-rw-rw- 3840 Jan 01 1970 join.acg
-rw-rw-rw- 33152 Jan 01 1970 kernel.hex
-rw-rw-rw- 74496 Jan 01 1970 meta80.bqk
-rw-rw-rw- 1536 Jan 01 1970 sig/m.lib
-rwxrwxrwx 1920 Jan 01 1970 usq.com
-rw-rw-rw- 36864 Jan 01 1970 utility.bqk

1) Extracting without using new options.
The new default replacing of '/' with '_' happens, NO errors.

$ rm -- *
$ cpmcp -p ../SIGM154.IMD 0:\* .
$ ls -la
total 248
drwxr-xr-x 2 martin users 4096 Apr 27 17:35 .
drwxr-xr-x 45 martin users 4096 Apr 27 10:47 ..
-rw-r--r-- 1 martin users 0 Apr 27 17:35 @sig_m.154
-rw-r--r-- 1 martin users 5120 Apr 27 17:35 abstract.154
-rw-r--r-- 1 martin users 9216 Apr 27 17:35 cpu8080.bqk
-rw-r--r-- 1 martin users 2816 Apr 27 17:35 crc.com
-rw-r--r-- 1 martin users 3840 Apr 27 17:35 direct.bqk
-rw-r--r-- 1 martin users 8704 Apr 27 17:35 extend80.bqk
-rw-r--r-- 1 martin users 24320 Apr 27 17:35 f83.com
-rw-r--r-- 1 martin users 9216 Apr 27 17:35 f83.doc
-rw-r--r-- 1 martin users 3840 Apr 27 17:35 join.acg
-rw-r--r-- 1 martin users 33152 Apr 27 17:35 kernel.hex
-rw-r--r-- 1 martin users 74496 Apr 27 17:35 meta80.bqk
-rw-r--r-- 1 martin users 1536 Apr 27 17:35 sig_m.lib
-rw-r--r-- 1 martin users 1920 Apr 27 17:35 usq.com
-rw-r--r-- 1 martin users 36864 Apr 27 17:35 utility.bqk

2) Extracting, you want uppercase for easier further processing.
The new default replacing of '/' with '_' happens, NO errors.

$ rm -- *
$ cpmcp -u -p ../CPMUG015.IMD 0:\* .
$ ls -la
total 248
drwxr-xr-x 2 martin users 4096 Apr 27 10:47 .
drwxr-xr-x 45 martin users 4096 Apr 27 10:47 ..
-rw-r--r-- 1 martin users 0 Apr 27 10:47 @SIG_M.154
-rw-r--r-- 1 martin users 5120 Apr 27 10:47 ABSTRACT.154
-rw-r--r-- 1 martin users 9216 Apr 27 10:47 CPU8080.BQK
-rw-r--r-- 1 martin users 2816 Apr 27 10:47 CRC.COM
-rw-r--r-- 1 martin users 3840 Apr 27 10:47 DIRECT.BQK
-rw-r--r-- 1 martin users 8704 Apr 27 10:47 EXTEND80.BQK
-rw-r--r-- 1 martin users 24320 Apr 27 10:47 F83.COM
-rw-r--r-- 1 martin users 9216 Apr 27 10:47 F83.DOC
-rw-r--r-- 1 martin users 3840 Apr 27 10:47 JOIN.ACG
-rw-r--r-- 1 martin users 33152 Apr 27 10:47 KERNEL.HEX
-rw-r--r-- 1 martin users 74496 Apr 27 10:47 META80.BQK
-rw-r--r-- 1 martin users 1536 Apr 27 10:47 SIG_M.LIB
-rw-r--r-- 1 martin users 1920 Apr 27 10:47 USQ.COM
-rw-r--r-- 1 martin users 36864 Apr 27 10:47 UTILITY.BQK

3) Finally, you don't want the default replacing of '/' with '_'.
You want to replace every '/' with '$', this actually was used.

$ rm -- *
$ cpmcp -u -s '$' -p ../SIGM154.IMD 0:\* .
$ ls -la
total 248
drwxr-xr-x 2 martin users 4096 Apr 27 17:43 .
drwxr-xr-x 45 martin users 4096 Apr 27 10:47 ..
-rw-r--r-- 1 martin users 0 Apr 27 17:43 @SIG$M.154
-rw-r--r-- 1 martin users 5120 Apr 27 17:43 ABSTRACT.154
-rw-r--r-- 1 martin users 9216 Apr 27 17:43 CPU8080.BQK
-rw-r--r-- 1 martin users 2816 Apr 27 17:43 CRC.COM
-rw-r--r-- 1 martin users 3840 Apr 27 17:43 DIRECT.BQK
-rw-r--r-- 1 martin users 8704 Apr 27 17:43 EXTEND80.BQK
-rw-r--r-- 1 martin users 24320 Apr 27 17:43 F83.COM
-rw-r--r-- 1 martin users 9216 Apr 27 17:43 F83.DOC
-rw-r--r-- 1 martin users 3840 Apr 27 17:43 JOIN.ACG
-rw-r--r-- 1 martin users 33152 Apr 27 17:43 KERNEL.HEX
-rw-r--r-- 1 martin users 74496 Apr 27 17:43 META80.BQK
-rw-r--r-- 1 martin users 1536 Apr 27 17:43 SIG$M.LIB
-rw-r--r-- 1 martin users 1920 Apr 27 17:43 USQ.COM
-rw-r--r-- 1 martin users 36864 Apr 27 17:43 UTILITY.BQK

4) Finally you want the original processing, this will give errors.

$ rm -- *
$ cpmcp -s '' -p ../SIGM154.IMD 0:\* .
cpmcp: can not create ./@sig/m.154: No such file or directory
cpmcp: can not create ./sig/m.lib: No such file or directory
$ ls -la
total 244
drwxr-xr-x 2 martin users 4096 Apr 27 17:48 .
drwxr-xr-x 45 martin users 4096 Apr 27 10:47 ..
-rw-r--r-- 1 martin users 5120 Apr 27 17:48 abstract.154
-rw-r--r-- 1 martin users 9216 Apr 27 17:48 cpu8080.bqk
-rw-r--r-- 1 martin users 2816 Apr 27 17:48 crc.com
-rw-r--r-- 1 martin users 3840 Apr 27 17:48 direct.bqk
-rw-r--r-- 1 martin users 8704 Apr 27 17:48 extend80.bqk
-rw-r--r-- 1 martin users 24320 Apr 27 17:48 f83.com
-rw-r--r-- 1 martin users 9216 Apr 27 17:48 f83.doc
-rw-r--r-- 1 martin users 3840 Apr 27 17:48 join.acg
-rw-r--r-- 1 martin users 33152 Apr 27 17:48 kernel.hex
-rw-r--r-- 1 martin users 74496 Apr 27 17:48 meta80.bqk
-rw-r--r-- 1 martin users 1920 Apr 27 17:48 usq.com
-rw-r--r-- 1 martin users 36864 Apr 27 17:48 utility.bqk


That's all, Martin


Nathanael

unread,
Apr 28, 2020, 1:24:16 AM4/28/20
to
On Monday, April 27, 2020 at 11:52:53 PM UTC+8, Martin wrote:

> I wrote it extra detailed, so you should have no problems converting it.

The "extra detail" being necessary for me, of course :-) I can build cpmtools 2.20, and I was able to extract your patches, but now how do I merge them into the cpmtools source?

> "@" is a legal character, why do you want to do something with it?

I was running into some idiosyncracies in Linux, having to escape the char in some cases. However, I can't remember what I was doing at the time, and I can't reproduce whatever issue I was having, so never mind.

But I believe @ is illegal in (at least some earlier versions of) MS-DOS, though not, apparently, under DOS 6.22.

--Nathanael

Martin

unread,
Apr 28, 2020, 3:17:26 AM4/28/20
to
; -)

These are the versions of cpmtools I have verified the patch applies:
http://www.moria.de/~michael/cpmtools/files/cpmtools-2.20.tar.gz
http://www.moria.de/~michael/cpmtools/files/cpmtools-2.21-snapshot.tar.gz


I try to describe all possibilities, hope I won't miss something.


1) You build cpmtools manually from the sources:

Just after extracting the cpmtools sources and my patch, which should give you
two directories "cpmtools-2.2X" and "patches".

cd into the top level directory of cpmtools and run

$ patch -p1 <../patches/filename_mangle

Now continue with the build sequence...



2) You are using the "official" build commands of the distribution:

I'm using Slackware and love its simple build scripts, so I can only guess :-)

There should be a step in the build system, where all patches are applied.
And there often exists a subdirectory "patches", where they all are stored.
If a file named "series" exists add the name of my patch "filename_mangle"
to it.

Start the build process, my patch should be applied...


Hth Martin

Mark Ogden

unread,
Apr 28, 2020, 8:38:32 AM4/28/20
to
I took a different approach by writing a perl script wrapper to extract all files and handles additional cases, specifically
1) maps all illegal chars for Windows
2) maps all reserved names for Windows
3) maps conflicting names for different user areas
Additionally my script creates a log file that shows for each file, its name on the CPM disk, a hash value of the file to allow for duplicate checking and the mapped file name

The script works by doing a cpmls to get the list of files for all user areas. Then for each user area the files are checked to see if they need mapping, if not a simple cpmcp is used to extract all of the files from the user area. If files need to be mapped then cpmcp is used for each file to extract to a specific mapped file name.

I have posted the script at
https://mark-ogden.uk/files/scripts/uncdsk.pl
Mark

Nathanael

unread,
Apr 28, 2020, 9:52:16 AM4/28/20
to
On Tuesday, April 28, 2020 at 3:17:26 PM UTC+8, Martin wrote:

> $ patch -p1 <../patches/filename_mangle

Ah, that was the missing puzzle piece. OK, everything's done and seems to be working great.

Thanks for the patch and the help.

--Nathanael
0 new messages