dougm@lakesys.UUCP (Doug McIntyre) (02/19/89)
I am having a problem with MicroEmacs v3.9e, and was wondering what
I'm doing wrong. I am writing an unshar utility in emacs, and ran accross a
new format that I had to redo the one I already have. What I am trying to
do is pick up the first word from a line of text read from a buffer...
Here is what I have so far.... Basically a lot of simple stuff to make sure
that everything is working correctly..
------------------------------
set %sharsep "SHAR_EOF"
beginning-of-file
search-forward %sharsep
!while ¬ &seq $status FALSE ; looking for a line like....
beginning-of-line
search-forward ">" ; sed >command.h <<SHAR_EOF
set %shbuf $cbufname
set %nametemp #$cbufname ; and %name is set to command.h+++
set %pos &sindex %nametemp " " ; here we find space after command.h
set %pos &sub %pos 1 ; adjust to # of chars in filename
set %name &left %nametemp %pos ; grab %pos characters from %name
next-line ; go to beginning of shar file..
beginning-of-line
set-mark ; copy from here...
search-forward %sharsep
beginning-of-line
copy-region ; to the char right before SHAR_EOF
select-buffer %name ; Then go to buffer command.h
change-file-name %name ; set the file name to command.h
yank ; and yank it in..
select-buffer %shbuf ; go back to shar file..
write-message &cat "Done with file " %name
search-forward %sharsep ; finds SHAR_EOF of file just copied
search-forward %sharsep ; finds begining of next...
!endwhile
---------
Well everything works just fine, but the %name variable turns up garbage,
while I'm expecting to copy the left (%pos)most characters..
and so I get garbage buffer names and files, which really can't be saved off
after editing..
--
------------------------------------------------------------------------------
UUCP: uunet!marque!lakesys!dougm Compuserve: 70611,2215
INET: dougm@lakesys.lakesys.COM APLE: DougMac
------------------------------------------------------------------------------