www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/06/28/15:01:55

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
NNTP-Posting-Date: Sat, 28 Jun 2008 13:52:07 -0500
From: "MikeC" <Mike DOT Best AT btconnect DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <po-dnT-Z46oEqsPVRVnyjAA AT bt DOT com> <g3m33o$i5s$1 AT heraldo DOT rediris DOT es>
Subject: Re: [OT] Accepting files (question)
Date: Sat, 28 Jun 2008 19:52:05 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
Message-ID: <uuudnXt4fd3FFfvVnZ2dnUVZ8vCdnZ2d@bt.com>
Lines: 107
X-Usenet-Provider: http://www.giganews.com
X-AuthenticatedUsername: NoAuthUser
X-Trace: sv3-2BPEsdfqtoP7LQ5A/eg1KVIOZwBnujA51exQU/Q8vwVACF4ug0upLJ2UQ5lkXKJxFkdvambFETVAtIm!1A5X2TUr/0ieN7J3g28ck7sbpXl9NuvtYJMfc4EXKRNEWyGKPJdldy0k7t8R7wuAd+Mm591RWXA=
X-Complaints-To: abuse AT btinternet DOT com
X-DMCA-Complaints-To: abuse AT btinternet DOT com
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.39
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Manuel,

Your solution is, as you say, off-topic, but very ingenious, and something I 
would not have thought of.
Thank you very much for the time and thought you put into it.

One problem I have had with the parser is that if I drag two files onto it 
at the same time, they both have to fit on the DOS command line, and as they 
both carry the entire path, they can be quite long, so easily overspill the 
128 characters allowed.  Passing three files was a non-starter, but as that 
is what I wanted to do, I solved it by passing the directory string to the 
program instead of the filenames.  The program then looks in the directory 
for the filenames.  I am fortunate that the files are all produced by a disk 
array I work on, and always have the same file names, so it's quite easy. 
Otherwise, I would have had to test the contents of the files to see which 
was which.

In the case of the encryption program, it wouldn't matter which was which, 
as I'm just going to ex-or them.

Thanks again,

MikeC

"Manuel Collado" <m DOT collado AT lml DOT ls DOT fi DOT upm DOT es> wrote in message 
news:g3m33o$i5s$1 AT heraldo DOT rediris DOT es...
> MikeC escribió:
>> Good Folk,
>>
>> I have written a parser program that operates on one or more files to 
>> produce an output file.  It takes an input file, parses it (with the help 
>> of other files if they are given) and produces an output file.
>> The way I operate the program under Windows XP is to make a shortcut icon 
>> to my program on the task bar, then I select the input file(s) with 
>> Wndows Explorer, drag it (or them symoltaneously) onto the shortcut icon, 
>> and drop them.  The filenames are passed exactly as if I had typed them 
>> all on the command line...
>>
>> myparser d:\path_1\file_1  d:\path_2\file_2
>>
>> ... and the filenames are placed in argv[n].   No problems there - it 
>> works fine.
>>
>> I have used the same technique on several other programs too.  It's a 
>> nice way of operating a DOS program from Windows.
>>
>> I want to write a simple file encryption program that uses a one-time 
>> pad. This technique is very secure, as long as nobody gets hold of the 
>> key - and therein lies the snag.  I want to use another file on the PC as 
>> a key, but I don't want to say "Input key ... Browse", as that makes it 
>> obvious that it is on the PC somewhere.  What I want to do is drop the 
>> document to be encrypted on the program's shortcut icon to fire it up, 
>> then have it wait till a second file (the key) is dropped on it, and have 
>> it detect and use that second file.  I have played around with it a bit, 
>> but dropping a second file on the icon just starts a second image of my 
>> program, and while dropping the file into the DOS screen gives the right 
>> Windows indications (a '+' copy icon), I can't detect the file name.  Can 
>> anybody shed some light on this please?
>
> The following solution is probably off-topic here (not related to DJGPP). 
> A shell script (dropargs.bat) can solve the problem. Create a shortcut for 
> it and drop the file arguments on it one after the other.
>
> The first time it creates a temporary driver script to later call your 
> program with the dropped file as the first argument. The second time it 
> actually calls your program with both arguments.
>
> Edit the script to call your specific program instead of the generic 
> "myprog". The directory where the script resides must be writeable. 
> Executing the script without arguments clears the temporary driver (in 
> case you change your mind after the first drop).
>
> --- dropargs.bat------------------------------
> @echo off
>
> rem --- no args, clear temporary driver
> if .%1.==.. (
>   if exist %~dp0dropargs~.bat del %~dp0dropargs~.bat
>   exit /B
> )
>
> rem --- first arg, create a temporary driver
> if not exist %~dp0dropargs~.bat (
>   echo myprog %1 %%1 > %~dp0dropargs~.bat
>   exit /B
> )
>
> rem -- second arg, execute via the temporary driver
> call %~dp0dropargs~.bat %1
> del %~dp0dropargs~.bat
> ----------------------------------------------
>
>>
>> I have recently downloaded Notepad++, and I can't sing its praises highly 
>> enough.  It's a terrific piece of work - and the comparison plugin has 
>> saved me a lot of time already and made me look impressive in the eyes of 
>> my colleagues - but what I wanted to say is that it operates in the way I 
>> said. Drop a text file on it, and it starts up and displays the text. 
>> Drop a second one on it while it is running, and it opens a new tab and 
>> displays the second file.  Admittedly, it is compiled by a compiler that 
>> is made for Windows, not one that is made for DOS, but I'm sure DJGPP has 
>> a way, if somebody can tell me.
>
> -- 
> Manuel Collado - http://lml.ls.fi.upm.es/~mcollado 


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019