static void init_catalog(void) { static int done = FALSE; LOCK(); if ( !done++ ) { ichar *path = wgetenv("SGML_CATALOG_FILES"); if (!path) { UNLOCK(); return; } while (*path) { ichar buf[MAXPATHLEN]; ichar *s; if ((s = istrchr(path, L':'))) { istrncpy(buf, path, s - path); buf[s - path] = '\0'; path = s + 1; if ( buf[0] ) /* skip empty entries */ register_catalog_file_unlocked(buf, CTL_START); } else { if ( path[0] ) /* skip empty entries */ register_catalog_file_unlocked(path, CTL_START); break; } } } UNLOCK(); }
/** This function translates from a highlight code to a specific color by check invironement variables */ static rgb_color_t get_color( int highlight ) { const wchar_t *val; if( highlight < 0 ) return rgb_color_t::normal(); if( highlight >= (5) ) return rgb_color_t::normal(); val = wgetenv( hightlight_var[highlight]); if( !val ) { val = env_universal_get( hightlight_var[highlight]); } if( !val ) { return rgb_color_t::normal(); } return parse_color( val, false ); }
/** @SYMTestCaseID SYSLIB-STDLIB-CT-1092 @SYMTestCaseDesc Tests for operations on pipes @SYMTestPriority High @SYMTestActions Tests for command line arguments,directory operations,environment variables. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ int do_main(int argc, wchar_t* argv[]) { test_Data; int i; wchar_t* var; wchar_t* varname; wchar_t cwd[MAXPATHLEN]; char buf[200]; char buf1[200]; test_Title("PIPE"); test_Next("Command line arguments"); test(argc>0); test(argv!=0); printf(" argc=%d\r\n", argc); for (i=0; i<argc; i++) { test(argv[i]!=0); test(-1 != wcstombs(buf, argv[i], sizeof(buf))); printf(" argv[%d]=\"%s\" length %d\r\n", i, buf, strlen(buf)); } printf("\r\n"); test_Next("Current working directory"); var=wgetcwd(cwd,sizeof(cwd)/2); test(var==cwd); test(-1 != wcstombs(buf, cwd, sizeof(buf))); printf(" %s\r\n\n", buf); test_Next("Change directory"); i=wchdir((wchar_t*)L"z:/system"); test(i==0); var=wgetcwd(cwd,sizeof(cwd)/2); test(var==cwd); test(-1 != wcstombs(buf, cwd, sizeof(buf))); printf(" %s\r\n\n", buf); test_Next("Environment variables"); varname=(wchar_t*)L"CLASSPATH"; var=wgetenv(varname); test(var!=0); test(-1 != wcstombs(buf, var, sizeof(buf))); test(-1 != wcstombs(buf1, varname, sizeof(buf1))); printf(" %s=%s\r\n", buf1, buf); varname=(wchar_t*)"VARIABLE2"; var=wgetenv(varname); if (var!=0) { test(-1 != wcstombs(buf, var, sizeof(buf))); test(-1 != wcstombs(buf1, varname, sizeof(buf1))); printf(" %s=%s\r\n", buf1, buf); wunsetenv((wchar_t*)"VARIABLE2"); } varname=(wchar_t*)L"USER"; var=wgetenv(varname); test(var!=0); test(-1 != wcstombs(buf, var, sizeof(buf))); test(-1 != wcstombs(buf1, varname, sizeof(buf1))); printf(" %s=%s\r\n", buf1, buf); sleep(5); test_Close(); return 0; }