English Amiga Board Amiga Lore


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 28 December 2011, 20:19   #1
BarryB
Amigaholic

 
Join Date: Dec 2009
Location: UK
Posts: 2,369
How to pass filenames with spaces to CRMData?

I'm trying to crunch a datafile with spaces in the name using crmdata in a CLI window but have stumbled into a problem that either crmdata or AmigaDOS can't handle. I know I can rename the file then rename it back but I have a few files to crunch and would rather it work with spaces intact in the filename. I also have a menu command in DiskMaster setup so I can tag numerous files and crmdata will crunch the lot, provided there are no spaces in any device name or filename, which is why I want to find out how to crunch files with spaces in the name.

An example: If I issue the command: crmdata -2c "filename with spaces" then crmdata spits out the response: Could not open '"filename'! so it appears to ignore the double quotes around the file and tries to process the filename 'as is' meaning it takes the first double quote " as part of the filename then when it hits the space it throws up an error.

Thumbed through my Workbench 3.0 User's Guide but it doesn't offer any help other than enclose the entire path in double quotes, which I've tried with the same result. Anyone have an idea what's wrong?
BarryB is offline  
AdSense AdSense  
Old 28 December 2011, 20:30   #2
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 44
Posts: 6,528
Have you tried using some AmigaDOS wildcards instead?
Galahad/FLT is offline  
Old 28 December 2011, 21:12   #3
BarryB
Amigaholic

 
Join Date: Dec 2009
Location: UK
Posts: 2,369
Tried all sorts of ways but can't work it out. Tried renaming a file with spaces using the conventional rename command and that works no problem as long as the destination filename is in quotes too e.g.:

rename "file with spaces" "filewithspaces" and rename "filewithspaces" "file with spaces" both work as you would expect so I'm thinking crmdata isn't handling spaces in the filenames!
BarryB is offline  
Old 28 December 2011, 21:19   #4
prowler
Global Moderator

prowler's Avatar
 
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,204
Quote:
Originally Posted by BarryB View Post
Tried all sorts of ways but can't work it out. Tried renaming a file with spaces using the conventional rename command and that works no problem as long as the destination filename is in quotes too e.g.:

rename "file with spaces" "filewithspaces" and rename "filewithspaces" "file with spaces" both work as you would expect so I'm thinking crmdata isn't handling spaces in the filenames!
Quote:
Originally Posted by Galahad/FLT View Post
Have you tried using some AmigaDOS wildcards instead?
Hi Barry,

What Galahad means is, for example using crmdata -2c file?with?spaces as your command line instead. Have you tried that?
prowler is offline  
Old 28 December 2011, 21:35   #5
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,017
AmigaDOS and the common shells for Amiga don't recognize wildcards in command lines, that's part of the program's job, and while they do recognize quotes in the command line for redirecting in- and output, the part of the command line which gets sent to your program is always passed as-is, and it's entirely up to the program to parse it.
Leffmann is offline  
Old 28 December 2011, 21:47   #6
prowler
Global Moderator

prowler's Avatar
 
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,204
Thanks for that little gem, Leffmann. I use wildcards all the time with list, as well as lha and lxz archivers, and didn't realise it was up to the program, in the case of the archivers, to parse the wildcards.
prowler is offline  
Old 28 December 2011, 21:51   #7
BarryB
Amigaholic

 
Join Date: Dec 2009
Location: UK
Posts: 2,369
Looks like Leffmann is spot on.

No matter how I use wildcards in the command, crmdata just processes the input 'as-is' meaning it treats the space as the end of the filename and errors because there is no filename with the name it's parsed or, if using wildcards, expects the filename to have wildcards in it too.
BarryB is offline  
Old 28 December 2011, 22:08   #8
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 44
Posts: 6,528
There must be an option in crmdata to accept wildcards.

Have you tried typing 'crmdata ?'

Doesn't that give a list of all accepted commands and parameters?
Galahad/FLT is offline  
Old 28 December 2011, 22:22   #9
BarryB
Amigaholic

 
Join Date: Dec 2009
Location: UK
Posts: 2,369
Yep, that's the first thing I tried:

Code:
Usage: CrMData [-12cdfsy] <sourcefile> [<destfile>]
-1 : use CrM-Normal algorithm
-2 : use LZ-Huffman algorithm
-c : crunch only
-d : decrunch only
-f : enable Power-LED flashing
-l : save file, even if it becomes larger
-s : use Sample-Mode
-y : enable password encryption
Can you spot anything I've missed?
BarryB is offline  
Old 29 December 2011, 05:52   #10
clenched
Registered User

 
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 586
BarryB - If you don't mind a little patching, this trouble is easily overcome.
CrMData V1.01.
1 - Decide on a new delimiter to mark the end of the filename. This character should be an obscure one as far as filenames go. I chose ~($7E) as example. If it could be worked so that directories are excluded then / would be ideal.
2 - hex editor at offset $159 change $20 to $7E, save it back.
If you're not giving a second filename then nothing changes. The original is overwritten.
To use a second filename the syntax becomes what is pasted below straight out of CLI.
I'm totally unfamiliar with "DiskMaster" so its effects with this are unknown.

Code:
 
1.Ram Disk:> dir c#?
     Ram Disk:Clipboards (dir)
  CrMData                          
1.Ram Disk:> CrMData CrMData~C r M D a t a
CrMData V1.01 --- (c) 1993 Thomas Schwarz
Loading `CrMData' (2620 bytes)...
Crunching... 2620 -> 1890 (27% gain)
Saving `C r M D a t a' (1904 bytes)...
1.Ram Disk:> dir c#?                       
     Ram Disk:Clipboards (dir)
  C r M D a t a                    CrMData
1.Ram Disk:> CrMData C r M D a t a~CrM      Data
CrMData V1.01 --- (c) 1993 Thomas Schwarz
Loading `C r M D a t a' (1904 bytes)...
Decrunching (1890 -> 2620)...
Saving `CrM      Data' (2620 bytes)...
1.Ram Disk:> dir c#?                             
     Ram Disk:Clipboards (dir)
  C r M D a t a                    CrM      Data
  CrMData                          
1.Ram Disk:> CrMData CrM      Data            
CrMData V1.01 --- (c) 1993 Thomas Schwarz
Loading `CrM      Data' (2620 bytes)...
Crunching... 2620 -> 1890 (27% gain)
Saving `CrM      Data' (1904 bytes)...
1.Ram Disk:>

Last edited by clenched; 29 December 2011 at 06:52.
clenched is offline  
Old 30 December 2011, 00:07   #11
BarryB
Amigaholic

 
Join Date: Dec 2009
Location: UK
Posts: 2,369
clenched

Once I figured out crmdata needed unpacking first I applied your patch and can happily pack files with spaces in the name, woohoo

Diskmaster uses the %s variable to pass the path to an external program except it doesn't seem to work, but that's a Diskmaster issue, your patch works fine from the CLI.

Last edited by BarryB; 30 December 2011 at 02:29.
BarryB is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AmigaDOS directories with spaces in? boomtopper support.Apps 14 11 May 2007 12:57
WTB: Micronick Video Pass-through Cable Zetr0 MarketPlace 0 04 July 2006 21:57
Mediator 1200 pass-thru bust Boot_WB support.Hardware 0 25 April 2005 19:46
Jurassic Park pass codes do not work Tim Janssen support.Games 8 07 January 2005 19:34
How pass levels in Globdule?? JudasEZT support.Games 5 09 June 2004 11:27

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:51.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.18290 seconds with 11 queries