19 #include "nomos_regex.h"
20 #include "nomos_utils.h"
22 #define MM_CACHESIZE 20
25 #ifdef REUSE_STATIC_MEMORY
26 static char grepzone[10485760];
33 static char utilbuf[myBUFSIZ];
35 static char cmdBuf[PATH_MAX * 2 + 256];
39 #define MEMCACHESIZ 200000
40 static int memlast = -1;
41 static struct mm_cache memcache[MEMCACHESIZ];
53 traceFunc(
"== isDIR(%s)\n", dpath);
56 return(
isINODE(dpath, S_IFDIR));
68 traceFunc(
"== isEMPTYFILE(%s)\n", fpath);
74 return(cur.stbuf.st_size == 0);
86 traceFunc(
"== isBLOCK(%s)\n", bpath);
89 return(
isINODE(bpath, S_IFBLK));
101 traceFunc(
"== isCHAR(%s)\n", cpath);
104 return(
isINODE(cpath, S_IFCHR));
116 traceFunc(
"== isPIPE(%s)\n", ppath);
119 return(
isINODE(ppath, S_IFIFO));
131 traceFunc(
"== isSYMLINK(%s)\n", spath);
134 return(
isINODE(spath, S_IFLNK));
146 char sErrorBuf[1024];
149 traceFunc(
"== isINODE(%s, 0x%x)\n", ipath, typ);
152 if ((ret = stat(ipath, &cur.stbuf)) < 0) {
158 if (errno == ENOENT) {
161 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
162 LOG_ERROR(
"Error: %s getting stat on file: %s", sErrorBuf, ipath)
167 return((
int)(cur.stbuf.st_mode & S_IFMT & typ));
177 static char newpath[myBUFSIZ];
181 traceFunc(
"== newReloTarget(%s)\n", basename);
185 (void) snprintf(newpath,
sizeof(newpath),
"%s_%s-renamed.%03d", basename, gl.
progName, i);
186 if (access(newpath, F_OK) && errno == ENOENT) {
191 LOG_FATAL(
"%s: no suitable relocation target (%d tries)", basename, i)
199 #ifdef MEMORY_TRACING
205 char *memAllocTagged(
int size,
char *name)
215 #if defined(PROC_TRACE) || defined(MEM_ACCT)
216 traceFunc(
"== memAllocTagged(%d, \"%s\")\n",
size, name);
220 LOG_FATAL(
"Cannot alloc %d bytes!",
size)
223 if (++memlast == MEMCACHESIZ) {
224 LOG_FATAL(
"*** memAllocTagged: out of memcache entries")
228 if ((ptr = calloc((
size_t) 1, (
size_t)
size)) == (
void *) NULL) {
229 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
230 LOG_FATAL(
"calloc for %s, error: %s", name, sErrorBuf)
234 if ((ptr = malloc((
size_t)
size)) == (
void *) NULL) {
235 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
236 LOG_FATAL(
"malloc for %s, error: %s", name, sErrorBuf)
239 (void) memset(ptr, 0, (
size_t)
size);
241 #if DEBUG > 3 || defined(MEM_ACCT)
242 printf(
"+%p:%p=(%d)\n", ptr, ptr+
size-1,
size);
244 memcache[memlast].mmPtr = ptr;
245 memcache[memlast].size =
size;
246 strncpy(memcache[memlast].
label, name,
sizeof(memcache[memlast].
label) - 1);
247 memcache[memlast].label[
sizeof(memcache[memlast].label) - 1] =
'\0';
249 printf(
"memAllocTagged(%d, \"%s\") == %p [entry %04d]\n",
size, name, ptr,
257 void memFreeTagged(
void *ptr,
char *note)
262 #if defined(PROC_TRACE) || defined(MEM_ACCT)
263 traceFunc(
"== memFree(%p, \"%s\")\n", ptr, note);
266 #ifdef MEMORY_TRACING
267 DEBUG(
"mprobe(%p)\n", ptr)
270 for (mmp = memcache, i = 0; i <= memlast; mmp++, i++) {
271 if (mmp->
mmPtr == ptr) {
273 printf(
"memFree(%p, \"%s\") is entry %04d (%d bytes)\n", ptr, note, i,
280 LOG_FATAL(
"Could not locate %p to free!", ptr)
284 #if DEBUG > 3 || defined(MEM_ACCT)
285 printf(
"-%p=(%d)\n", ptr, mmp->
size);
288 (void) memmove(&memcache[i], &memcache[i+1],
289 (memlast-i)*
sizeof(
struct mm_cache));
291 memset(&memcache[memlast], 0,
sizeof(
struct mm_cache));
294 memCacheDump(
"post-memFree:");
300 void memCacheDump(
char *
s)
303 static int first = 1;
310 printf(
"%%%%%% mem-cache is EMPTY\n");
313 start = (memlast > 50 ? memlast-50 : 0);
314 printf(
"%%%%%% mem-cache @ %p [last=%d]\n", memcache, memlast);
315 for (m = memcache+
start, i =
start; i <= memlast; m++, i++) {
316 printf(
"mem-entry %04d: %p (%d) - %s\n", i, m->
mmPtr,
319 printf(
"... \"%s\"\n", m->
mmPtr);
322 printf(
"%%%%%% mem-cache END\n");
346 traceFunc(
"== findBol(%p, %p)\n",
s, upperLimit);
352 for (cp =
s; cp > upperLimit; cp--) {
354 DEBUG(
"cp %p upperLimit %p\n", cp, upperLimit)
358 DEBUG(
"Got it! BOL == %p\n", cp)
360 return((
char*)(cp+1));
363 if (cp == upperLimit) {
365 DEBUG(
"AT upperLimit %p\n", upperLimit);
384 traceFunc(
"== findEol(%p)\n",
s);
413 char sErrorBuf[1024];
418 #if defined(PROC_TRACE) || defined(UNPACK_DEBUG)
419 traceFunc(
"== renameInode(%s, %s)\n", oldpath, newpath);
423 (void)
mySystem(
"ls -ldi '%s'", oldpath);
425 if (rename(oldpath, newpath) < 0) {
426 if (errno == EXDEV) {
427 err =
mySystem(
"mv '%s' %s", oldpath, newpath);
433 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
434 LOG_FATAL(
"rename(%s, %s) error: %s", oldpath, newpath, sErrorBuf)
439 (void)
mySystem(
"ls -ldi %s", newpath);
453 char sErrorBuf[1024];
458 #if defined(PROC_TRACE) || defined(UNPACK_DEBUG)
459 traceFunc(
"== chmodInode(%s, 0%o)\n", pathname, mode);
462 if (chmod(pathname, mode) < 0) {
463 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
464 LOG_FATAL(
"chmod(\"%s\", 0%o) error: %s", pathname, mode, sErrorBuf)
480 char sErrorBuf[1024];
487 traceFunc(
"== fopenFile(%s, \"%s\")\n", pathname, mode);
490 if ((fp = fopen(pathname, mode)) == (FILE *) NULL) {
491 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
492 LOG_FATAL(
"fopen(%s) error: %s", pathname, sErrorBuf);
525 char sErrorBuf[1024];
532 traceFunc(
"== popenProc(\"%s\", %s)\n", command, mode);
535 if ((pp = popen(command, mode)) == (FILE *) NULL) {
536 #ifdef MEMORY_TRACING
537 memCacheDump(
"Post-popen-failure:");
539 strerror_r(errno, sErrorBuf,
sizeof(sErrorBuf));
540 LOG_FATAL(
"popen(\"%s\") error: %s", command, sErrorBuf)
554 static char wcbuf[64];
559 traceFunc(
"== wordCount(%p)\n", textp);
563 for (cp = textp; *cp; cp++) {
579 (void) snprintf(wcbuf,
sizeof(wcbuf),
"%d lines", lines);
600 traceFunc(
"== copyString(%p, \"%s\")\n",
s,
label);
603 cp = memAlloc(len=(strlen(
s)+1),
label);
605 printf(
"+CS: %d @ %p\n", len, cp);
607 (void) strcpy(cp,
s);
621 traceFunc(
"== pathBasename(\"%s\")\n", path);
624 cp = strrchr(path,
'/');
625 return(cp ==
NULL_STR ? path : (
char *)(cp+1));
637 static char *ibuf = NULL;
638 static int bufmax = 0;
639 char *sep =
_REGEX(_UTIL_XYZZY);
650 int regexFlags = REG_ICASE|REG_EXTENDED;
652 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG) || defined(DOCTOR_DEBUG)
653 traceFunc(
"== getInstances(%p, %d, %d, %d, \"%s\", %d)\n", textp,
size,
654 nBefore, nAfter, regex, recordOffsets);
657 if ((notDone =
strGrep(regex, textp, regexFlags)) == 0) {
659 printf(
"... no match: 1st strGrep()\n");
670 p->seqNo = cur.offList.
used;
673 if (p->bList) free(p->bList);
674 p->bList = (
list_t *)memAlloc(
sizeof(
list_t), MTAG_LIST);
675 (void) snprintf(utilbuf,
sizeof(utilbuf),
"\"%c%c%c%c%c%c%c%c%c%c\" match-list",
676 *regex, *(regex+1), *(regex+2), *(regex+3), *(regex+4),
677 *(regex+5), *(regex+6), *(regex+7), *(regex+8), *(regex+9));
679 printf(
"Creating %s\n", utilbuf);
685 LOG_FATAL(
"Called getInstances(%s) more than once", regex)
690 #ifdef REUSE_STATIC_MEMORY
693 bufmax =
sizeof(grepzone);
695 else if (ibuf != grepzone) {
698 bufmax =
sizeof(grepzone);
702 ibuf = memAlloc((bufmax = 1024*1024), MTAG_SEARCHBUF);
712 printf(
"getInstances: \"%s\" [#1] in buf [%d-%d]\n", regex,
713 cur.regm.rm_so, cur.regm.rm_eo-1);
714 printf(
"Really in the buffer: [");
715 for (cp = textp + cur.regm.rm_so; cp < (textp + cur.regm.rm_eo); cp++) {
726 fileeof = (
char *) (textp+
size);
730 printf(
"... found Match #%d\n", p->nMatch);
733 (void) snprintf(utilbuf,
sizeof(utilbuf),
"buf%05d", p->nMatch);
742 if ((nBefore > 0) && (
start > textp)) {
743 for (i = 0; (i < nBefore) && (
start > textp); i++) {
752 DEBUG(
"start = %p\n",
start)
757 bp->bStart =
start-textp;
775 curptr += cur.regm.rm_eo;
781 for (i = 0; end < fileeof; end++) {
787 LOG_FATAL(
"lost the end-of-line")
797 if ((end < fileeof) && *end) {
802 printf(
"Snippet, with %d lines below:\n----\n", nAfter);
803 for (cp =
start; cp < end; cp++) {
808 notDone =
strGrep(regex, curptr, regexFlags);
811 printf(
"... next match @ %d:%d (end=%d)\n",
812 curptr - textp + cur.regm.rm_so,
813 curptr - textp + cur.regm.rm_eo - 1, end - textp);
816 if ((curptr + cur.regm.rm_eo) > fileeof) {
821 if ((curptr + cur.regm.rm_eo) > end) {
836 bp->bLen = end-
start;
840 printf(
"%s starts @%d, len %d ends [%c%c%c%c%c%c%c]\n",
841 utilbuf, bp->bStart, bp->bLen, *(end-8), *(end-7),
842 *(end-6), *(end-5), *(end-4), *(end-3), *(end-2));
845 newDataLen = end-
start+(notDone ? strlen(sep)+1 : 0);
846 while (buflen+newDataLen > bufmax) {
849 Assert(
NO,
"data(%d) > bufmax(%d)", buflen+newDataLen,
854 printf(
"... DOUBLE search-pattern buffer (%d -> %d)\n",
857 new = memAlloc(bufmax, MTAG_DOUBLED);
858 (void) memcpy(
new, ibuf, buflen);
860 printf(
"REPLACING buf %p(%d) with %p(%d)\n", ibuf,
861 bufmax/2,
new, bufmax);
863 #ifdef REUSE_STATIC_MEMORY
864 if (ibuf != grepzone) {
872 cp = bufmark = ibuf+buflen-1;
873 buflen += newDataLen;
874 int remaining = bufmax - (bufmark - ibuf);
875 int written = snprintf(bufmark, remaining,
"%s",
start);
876 bufmark += (written >= remaining) ? remaining - 1 : written;
878 remaining = bufmax - (bufmark - ibuf);
879 written = snprintf(bufmark, remaining,
"%s\n", sep);
880 bufmark += (written >= remaining) ? remaining - 1 : written;
896 printf(
"Loop end, BUF IS NOW: [\"%s\":%d]\n----\n%s====\n",
897 regex, strlen(ibuf), ibuf);
901 #if defined(PHRASE_DEBUG) || defined(DOCTOR_DEBUG)
902 printf(
"getInstances(\"%s\"): Found %d bytes of data...\n", regex,
906 printf(
"getInstances(\"%s\"): buffer %p --------\n%s\n========\n",
920 static char datebuf[32];
925 (void) ctime_r(&thyme, datebuf);
926 if ((cp = strrchr(datebuf,
'\n')) ==
NULL_STR) {
927 LOG_FATAL(
"Unexpected time format from ctime_r()!")
936 void memStats(
char *
s)
938 static int first = 1;
939 static char mbuf[128];
943 snprintf(mbuf,
sizeof(mbuf),
"grep VmRSS /proc/%d/status", getpid());
948 for (i = (
int) (strlen(
s)+2); i < 50; i++) {
954 system(
"grep Vm /proc/self/status");
955 system(
"grep Brk /proc/self/status");
967 #if defined(PROC_TRACE) || defined(UNPACK_DEBUG)
968 traceFunc(
"== makeSymlink(%s)\n", path);
971 (void) snprintf(cmdBuf,
sizeof(cmdBuf),
".%s", strrchr(path,
'/'));
972 if (symlink(path, cmdBuf) < 0) {
974 LOG_FATAL(
"Failed: symlink(%s, %s)", path, cmdBuf)
997 static char misc[64];
1003 traceFunc(
"== printRegexMatch(%d, %d)\n", n, cached);
1013 save_so = cur.regm.rm_so;
1014 save_eo = cur.regm.rm_eo;
1020 printf(
"Match [%d:%d]\n", save_so, save_eo);
1023 (void) snprintf(misc,
sizeof(misc),
"=#%03d", n);
1024 if (
strGrep(misc, textp, REG_EXTENDED)) {
1026 printf(
"Patt: %s\nMatch: %d:%d\n", misc,
1027 cur.regm.rm_so, cur.regm.rm_eo);
1029 x = textp + cur.regm.rm_so;
1030 cp = textp + cur.regm.rm_so;
1032 while (*--x !=
'[') {
1034 LOG_FATAL(
"Cannot locate debug symbol")
1039 (void) strncpy(misc, x, cp - x);
1042 strncpy(misc,
"?",
sizeof(misc) - 1);
1043 misc[
sizeof(misc) - 1] =
'\0';
1050 printf(
"RESTR [%d:%d]\n", cur.regm.rm_so, cur.regm.rm_eo);
1053 cur.regm.rm_so = save_so;
1054 cur.regm.rm_eo = save_eo;
1055 printf(
"%s regex %d ", cached ?
"Cached" :
"Found", n);
1057 printf(
"(%s) ", misc);
1060 printf(
"\"%s\"",
_REGEX(n));
1064 printf(
"Seed: \"%s\"\n",
_SEED(n));
1078 for (pBuf = Buffer; BufferSize--; pBuf++)
1079 if (*pBuf == 0) *pBuf =
' ';
1097 traceFunc(
"== mmapFile(%s)\n", pathname);
1100 for (mmp = mmap_data, i = 0; i <
MM_CACHESIZE; i++, mmp++) {
1101 if (mmp->
inUse == 0) {
1112 if ((mmp->
fd = open(pathname, O_RDONLY)) < 0) {
1113 if (errno == ENOENT) {
1116 mmp->
mmPtr = (
void *) NULL;
1118 printf(
"mmapFile: ENOENT %s\n", pathname);
1123 (void)
mySystem(
"ls -l %s", pathname);
1124 LOG_FATAL(
"%s: open failure!", pathname)
1128 if (fstat(mmp->
fd, &cur.stbuf) < 0) {
1129 printf(
"fstat failure!\n");
1133 if (S_ISDIR(cur.stbuf.st_mode)) {
1134 printf(
"mmapFile(%s): is a directory\n", pathname);
1138 strncpy(mmp->
label, pathname,
sizeof(mmp->
label) - 1);
1140 if (cur.stbuf.st_size)
1142 mmp->
size = cur.stbuf.st_size + 1;
1143 mmp->
mmPtr = memAlloc(mmp->
size, MTAG_MMAPFILE);
1145 printf(
"+MM: %lu @ %p\n", mmp->
size, mmp->
mmPtr);
1158 if ((n = (
int) read(mmp->
fd, cp, (
size_t) rem)) < 0) {
1162 LOG_WARNING(
"nomos read error: %s, file: %s, read size: %d, pfile_pk: %ld\n", strerror(errno), pathname, rem, cur.
pFileFk);
1171 return((
char *) mmp->
mmPtr);
1176 (void) close(mmp->
fd);
1178 Assert(
NO,
"mmapFile: returning NULL");
1184 void mmapOpenListing()
1189 printf(
"=== mm-cache BEGIN ===\n");
1190 for (mmp = mmap_data, i = 0; i <
MM_CACHESIZE; i++, mmp++) {
1192 printf(
"mm[%d]: (%d) %s:%d\n", i, mmp->
fd,
1196 printf(
"--- mm-cache END ---\n");
1210 traceFunc(
"== munmapFile(%p)\n", ptr);
1213 if (ptr == (
void *) NULL) {
1215 Assert(
NO,
"NULL sent to munmapFile()!");
1219 for (mmp = mmap_data, i = 0; i <
MM_CACHESIZE; i++, mmp++) {
1220 if (mmp->
inUse == 0) {
1223 if (mmp->
mmPtr == ptr) {
1225 printf(
"munmapFile: clearing entry %d\n", i);
1229 (void) munmap((
void *) ptr, (size_t) mmp->
size);
1232 if (close(mmp->
fd) < 0) {
1237 mmp->buf = (
void *) NULL;
1241 printf(
"DEBUG: munmapFile: freeing %lu bytes\n",
1263 char *eofaddr = NULL;
1267 traceFunc(
"== bufferLineCount(%p, %d)\n", p, len);
1273 eofaddr = (
char *) (p+len);
1274 for (i = 0, cp = p; cp <= eofaddr; cp++, i++) {
1280 printf(
"bufferLineCount == %d\n", i);
1295 traceFunc(
"== appendFile(%s, \"%s\")\n", pathname, str);
1299 fprintf(fp,
"%s\n", str);
1314 len = vsnprintf(cmdBuf,
sizeof(cmdBuf), fmt, ap);
1317 if(len < 0 || (
size_t)len >=
sizeof(cmdBuf)) {
1318 LOG_ERROR(
"mySystem: command truncated (%d bytes needed, buffer is %zu bytes)",
1319 len,
sizeof(cmdBuf));
1323 #if defined(PROC_TRACE) || defined(UNPACK_DEBUG)
1324 traceFunc(
"== mySystem('%s')\n", cmdBuf);
1327 ret = system(cmdBuf);
1328 if (WIFEXITED(ret)) {
1329 ret = WEXITSTATUS(ret);
1332 LOG_ERROR(
"system(%s) returns %d", cmdBuf, ret)
1336 else if (WIFSIGNALED(ret)) {
1337 ret = WTERMSIG(ret);
1338 LOG_ERROR(
"system(%s) died from signal %d", cmdBuf, ret)
1340 else if (WIFSTOPPED(ret)) {
1341 ret = WSTOPSIG(ret);
1342 LOG_ERROR(
"system(%s) stopped, signal %d", cmdBuf, ret)
1357 traceFunc(
"== isFILE(%s)\n", pathname);
1360 return(
isINODE(pathname, S_IFREG));
1371 int addEntry(
char *pathname,
int forceFlag,
const char *fmt, ...)
1374 vsnprintf(utilbuf,
sizeof(utilbuf), fmt, ap);
1378 traceFunc(
"== addEntry(%s, %d, \"%s\")\n", pathname, forceFlag, utilbuf);
1382 Assert(
YES,
"addEntry - NULL pathname");
1384 if (forceFlag || !
lineInFile(pathname, utilbuf)) {
1395 void Msg(
const char *fmt, ...)
1398 (void) vprintf(fmt, ap);
1408 void Assert(
int fatalFlag,
const char *fmt, ...)
1411 (void) snprintf(utilbuf,
sizeof(utilbuf),
"ASSERT: ");
1412 int offset = strlen(utilbuf);
1413 int remaining_len =
sizeof(utilbuf) - offset;
1414 (void) vsnprintf(utilbuf + offset, remaining_len, fmt, ap);
1418 traceFunc(
"!! Assert(\"%s\")\n", utilbuf+strlen(gl.
progName)+3);
1421 (void) strcat(utilbuf,
"\n");
1430 void traceFunc(
char *fmtStr, ...)
1434 #ifdef PROC_TRACE_SWITCH
1437 va_start(args, fmtStr);
1439 vprintf(fmtStr, args);
1441 #ifdef PROC_TRACE_SWITCH
1448 char *memAllocLogged(
int size)
1452 ptr = calloc(
size, 1);
1453 printf(
"%p = calloc( %d , 1 )\n", ptr,
size);
1457 void memFreeLogged(
void *ptr)
1459 printf(
"free( %p )\n", ptr);
int s
The socket that the CLI will use to communicate.
item_t * listGetItem(list_t *l, char *s)
get an item from the itemlist. If the item is not in the itemlist, then add it to the itemlist.
void listInit(list_t *l, int size, char *label)
intialize a list, if the list is not empty, empty it (initialize it to zero's).
char * findBol(char *s, char *upperLimit)
Find Begin of Line in a string.
int isSYMLINK(char *spath)
Check if given path is a symbolic link.
void munmapFile(void *ptr)
void ReplaceNulls(char *Buffer, int BufferSize)
Replace all nulls in Buffer with blanks.
FILE * fopenFile(char *pathname, char *mode)
Open a file and return the file pointer.
int isFILE(char *pathname)
Check if an inode is a file.
int isINODE(char *ipath, int typ)
Check for a inode against a flag.
int isEMPTYFILE(char *fpath)
Check if given file is empty.
void printRegexMatch(int n, int cached)
CDB – Need to review this code, particularly for the use of an external file (Nomos....
char * pathBasename(char *path)
Get the basename from a file path.
char * getInstances(char *textp, int size, int nBefore, int nAfter, char *regex, int recordOffsets)
Get occurrence of a regex in a given string pointer.
FILE * popenProc(char *command, char *mode)
Open a process pipe using popen()
int isDIR(char *dpath)
Check if given path is a directory.
char * copyString(char *s, char *label)
Create a copy of a string.
int isPIPE(char *ppath)
Check if given path is a pipe.
char * curDate()
Get the current date.
void Assert(int fatalFlag, const char *fmt,...)
Raise an assert.
char * wordCount(char *textp)
VERY simple line count, does NOT have to be perfect!
void renameInode(char *oldpath, char *newpath)
Rename an inode at oldpath to newpath.
int mySystem(const char *fmt,...)
Run a system command.
int isBLOCK(char *bpath)
Check if given path is a Block device.
#define MM_CACHESIZE
MM Cache size.
int bufferLineCount(char *p, int len)
Finds the length of first line in a buffer.
void appendFile(char *pathname, char *str)
Append a string at the end of the file.
void chmodInode(char *pathname, int mode)
Change inode mode bits.
void makeSymlink(char *path)
Create symbolic links for a given path in current directory.
char * findEol(char *s)
Find first ROL in a string.
void Msg(const char *fmt,...)
DO NOT automatically add to a string passed to Msg(); in parseDistro, we sometimes want to dump a p...
int addEntry(char *pathname, int forceFlag, const char *fmt,...)
adds a line to the specified pathname
int isCHAR(char *cpath)
Check if given path is a character device.
char * mmapFile(char *pathname)
Blarg. Files that are EXACTLY a multiple of the system pagesize do not get a NULL on the end of the b...
char * newReloTarget(char *basename)
Check if a relocation target is accessible.
char debugStr[myBUFSIZ]
Debug string.
#define NULL_STR
NULL string.
#define MAX_RENAME
Max rename length.
#define isEOL(x)
Check if x points to a EOL character.
void Bail(int exitval)
Close connections and exit.
#define NULL_CHAR
NULL character.
int lineInFile(char *pathname, char *regex)
Check if a line exists in a file.
int strGrep(char *regex, char *data, int flags)
General-purpose grep function, used for one-time-only searches.
start($application)
start the application Assumes application is restartable via /etc/init.d/<script>....
char initwd[myBUFSIZ]
CDB, would like to workaround/eliminate.
char progName[64]
Program name.
list_t type structure used to keep various lists. (e.g. there are multiple lists).
tricky data structure used for a list of 'items'
Store the results of a regex match.
char label[myBUFSIZ]
Label.
void * mmPtr
Memory pointer.