Re: DBSCREENOUT
Posted in 1993
I've silently been watching this thread and no-one has been able to solve the original question. How can I pipe the output to whatever? Below is a function that is included with my db4glgen. The function fgl_prtscr() will send an image of the screen (windows and all) to whatever is specified in DBPRINT. If DBPRINT has not been defined, the output will go to "lp". Of course the function is not supported by Informix but neither is DBSCREENOUT. This function should be saved into a file called "fgl_prtscr.c" and compiled into your 4gl code with c4gl (compile the function into fglgo for RDS). Here are some examples of how DBPRINT can be set: DBPRINT="lp -s -dprinter2"; export DBPRINT # Output to printer2 DBPRINT="mail root"; export DBPRINT # Mail output to root DBPRINT="cat - >screen.out"; export DBPRINT # Save to file screen.out Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip /* fgl_prtscr.c * This function prints whatever is on the screen (including windows). */ #include <stdio.h> #define bool char #define CHAR short #define _ATTRIBUTE (0x7f00) #define _CHARACTER (0x00ff) #define _GRAPHMODE (0x8000) typedef struct window { short _cury, _curx; short _maxy, _maxx; short _begy, _begx; short _flags; bool _clear; bool _leave; bool _scroll; CHAR **_y; short *_firstch; short *_lastch; short _attr; } WINDOW; typedef struct _efwindow { struct _efwindow *upper, *lower; int *win; int *swin; char *formname; int *winfrm; short rows, columns; short promptline; short msgline; short formline; short cmtline; short flag; short forecolor; unsigned long ucount; } _EFwindow; extern _EFwindow *topwin, *botwin, *_Wscreen; extern WINDOW *_efbigwin; extern char *GB; fgl_prtscr(arg) int arg; { register FILE *fp; register _EFwindow *scr; register WINDOW *win; register CHAR **line, *data; register int y, x; register char c; char *getenv(), *dbprint; if ((dbprint = getenv("DBPRINT")) == NULL) dbprint = "lp -s"; if (topwin == _Wscreen) /* the user is looking at the "screen" */ win = (WINDOW * ) _Wscreen->win; else { /* the user is looking at the one or more "windows" */ win = _efbigwin; for (scr = botwin; scr != (_EFwindow * )0; scr = (_EFwindow * )scr->upper) { overwrite((WINDOW * ) scr->win, win); } } if ((fp = popen(dbprint, "w")) != (FILE * )0) { for (y = 0, line = win->_y; y < win->_maxy; y++, line++) { for (x = 0, data = *line; x < win->_maxx; x++, data++) { c = (char) *data & _CHARACTER; if ((*data & _GRAPHMODE) && *GB) { if (c == GB[0]) c = '+'; else if (c == GB[1]) c = '+'; else if (c == GB[2]) c = '+'; else if (c == GB[3]) c = '+'; else if (c == GB[4]) c = '-'; else if (c == GB[5]) c = '|'; } (void)fputc(c, fp); } (void)fputc('\\n', fp); } (void)pclose(fp); } return 0; } Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DAS -- David Snyder @ Snide Computer Services - Folcroft, PA Current Release is db4glgen-3.9 UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com