Re: Screen flashing
Posted in 1993
In article <1k9pa2INNf1g@emory.mathcs.emory.edu>, jparker@hpbs2561.boi.hp.com (Jack Parker) writes: |> Quoting Walt Hultgren. |> > I thought my problem might be related to the fact that the functions in |> > question used the RUN statement. Oh, yes, when you use RUN, Informix has no way of knowing what the program you ran did to the screen, so it clears the screen and starts over. Wasn't it that way back in 2.10.03? I guess I don't remember. |> Ok, now that Walt has pointed this out.... Is there a fix? IF you know that the thing that you're running is silent, i.e. no output to the screen, then you can run it from C code. That way the Informix libraries don't know what you've done ... I've got C routines to do this that can be called from 4GL. I think Walt's got them in his ftp archive mathcs.emory.edu, but I've attached a copy below. This code should work on any BSD-based Unix, I think; I don't know about SVR4. If you use RDS, you can link this into a custom runner: that's how I use it. -- Harry Bochner bochner@das.harvard.edu -----------------------------CUT HERE----------------------------------- #!/bin/sh # # This is a shell archive. To extract its contents, # execute this file with /bin/sh to create the file(s): # # fgl_run_funcs.c # # This shell archive created: Wed Dec 11 14:22:20 EST 1991 # echo "Extracting file fgl_run_funcs.c" sed -e 's/^X//' <<\\++EOF++EOF++ > fgl_run_funcs.c X/* fgl_run_funcs.c X * X * X * Summary: C Functions to run system commands from I4GL X * X * Environment: SunOS 4.1, Informix-4GL X * X * Submitted by: Harry Bochner <bochner@das.harvard.edu> X * X * X * Immeditately prior to executing a system command with the RUN statement, X * Informix-4GL sets up the terminal for "normal" processing. This usually X * results in at least a screen clear, which is often unnecessary or X * unwanted. X * X * These routines demonstrate one method of using C function calls to run X * system commands that will perform no terminal I/O. They should be X * tailored for your specific application. X * X */ X X X#include <sgtty.h> X#include <signal.h> X#include <sys/wait.h> X X X/* run_var: construct a cmd with two variable arguments, and pass it X * to the shell. X * This could be done in 4gl, using the 'run' cmd, but this leads to X * unnecessary screen clearing and redisplay when the cmd is silent. X */ Xrun_var(argcnt) Xint argcnt; X{ X run_x(); X return(0); X} X X X/* alternate entry point for run_var, for cases where you need to look at X * the status returned by the system() call. X */ Xrun_status(argcnt) Xint argcnt; X{ X retint((long) run_x()); X return(1); X} X X Xrun_x() X{ char from[201], to[201], name[101], cmd[400]; X struct sgttyb oldtty, newtty; X void (*sig)(); X int ret_val; X X popquote(to, 200); X popquote(from, 200); X popquote(name, 100); X X trimstr(to); X trimstr(from); X trimstr(name); X X strcpy(cmd, name); X strcat(cmd, " "); X strcat(cmd, from); X strcat(cmd, " "); X strcat(cmd, to); X X /* make sure terminal settings are normal */ X ioctl(1, TIOCGETP, &oldtty); X newtty = oldtty; X newtty.sg_flags |= CRMOD|ECHO; X newtty.sg_flags &= ~(RAW|CBREAK); X ioctl(1, TIOCSETP, &newtty); X X /* save and restore handler for stop signal X * so that ^Z is handled cleanly X */ X sig = signal(SIGTSTP, SIG_DFL); X X ret_val = system(cmd); X X (void) signal(SIGTSTP, sig); X ioctl(1, TIOCSETP, &oldtty); /* restore settings */ X return(ret_val); /* tell 4gl no values returned */ X} X X Xtrimstr(p) Xchar *p; X{ register char *q; X X for (q=p+strlen(p); q > p; ) X if (*--q != ' ') { X *++q = 0; X break; X } X} ++EOF++EOF++ if [ `wc -c < fgl_run_funcs.c` -ne 2266 ] then echo "Lengths do not match -- Bad Copy of fgl_run_funcs.c" fi echo "Done."