Re: 4GL Debugger ver. 4.14 bug
Posted in 1995
In article <4bpp8i$f67@nn.fast.net>, "Chad R. Laity" <wick@pop.fast.net> writes: |> I called up Informix with a problem. When I use the RUN RETURNING |> statement in my 4GL code to run a unix script, it returns nulls for my |> returning values. |> Does anyone have a work around |> to this bug? |> 1) Write a C program that runs str where str would be any unix script |> command that I may need and return the value of that the unix script |> returns, The following should do what you want, except that it may need to be modified for your version of unix; it's set up for SunOS 4.1. To use this with RDS or the debugger, of course, you'll have to follow the instructions for building a custom runner. Hope this helps, -- Harry Bochner bochner@das.harvard.edu ----------------CUT HERE---------------- #include <sgtty.h> #include <signal.h> #include <sys/wait.h> /* $Log: runvar.c,v $ * Revision 1.7 91/11/07 17:41:58 capdev * try harder to get tty modes right: make sure we're not in RAW or CBREAK * mode. (Someday should switch to new, termio style ioctls, but easier now * to stick with old system.) * * Revision 1.6 90/03/14 17:47:18 capdev * set up new interface run_status, which works like run_var, but returns * (using 4gl conventions) the status that the child process returned. * Used for error dectection by cmd.4gl */ /* run_var: construct a cmd with two variable arguments, and pass it * to the shell. * This could be done in 4gl, using the 'run' cmd, but this leads to * unnecessary screen clearing and redisplay when the cmd is silent. */ run_var(argcnt) int argcnt; { run_x(); return(0); /* tell 4gl no values returned */ } /* alternate entry point for run_var, for cases where you need to look at * the status returned by the system() call. */ run_status(argcnt) int argcnt; { retint((long) run_x()); return(1); } run_x() { char from[201], to[201], name[101], cmd[400]; struct sgttyb oldtty, newtty; void (*sig)(); int ret_val; popquote(to, 200); popquote(from, 200); popquote(name, 100); trimstr(to); trimstr(from); trimstr(name); strcpy(cmd, name); strcat(cmd, " "); strcat(cmd, from); strcat(cmd, " "); strcat(cmd, to); /* make sure terminal settings are normal */ ioctl(1, TIOCGETP, &oldtty); newtty = oldtty; newtty.sg_flags |= CRMOD|ECHO; newtty.sg_flags &= ~(RAW|CBREAK); ioctl(1, TIOCSETP, &newtty); /* save and restore handler for stop signal * so that ^Z is handled cleanly */ sig = signal(SIGTSTP, SIG_DFL); ret_val = system(cmd); (void) signal(SIGTSTP, sig); ioctl(1, TIOCSETP, &oldtty); /* restore settings */ return(ret_val); } /* trimstr is used by runvar, and by fileprint */ trimstr(p) char *p; { register char *q; for (q=p+strlen(p); q > p; ) if (*--q != ' ') { *++q = 0; break; } }