display vs video sync vs ^L
Brian K. White
brian at aljex.com
Wed Jan 17 01:48:57 PST 2007
I was just playing with using a interactive program as the argument to a
printer ommand in processing.
After getting the script to capture stdin to a temp file and dealing with
some difficulties with the tty, I got it working and it greatly simplifies
the use of our destprint util.
Normally where you might say
Then: printer "lp -d someplace"
or
Then: printer "mail -s \"some subject\"" < mailaddr
etc...
I'm putting
Then: printer "destpr"
where destpr is a script that captures stdin to a temp file and then runs an
rclerk process
rclerk .... -r $tempfile <$tty
This allows me to greatly simplify the use of that printer utility.
Previousy the process looked roughly like this anywhere you wanted to print:
tmpfile = long concatenation of things to make an informative and unique
file name...
system "umask 0:>"<tmpfile
printer file tmpfile
form "someform"
printer flush ; printer reset
system "destpr " < tmpfile
x = remove(tmpfile)
now all I need is:
printer "destpr"
form "someform"
printer reset
Except... upon returning from the printer command, the screen is left mostly
blank except for the bottom of the screen prompts.
I tried putting both display and video sync after the printer reset to no
effect.
I noticed that pressing Ctrl-L does refresh the screen.
I failed to find a definitive list of special codes understuud by pushkey to
try and push a Ctrl-L from within filepro.
I finally figured out pushkey "[DRAW]" by doing "strings rclerk |less",
and then searching for a code I did know like BRKY, and luckily that panned
out and there was a nice list in there, and luckily, the pushkey actually
did cause a refresh like Ctrl-L.
(I was prepared to find that ctrl-l worked at the os or shell level as part
of the tty line discipline and stty settings, and that
trying to pushkey from inside fp wouldn't have the desired effect, that it
needs to come from the terminal for real, happy surprise it actually works)
My question is, is that really the only way to get the screen to redraw?
I never like relying on pushkeys. Just seems too Rube Goldberg.
The descriptions for display and video sync both say they will redraw the
screen, why don't they?
Btw this is @key processing so a screen command isn't indicated.
Besides, I tried that and the screen stayed blank. It went into update mode
because the cursor went to the place on the screen where the first field
would be if it were visible.
Also, it would be super duper if there was some way to control how a sub
process like a printer command gets run.
In this case, after getting all this working, I think I really can't use it
anyways because:
The sub process is getting run as user filepro.
This, (or something) causes the rclerk process to be unable to read or write
the tty the user is on.
I have made it work though by putting chmod 666 $tty in /etc/profile.local
I don't want to do that for real though because I really don't want root's
tty's to be world writeable!
I could exclude root from that command, or maybe use 660 which might allow
all users to work as long as users and filepro are all in the same group,
but then the process woudn't work for root and I can't use this unless it
works both for root and users equally.
PFSYSEUID had no effect on this either way.
Maybe PFPOSTPRINT is a possible workaround, I haven't tried that yet, but
it's only useful if it can be selectively applied and revoked like a printer
command. I can't have it just in the env all the time, or even all during a
given clerk session.
Brian K. White -- brian at aljex.com -- http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
More information about the Filepro-list
mailing list