Getting pagesize (boring..)
Posted in 1991
Could some kind soul please show me a better way of getting the page size used by Turbo/Online than the code at the bottom ? Something that worked in just 4GL would be best, or it'd be nice if it was #defined somewhere ... -- Cheers - Tony. ____________________________________________________________________________ Who: Tony Heskett | DHL Systems Ltd, Kings House, How: theskett@lhr-sys.ssf-sys.dhl.com | Great West Road, Brentford, TW8 9HS Vox: (+44) 81 747 8330 x 363 | Fax: (+44) 81 747 0875 ____________________________________________________________________________ /* 4GL calling code: MAIN DEFINE pagesize INTEGER CALL getpsize() RETURNING pagesize DISPLAY pagesize END MAIN */ #include <stdio.h> #include <string.h> #include <ctype.h> #define MAXCHARS 100 void perror(); int getpsize(nargs) int nargs; { char buffer[MAXCHARS]; char * cptr; FILE * confptr; if (nargs != 0) { (void) fprintf(stderr, "getpsize: bad args\\n"); retint(-1); return 1; } /* easier that checking $INFORMIXDIR and $TBCONFIG, also we may not be able to read tbconfig file directly */ if ((confptr = popen("tbstat -c", "r")) == NULL) { perror("tbstat -c"); retint(-1); return 1; } /* look for BUFFSIZE in tbconfig info */ while (fgets(buffer, MAXCHARS, confptr) != NULL) if (*buffer != '#' && strncmp(buffer, "BUFFSIZE", 8) == 0) break; /* skip upto number of bytes */ for (cptr = buffer; *cptr && !isdigit(*cptr); cptr++) ; /* return number of bytes */ retint(atoi(cptr)); return 1; }