[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

211.0. "Patching a Prolog-3 file" by PLDVAX::ZARLENGA () Thu Feb 27 1986 02:05

    This is truly one for the hackers ...
    

        I want to "patch" a prolog-3 type file (similar to those used
    by VAXNOTES). If I use the TPU editor, I end up with a sequential
    file.

        I can't use PATCH, it seems to operate only on images.

        How can I
           1) Make simple substitution patches to a prolog-3 file
        or 2) Convert the sequential file to the original's type
    
    mike zarlenga
T.RTitleUserPersonal
Name
DateLines
211.1Too simple?CLT::COWANKen Cowan, 381-2198Thu Feb 27 1986 02:087
    This sounds like an exercise in coding, but relatively uninteresting.
    
    I believe you need to use SYS$OPEN, and friends to open the
    file, read the area you want to patch and write it back.   Am
    I missing something obvious?
    
    	KC
211.2What took you so longPLDVAX::ZARLENGAThu Feb 27 1986 02:157
        To be specific, I want to replace one string with another
    of identical length.
        Can you send me an example?
    
    mike

P.S.  Talk about FAST replies!!
211.3Patch/absolute will do it..MADMAC::SWARDThu Feb 27 1986 07:591
    
211.4Use a ToolTLE::BRETTThu Feb 27 1986 10:584
    
    As will using CONVERT
    
    /Bevin
211.5ZAP!VAXUUM::DYERJym << _n_!Thu Feb 27 1986 15:520
211.6PARVAX::PFAUtom_pThu Feb 27 1986 22:126
    Are you trying to change some information in a record?  If so, this
    can be done from DCL using OPEN, READ, WRITE and CLOSE.  If you
    are trying to change something other than a data record, I would
    suggest PATCH/ABSOLUTE as recommended in a previous reply.

    tom_p
211.7Thought I had it, butPLDVAX::ZARLENGAFri Feb 28 1986 01:3210
    I used PATCH/ABSOLUTE and the resultant file was sequential, even
    though the original was Prolog-3, indexed, etc.
    
    HELP says that the file attributes (?) are held over, but I guess
    the record type isn't one of them.
    
    What must I do to just change those bytes and keep all the other
    file attributes, etc intact?
    
    mike
211.8FinallyPLDVAX::ZARLENGAFri Feb 28 1986 12:106
        It looks like what I forgot was /NONEW_VERSION. This does
    the trick, now if I can find a way to non-manually search for
    the strings ...    any hints??
    
    mike
211.9Sounds like RMS UPDATE could do it!RICARD::HEINHein van den Heuvel, Valbonne.Fri Feb 28 1986 14:5411
    What the hell do you want to ZAP? if it is a 'file attribute' then
    is should be in the prologue blocks and it would not require more
    then say 10 blocks dump to find it. If it is in the data then one
    wonders why a  normal rms update, available through youre favourite
    language (including DCL) can not do the job.
    If you do need a search from a program then the problem turns into
    a 'mere program exercise' as indicated previously. Actually I posted
    the frameworks of such a program a couple (20+) notes back.
    
    Regards,
    	Hein.
211.10Incantations PreferredVAXUUM::DYERBrewer - PatriotFri Feb 28 1986 16:342
    [RE .9]:  ZAP is nice and cryptic.  Like TECO.
		<_Jym_>
211.11At last!PLDVAX::ZARLENGAFri Feb 28 1986 18:0212
    Complete!
    
    All is fixed, finally. I ended up with a DCL program that uses
    f$locate() to find the string, then substitutes the new one in
    its place. Only problem I encountered was a command buffer over-
    flow (maybe a record > 2048 bytes??), but that happened far
    enough into the file that it was OK.

    I didn't realize that something as simple as $read knew enough
    about Prolog-3 type files to handle them.
        
    mike
211.12CLT::GILBERTJuggler of NoterdomThu Mar 06 1986 01:068
It's RMS that knows about prologue-3 (and other) indexed files.
When asked to retrieve records sequentially from an indexed file,
RMS simply does it.

BTW -- I have a little hack program for finding readable strings
in files.  This is useful (for example) to find the places in an
image that reference another image, or for checking that an image
does not contain embedded text.
211.13asciizer is indeed usefulAVANTI::OSMANEric, Maynard Ma. USA, DTN 223-6664Thu Mar 06 1986 14:0626
    I wrote a program to do that back in my TOPS20 days.
    
    The program is quite useful !  For one thing, suppose you get an
    error saying
    
    		%F, No such logical name
    
    What logical name is program looking for ??  By running the
    asciizer, you may find the string containing the logical name.
    
    For another example,
    
    		% Unrecognized command
    
    What commands are legal?  Unfortunately I have no documentation.
    
    Well, the asciizer often prints out command lists, so it's useful
    here too.
    
    And of course the most useful :-) purpose of the asciizer is to
    print out all the messages from a cookie program.
    
    Peter, if you'd like to publish your program, it would be useful,
    thanks.
    
    /Eric
211.14CLT::GILBERTJuggler of NoterdomThu Mar 06 1986 22:076
    While it lasts,...

    CLT::SYS$PUBLIC:C3.A is a backup asve-set containing the executable
    and a .CLD file (for reference only).  The image is invoked by a
    foreign command, but otherwise looks like the DCL command described
    in the .CLD file.