/* ** tuiShowLocatorContent() */ void tuiShowLocatorContent (void) { char *string; TuiGenWinInfoPtr locator; locator = locatorWinInfoPtr (); if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL) { string = displayableWinContentAt (locator, 0); if (string != (char *) NULL) { wmove (locator->handle, 0, 0); wstandout (locator->handle); waddstr (locator->handle, string); wstandend (locator->handle); tuiRefreshWin (locator); wmove (locator->handle, 0, 0); if (string != nullStr ()) tuiFree (string); locator->contentInUse = TRUE; } } return; } /* tuiShowLocatorContent */
/** * Write all user-specified option values to a buffer. * The buffer is dynamically allocated and must be freed by the caller. * * @param table pointer to the option table * @return pointer to text buffer */ char * logOptionValues(const optionTable_t *table) { char *res = myStrdup("\tspecified options or config values:\n"); char *tmp; char buf[1024]; const optionTable_t *tableptr; for(tableptr = table; NULL != tableptr->value; ++tableptr) { if(tableptr->isSet) { if(tableptr->logging == LOG_NORMAL) { switch(tableptr->type) { case OPTION_STRING: case OPTION_SPECSTR: sprintf(buf, "\t %2d x %.15s(%.15s) = \"%.900s\"\n", tableptr->isSet, nullEmptyStr(tableptr->configname), nullEmptyStr(tableptr->optionname), nullStr(*(char**)(tableptr->value)) ); break; case OPTION_INT: case OPTION_SPECINT: case OPTION_BOOL: case OPTION_BOOL_NEG: sprintf(buf, "\t %2d x %.15s(%.15s) = %d\n", tableptr->isSet, nullEmptyStr(tableptr->configname), nullEmptyStr(tableptr->optionname), *(int*)(tableptr->value) ); break; default: sprintf(buf, "\t %2d x %.15s(%.15s) = (unknown type)\n", tableptr->isSet, nullEmptyStr(tableptr->configname), nullEmptyStr(tableptr->optionname) ); break; } } else { sprintf(buf, "\t %2d x %.15s(%.15s) = ***\n", tableptr->isSet, nullEmptyStr(tableptr->configname), nullEmptyStr(tableptr->optionname) ); } tmp = myStrdup2(res, buf); free(res); res = tmp; } } return res; }
/* * parseConfigValue(): lookup command line or configuration option in option * table and call appropriate function according to table entry. * * returns: 0 = OK, else error */ static int parseConfigValue(const char *name, const char *value, optionTable_t *table, const char *filename, const char *line) { optionTable_t *tableptr; const char *tablename; int ret = 0; if (strcmp(name, "password")) { log(("parsing name %s value %s\n", name, nullStr(value))); } /* lookup name in table */ for (tableptr=table; tableptr->value; tableptr++) { tablename = filename ? tableptr->configname : tableptr->optionname; if (tablename && !strcmp(name, tablename)) break; } if (tableptr->value) { /* found */ switch (tableptr->type) { case OPTION_BOOL: case OPTION_BOOL_NEG: ret = parseBoolValue(name, value, tableptr, filename, line, (tableptr->type == OPTION_BOOL_NEG)); break; case OPTION_STRING: ret = parseStringValue(name, value, tableptr, filename, line); break; case OPTION_SPECINT: case OPTION_SPECSTR: ret = parseSpecialValue(name, value, tableptr, filename, line); break; case OPTION_INT: ret = parseIntValue(name, value, tableptr, filename, line); break; default: printLog(stderr, "Internal error: invalid type in option table (%s)", tableptr->configname ? tableptr->configname : tableptr->optionname); ret = 1; } } else { if (filename) printLog(stderr, "Unknown configuration entry \"%s\" in file %s\n", line, filename); else printLog(stderr, "Unknown command line option -%s\n", line); ret = 1; } return ret; }
/* * parseStringValue(): parse a string value, call checking func if specified * * returns: 0 = OK, else error */ static int parseStringValue(const char *name, const char *value, optionTable_t *tableptr, const char *filename, const char *line) { if (tableptr->checkfunc) { /* Check value with specific check function. * Check function is responsible for allocating/freeing values */ if ((*tableptr->checkfunc)(value, tableptr, filename, line)) return 1; } else { free(*(char**)(tableptr->value)); *(char**)(tableptr->value) = myStrdup(value); } tableptr->isSet++; log(("string value for %s is \"%s\"\n", name, nullStr(*(char**)(tableptr->value)))); return 0; }
/* * Get pagename variable, or NULL if not found. */ char * getPageName(memBuf_t *mp) { const char *line; log(("getPageName():\n")); while ((line = getTag(mp))) { char *tmp; if (strncmp(line, "!--", 3)) continue; if ((tmp = strstr(line, PAGENAME))) { tmp = getPageNameInternal(tmp); log(("getPageName(): pagename = %s\n", nullStr(tmp))); return tmp; } } log(("getPageName(): Cannot find pagename, returning NULL\n")); return NULL; }