Re: Way to get list of all databases?
Posted in 1992
In article <1992Jul29.193215.16577@techmpc.csg.gss.mot.com> daves@techmpc.csg.gss.mot.com (Dave Schmitt) writes: >Based on the sqgetdbs() call mentioned in another article, I put together >the following stand-alone C program that lists available databases. ... >Unfortunately, you need RDS or ESQL in order to compile because of >library routines required by "libsql.a". ... >X# >X# The following symbols are not available in the sql library, nor in the >X# compiled C 4gl development package, either: >X# >X# frmcmpr >X# compact >X# >X# You need either the RDS or ESQL package in order to compile. If you can't find these functions in any library, then this code seems to work for me... (modulo your mileage) -------cut here------------------------------------------------ extern int strcmp(); /* * the string compare function for qsort() */ int frmcmpr(p, q) char **p; char **q; { return strcmp(*p, *q); } /* * remove duplicates from a sorted array of strings * return the number of elements in the compacted array */ int compact(list, n) char **list; int n; { char **s, **p; s=list; for (p=list+1; p<list+n; ++p) { if (strcmp(*s, *p) != 0) { ++s; *s = *p; } } return s-list+1; } -- Hugh Grierson Fujitsu/ICL New Zealand - Software Development Centre hugh@nezsdc.icl.co.nz Speaking for myself only. See figure 1.