[Vim-vms] Record format and attributes problems in VIM on VMS

Coen Engelbarts coen.engelbarts at cmg.nl
Thu Feb 5 13:51:17 CET 2004


vim-vms-bounces at polarhome.com wrote on Wednesday 4 February 2004 17:02:

 > Vim uses block, binary write on C level (without sys$ calls), but
 > sometimes it has a very strange behaviour.

 >          * On VMS there is a problem: newlines get added when writing
 > blocks
 >          * at a time. Fix it by writing a line at a time.
 >          * This is much slower!

FWIW: Years ago I had a similar problem on MS-DOS. IIRC, MS-DOS added a 
LF (ASCII 10) after every CR (ASCII 13). On MS-DOS, you can solve this 
by opening the file explicitly in binary mode with:
     fopen(file, "wb");
i.e add a "b" to the mode string.

 From the Linux man page for fopen():

        The mode string can also include the letter  ``b''  either
        as  a last character or as a character between the charac­
        ters in any of the two-character strings described  above.
        This  is  strictly for compatibility with ANSI X3.159-1989
        (``ANSI C'') and has no effect; the ``b''  is  ignored  on
        all  POSIX  conforming  systems,  including Linux.  (Other
        systems may treat text files and binary files differently,
        and adding the ``b'' may be a good idea if you do I/O to a
        binary file and expect that your program may be ported  to
        non-Unix environments.)

I doubt that this solution will work on VMS (which AFAIK was the first 
POSIX compliant OS, even before any Unix version), but I thought I'd 
mention it just in case.


 >          * Explanation: Vim can not handle, so far, variable record
 > format.

I suppose that the proper solution would be to add native RMS file 
handling to Vim, but I'm not an RMS-expert either.
All I know is that DEC/Compaq/HP-C supports extensions to fopen() etc., 
which allow you to specify RMS-attributes.

Regards,

Coen


As an aside: My MS-DOS program at the time was a simulation/test tool 
for a big egg sorting machine, and the "binary" file contained the 
weights of eggs in the simulated machine. It was quite weird to see the 
program create (dare I say "lay"?) eggs at seemingly random places, 
until I realised that they all weighed _exacly_ 10 grams and were 
_always_ preceded by a 13-gram egg...
Dûh!
:-}




More information about the Vim-vms mailing list