#17 RESET or FLUSH on STDIN

closed
None
5
2003-04-25
2003-04-09
Anonymous
No

Hi,

I've created an improved "more" command in Rexx, but
have been unable to use redirection or pipes because,
once the redirection is complete, I'm unable to reset
or flush STDIN. Without this, I'm unable to process
command input because Rexx thinks there's already
content in STDIN. Details:
1. Run a command like rexx more < infile.txt, where
"more" is my more.rexx program.
2. Inside more.rexx, I say,
do while lines(stdin)
l=lineout(tmpfile,linein(stdin))
end
call close(tmpfile)
3. The above works, but then later, when I run,
do forever
parse pull userinput
...
I get an infinite loop with the parse pull returning a
null string "".
4. Further investigation: when I run,
say stream(stdin, 'Command', "FLUSH")
say stream(stdin, 'Command', 'QUERY POSITION READ')
I get
READY
24772 (which is the #lines in original input file).

I'm not sure if this is a bug or an incomplete feature
in Regina, and/or a miswart in Windows (happens in both
98 and XP). This DOES work for the Windows more
command, which handles redirection/pipes and in XP has
a small command interpreter within it (show line
numbers, skip n lines, etc.)

Thanks,
Chris
cniggeler@yahoo.com

Discussion

  • Mark Hessling

    Mark Hessling - 2003-04-25

    Logged In: YES
    user_id=86185

    I'm assuming that the resolution to this is the same as for
    request #718473, so I'm also closing this request.

     
  • Mark Hessling

    Mark Hessling - 2003-04-25
    • assigned_to: nobody --> rexx
    • status: open --> closed
     
  • Nobody/Anonymous

    Logged In: NO

    I have reviewed your reply to 718473 and will check into
    that function - thanks!

    However, this is not the same issue. Think of piping a file
    to the "more" command under DOS or Unix -
    type myfiile.txt | more
    This pipes the text file thru STDIN to the more command.
    The more command _also_ reads STDIN for basic commands
    within more itself (help, scroll backwards, show line
    number, etc.).

    I have not been able to replicate this functionality in a
    Rexx program I wrote and using Regina-Rexx, because it
    appears that STDIN is not / cannot be reset after it's used
    once. I can't tell if this is a bug in Regina, a Windows 9x
    -> XP limitation, or I'm just not using STDIN correctly.

    Any further thoughts?

    Thanks,
    Chris
    cniggeler@yahoo.com

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks