Doxygen
Loading...
Searching...
No Matches
Portable Namespace Reference

Functions

int system (const DString &command, const DString &args, bool commandHasConsole=true)
uint32_t pid ()
DString getenv (const DString &variable)
void setenv (const DString &variable, const DString &value)
void unsetenv (const DString &variable)
FILE * fopen (const DString &fileName, const DString &mode)
int fclose (FILE *f)
void unlink (const DString &fileName)
DString pathSeparator ()
DString pathListSeparator ()
const char * ghostScriptCommand ()
const char * commandExtension ()
bool fileSystemIsCaseSensitive ()
FILE * popen (const DString &name, const DString &type)
int pclose (FILE *stream)
double getSysElapsedTime ()
bool isAbsolutePath (const DString &fileName)
void correctPath (const StringVector &list)
 Correct a possible wrong PATH variable.
void setShortDir ()
const char * strnstr (const char *haystack, const char *needle, size_t haystack_len)
const char * devNull ()
bool checkForExecutable (const DString &fileName)
size_t recodeUtf8StringToW (const DString &inputStr, uint16_t **buf)
std::ofstream openOutputStream (const DString &name, bool append=false)
std::ifstream openInputStream (const DString &name, bool binary=false, bool openAtEnd=false)
DString removeLongPathMarker (const DString &path)

Function Documentation

◆ checkForExecutable()

bool Portable::checkForExecutable ( const DString & fileName)

Definition at line 439 of file portable.cpp.

440{
441#if defined(_WIN32) && !defined(__CYGWIN__)
442 const char *extensions[] = {".bat",".com",".exe"};
443 for (int i = 0; i < sizeof(extensions) / sizeof(*extensions); i++)
444 {
445 if (ExistsOnPath(fileName + extensions[i])) return true;
446 }
447 return false;
448#else
449 return ExistsOnPath(fileName);
450#endif
451}
static bool ExistsOnPath(const DString &fileName)
Definition portable.cpp:408

References ExistsOnPath().

Referenced by generateFormula().

◆ commandExtension()

const char * Portable::commandExtension ( )

Definition at line 477 of file portable.cpp.

478{
479#if defined(_WIN32) && !defined(__CYGWIN__)
480 return ".exe";
481#else
482 return "";
483#endif
484}

Referenced by Config::checkAndCorrect(), computeVerifiedDotPath(), javaExecutable(), and writeDiaGraphFromFile().

◆ correctPath()

void Portable::correctPath ( const StringVector & extraPaths)

Correct a possible wrong PATH variable.

This routine was inspired by the cause for bug 766059 was that in the Windows path there were forward slashes.

Definition at line 532 of file portable.cpp.

533{
534 DString p = Portable::getenv("PATH");
535 bool first=true;
536 DString result;
537#if defined(_WIN32) && !defined(__CYGWIN__)
538 for (const auto &path : extraPaths)
539 {
540 if (!first) result+=';';
541 first=false;
542 result += substitute(path,"/","\\");
543 }
544 if (!result.empty() && !p.empty()) result+=';';
545 result += substitute(p,"/","\\");
546#else
547 for (const auto &path : extraPaths)
548 {
549 if (!first) result+=':';
550 first=false;
551 result += path;
552 }
553 if (!result.empty() && !p.empty()) result+=':';
554 result += p;
555#endif
556 if (result!=p) Portable::setenv("PATH",result.data());
557 //printf("settingPath(%s) #extraPaths=%zu\n",Portable::getenv("PATH").data(),extraPaths.size());
558}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
void setenv(const DString &variable, const DString &value)
Definition portable.cpp:302
DString getenv(const DString &variable)
Definition portable.cpp:337

References DString::data(), DString::empty(), getenv(), setenv(), and substitute().

Referenced by parseInput().

◆ devNull()

const char * Portable::devNull ( )

Definition at line 630 of file portable.cpp.

631{
632#if defined(_WIN32) && !defined(__CYGWIN__)
633 return "NUL";
634#else
635 return "/dev/null";
636#endif
637}

Referenced by createDVIFile(), createSVGFromPDFviaInkscape(), and determineInkscapeVersion().

◆ fclose()

int Portable::fclose ( FILE * f)

Definition at line 385 of file portable.cpp.

386{
387 return ::fclose(f);
388}

Referenced by OutputGenerator::endPlainFile(), finishWarnExit(), and initWarningFormat().

◆ fileSystemIsCaseSensitive()

bool Portable::fileSystemIsCaseSensitive ( )

Definition at line 486 of file portable.cpp.

487{
488#if defined(_WIN32) || defined(macintosh) || defined(__MACOSX__) || defined(__APPLE__) || defined(__CYGWIN__)
489 return false;
490#else
491 return true;
492#endif
493}

Referenced by FileNameLinkedMap::findFileDef(), getFilterFromList(), and useCaseSenseNames().

◆ fopen()

FILE * Portable::fopen ( const DString & fileName,
const DString & mode )

Definition at line 365 of file portable.cpp.

366{
367#if defined(_WIN32) && !defined(__CYGWIN__)
368 uint16_t *fn = nullptr;
369 size_t fn_len = recodeUtf8StringToW(fileName,&fn);
370 uint16_t *m = nullptr;
371 size_t m_len = recodeUtf8StringToW(mode,&m);
372 FILE *result = nullptr;
373 if (fn_len!=(size_t)-1 && m_len!=(size_t)-1)
374 {
375 result = _wfopen((wchar_t*)fn,(wchar_t*)m);
376 }
377 delete[] fn;
378 delete[] m;
379 return result;
380#else
381 return ::fopen(fileName.data(),mode.data());
382#endif
383}
size_t recodeUtf8StringToW(const DString &inputStr, uint16_t **buf)
Definition portable.cpp:639

References DString::data(), and recodeUtf8StringToW().

Referenced by checkPngResult(), FilterCache::getFileContentsPipe(), initWarningFormat(), DotRunner::run(), OutputGenerator::startPlainFile(), and tryPath().

◆ getenv()

DString Portable::getenv ( const DString & variable)

Definition at line 337 of file portable.cpp.

338{
339#if defined(_WIN32) && !defined(__CYGWIN__)
340 #define ENV_BUFSIZE 32768
341 LPTSTR pszVal = (LPTSTR) malloc(ENV_BUFSIZE*sizeof(TCHAR));
342 if (GetEnvironmentVariable(variable.data(),pszVal,ENV_BUFSIZE) == 0) return "";
343 DString out;
344 out = pszVal;
345 free(pszVal);
346 return out;
347 #undef ENV_BUFSIZE
348#else
349 if(!environmentLoaded) // if the environment variables are not loaded already...
350 { // ...call loadEnvironment to store them in class
352 }
353
354 if (proc_env.find(variable.str()) != proc_env.end())
355 {
356 return DString(proc_env[variable.str()]);
357 }
358 else
359 {
360 return DString();
361 }
362#endif
363}
const std::string & str() const
Definition dstring.h:645
static bool environmentLoaded
Definition portable.cpp:53
static std::map< std::string, std::string > proc_env
Definition portable.cpp:54
void loadEnvironment()
Definition portable.cpp:276

References DString::data(), environmentLoaded, loadEnvironment(), proc_env, and DString::str().

Referenced by correctPath(), ExistsOnPath(), getCurrentDateTime(), initDoxygen(), javaExecutable(), parseInput(), setDotFontPath(), and substEnvVarsInString().

◆ getSysElapsedTime()

double Portable::getSysElapsedTime ( )

Definition at line 113 of file portable.cpp.

114{
116}
double elapsedTime() const
Definition portable.cpp:88
static SysTimeKeeper & instance()
Definition portable.cpp:100

References SysTimeKeeper::elapsedTime(), and SysTimeKeeper::instance().

Referenced by generateOutput().

◆ ghostScriptCommand()

const char * Portable::ghostScriptCommand ( )

Definition at line 453 of file portable.cpp.

454{
455#if defined(_WIN32) && !defined(__CYGWIN__)
456 static const char *gsexe = nullptr;
457 if (!gsexe)
458 {
459 const char *gsExec[] = {"gswin32c.exe","gswin64c.exe"};
460 for (int i = 0; i < sizeof(gsExec) / sizeof(*gsExec); i++)
461 {
462 if (ExistsOnPath(gsExec[i]))
463 {
464 gsexe = gsExec[i];
465 return gsexe;
466 }
467 }
468 gsexe = gsExec[0];
469 return gsexe;
470 }
471 return gsexe;
472#else
473 return "gs";
474#endif
475}

References ExistsOnPath().

Referenced by createCroppedEPS(), createCroppedPDF(), createEPSbboxFile(), createPNG(), and writeMakeBat().

◆ isAbsolutePath()

bool Portable::isAbsolutePath ( const DString & fileName)

Definition at line 513 of file portable.cpp.

514{
515 const char *fn = fileName.data();
516# ifdef _WIN32
517 if (fileName.length()>1 && isalpha(fileName[0]) && fileName[1]==':') fn+=2;
518# endif
519 char const fst = fn[0];
520 if (fst == '/') return true;
521# ifdef _WIN32
522 if (fst == '\\') return true;
523# endif
524 return false;
525}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151

References DString::data(), and DString::length().

Referenced by findFile(), findFile(), generateOutput(), Markdown::Private::processLink(), and readTextFileByName().

◆ openInputStream()

std::ifstream Portable::openInputStream ( const DString & name,
bool binary = false,
bool openAtEnd = false )

Definition at line 692 of file portable.cpp.

693{
694 std::ios_base::openmode mode = std::ifstream::in | std::ifstream::binary;
695 if (binary) mode |= std::ios::binary;
696 if (openAtEnd) mode |= std::ios::ate;
697#if defined(__clang__) && defined(__MINGW32__)
698 return std::ifstream(fs::path(fileName.str()).wstring(), mode);
699#else
700 return std::ifstream(fs::path(fileName.str()), mode);
701#endif
702}

References DString::str().

Referenced by configFileToString(), convertMapFile(), DotFilePatcher::convertMapFile(), determineInkscapeVersion(), finishWarnExit(), CitationManager::generatePage(), FormulaManager::initFromRepository(), CitationManager::insertCrossReferencesForBibFile(), Htags::loadFilemap(), preProcessFile(), DotRunner::readBoundingBox(), FilterCache::readFragmentFromFile(), readInputFile(), readSVGSize(), resetPDFSize(), DotFilePatcher::run(), sameMd5Signature(), testRTFOutput(), and updateEPSBoundingBox().

◆ openOutputStream()

std::ofstream Portable::openOutputStream ( const DString & name,
bool append = false )

Definition at line 681 of file portable.cpp.

682{
683 std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary;
684 if (append) mode |= std::ofstream::app;
685#if defined(__clang__) && defined(__MINGW32__)
686 return std::ofstream(fs::path(fileName.str()).wstring(), mode);
687#else
688 return std::ofstream(fs::path(fileName.str()), mode);
689#endif
690}

References DString::str().

Referenced by Qhp::addContentsItem(), ResourceMgr::copyResourceAs(), FormulaManager::createFormulasTexFile(), FormulaManager::createLatexFile(), PerlModGenerator::createOutputFile(), HtmlHelp::Private::createProjectFile(), dumpSymbolMap(), EclipseHelp::finalize(), generateDEF(), generateJSNavTree(), generateJSTreeFiles(), CitationManager::generatePage(), generateXML(), generateXMLForClass(), generateXMLForConcept(), generateXMLForDir(), generateXMLForFile(), generateXMLForGroup(), generateXMLForModule(), generateXMLForNamespace(), generateXMLForPage(), generateXMLForRequirement(), generateXMLForRequirements(), HtmlGenerator::init(), Crawlmap::initialize(), DocSets::initialize(), EclipseHelp::initialize(), HtmlHelp::initialize(), Qhp::initialize(), Sitemap::initialize(), openOutputFile(), DotGraph::prepareDotFile(), RTFGenerator::preProcessFileInplace(), resetPDFSize(), DotFilePatcher::run(), runPlantumlContent(), ManGenerator::startDoxyAnchor(), updateEPSBoundingBox(), SearchIndex::write(), SearchIndexExternal::write(), ResourceMgr::writeCategory(), writeCombineScript(), HtmlGenerator::writeExternalSearchPage(), ClassDiagram::writeFigure(), FlowChart::writeFlowChart(), writeInlineGraph(), writeJavascriptSearchData(), writeJavaScriptSearchIndex(), writeJavasScriptSearchDataPage(), writeLatexMakefile(), writeMakeBat(), MermaidManager::writeMermaidSource(), HtmlGenerator::writeSearchData(), HtmlGenerator::writeSearchPage(), and writeTagFile().

◆ pathListSeparator()

DString Portable::pathListSeparator ( )

Definition at line 399 of file portable.cpp.

400{
401#if defined(_WIN32) && !defined(__CYGWIN__)
402 return ";";
403#else
404 return ":";
405#endif
406}

Referenced by ExistsOnPath(), parseInput(), runPlantumlContent(), and setDotFontPath().

◆ pathSeparator()

DString Portable::pathSeparator ( )

Definition at line 390 of file portable.cpp.

391{
392#if defined(_WIN32) && !defined(__CYGWIN__)
393 return "\\";
394#else
395 return "/";
396#endif
397}

Referenced by Config::checkAndCorrect(), ExistsOnPath(), findExampleFilePath(), readTextFileByName(), writeDiaGraphFromFile(), and writeMscGraphFromFile().

◆ pclose()

int Portable::pclose ( FILE * stream)

Definition at line 504 of file portable.cpp.

505{
506 #if defined(_MSC_VER) || defined(__BORLANDC__)
507 return ::_pclose(stream);
508 #else
509 return ::pclose(stream);
510 #endif
511}

Referenced by FileDefImpl::acquireFileVersion(), FilterCache::getFileContentsPipe(), readInputFile(), runQHelpGenerator(), and stackTrace().

◆ pid()

uint32_t Portable::pid ( )

Definition at line 264 of file portable.cpp.

265{
266 uint32_t pid;
267#if !defined(_WIN32) || defined(__CYGWIN__)
268 pid = static_cast<uint32_t>(getpid());
269#else
270 pid = static_cast<uint32_t>(GetCurrentProcessId());
271#endif
272 return pid;
273}
uint32_t pid()
Definition portable.cpp:264

References pid().

Referenced by initWarningFormat(), parseInput(), pid(), and system().

◆ popen()

FILE * Portable::popen ( const DString & name,
const DString & type )

Definition at line 495 of file portable.cpp.

496{
497 #if defined(_MSC_VER) || defined(__BORLANDC__)
498 return ::_popen(name.data(),type.data());
499 #else
500 return ::popen(name.data(),type.data());
501 #endif
502}

References DString::data().

Referenced by FileDefImpl::acquireFileVersion(), FilterCache::getFileContentsPipe(), readInputFile(), runQHelpGenerator(), and stackTrace().

◆ recodeUtf8StringToW()

size_t Portable::recodeUtf8StringToW ( const DString & inputStr,
uint16_t ** buf )

Definition at line 639 of file portable.cpp.

640{
641 if (inputStr.empty() || outBuf==nullptr) return 0; // empty input or invalid output
642 void *handle = portable_iconv_open("UTF-16LE","UTF-8");
643 if (handle==reinterpret_cast<void *>(-1)) return 0; // invalid encoding
644 size_t len = inputStr.length();
645 uint16_t *buf = new uint16_t[len+1];
646 *outBuf = buf;
647 size_t inRemains = len;
648 size_t outRemains = len*sizeof(uint16_t)+2; // chars + \0
649 const char *p = inputStr.data();
650 portable_iconv(handle,&p,&inRemains,reinterpret_cast<char **>(&buf),&outRemains);
651 *buf=0;
652 portable_iconv_close(handle);
653 return len;
654}
int portable_iconv_close(void *cd)
size_t portable_iconv(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
void * portable_iconv_open(const char *tocode, const char *fromcode)

References DString::data(), DString::empty(), DString::length(), portable_iconv(), portable_iconv_close(), and portable_iconv_open().

Referenced by fopen(), and system().

◆ removeLongPathMarker()

DString Portable::removeLongPathMarker ( const DString & path)

Definition at line 656 of file portable.cpp.

657{
658 DString result;
659#if defined(_WIN32)
660 if (path.startsWith("//?/")) // strip leading "\\?\" part from path
661 {
662 result = path.mid(4);
663 }
664 else
665#endif
666 {
667 result = path;
668 }
669 return result;
670}
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
bool startsWith(const char *s) const
Definition dstring.h:600

References DString::mid(), and DString::startsWith().

Referenced by computeCommonDirPrefix(), FileDefImpl::FileDefImpl(), FileNameLinkedMap::findFileDef(), DirDefImpl::mergeDirectoryInTree(), FileNameLinkedMap::showFileDefMatches(), and stripFromPath().

◆ setenv()

void Portable::setenv ( const DString & variable,
const DString & value )

Definition at line 302 of file portable.cpp.

303{
304#if defined(_WIN32) && !defined(__CYGWIN__)
305 SetEnvironmentVariable(name.data(),!value.empty() ? value.data() : "");
306#else
307 if(!environmentLoaded) // if the environment variables are not loaded already...
308 { // ...call loadEnvironment to store them in class
310 }
311
312 proc_env[name.str()] = value.str(); // create or replace existing value
313 ::setenv(name.data(),value.data(),1);
314#endif
315}

References DString::data(), DString::empty(), environmentLoaded, loadEnvironment(), proc_env, setenv(), and DString::str().

Referenced by correctPath(), initDoxygen(), parseInput(), runPlantumlContent(), setDotFontPath(), setenv(), and unsetDotFontPath().

◆ setShortDir()

void Portable::setShortDir ( )

Definition at line 569 of file portable.cpp.

570{
571#if defined(_WIN32) && !defined(__CYGWIN__)
572 long length = 0;
573 TCHAR* buffer = nullptr;
574 // First obtain the size needed by passing nullptr and 0.
575 length = GetShortPathName(Dir::currentDirPath().c_str(), nullptr, 0);
576 // Dynamically allocate the correct size
577 // (terminating null char was included in length)
578 buffer = new TCHAR[length];
579 // Now simply call again using same (long) path.
580 length = GetShortPathName(Dir::currentDirPath().c_str(), buffer, length);
581 // Set the correct directory (short name)
582 Dir::setCurrent(buffer);
583 delete [] buffer;
584#endif
585}
static std::string currentDirPath()
Definition dir.cpp:348
static bool setCurrent(const std::string &path)
Definition dir.cpp:356

References Dir::currentDirPath(), and Dir::setCurrent().

Referenced by runHtmlHelpCompiler().

◆ strnstr()

const char * Portable::strnstr ( const char * haystack,
const char * needle,
size_t haystack_len )

Definition at line 616 of file portable.cpp.

617{
618 size_t needle_len = strnlen(needle, haystack_len);
619 if (needle_len < haystack_len || !needle[needle_len])
620 {
621 const char *x = portable_memmem(haystack, haystack_len, needle, needle_len);
622 if (x && !memchr(haystack, 0, x - haystack))
623 {
624 return x;
625 }
626 }
627 return nullptr;
628}
static const char * portable_memmem(const char *haystack, size_t haystack_len, const char *needle, size_t needle_len)
Definition portable.cpp:588

References portable_memmem().

Referenced by Markdown::Private::addStrEscapeUtf8Nbsp().

◆ system()

int Portable::system ( const DString & command,
const DString & args,
bool commandHasConsole = true )

taken from the system() manpage on my Linux box

Definition at line 121 of file portable.cpp.

122{
123 if (command.empty()) return 1;
124 AutoTimeKeeper timeKeeper;
125
126#if defined(_WIN32) && !defined(__CYGWIN__)
127 DString commandCorrectedPath = substitute(command,'/','\\');
128 DString fullCmd=commandCorrectedPath;
129#else
130 DString fullCmd=command;
131#endif
132 fullCmd=fullCmd.stripWhiteSpace();
133 if (fullCmd.at(0)!='"' && fullCmd.find(' ')!=DString::npos)
134 {
135 // add quotes around command as it contains spaces and is not quoted already
136 fullCmd="\""+fullCmd+"\"";
137 }
138 fullCmd += " ";
139 fullCmd += args;
140#ifndef NODEBUG
141 Debug::print(Debug::ExtCmd,0,"Executing external command `{}`\n",fullCmd);
142#endif
143
144#if !defined(_WIN32) || defined(__CYGWIN__)
145 (void)commandHasConsole;
146 /*! taken from the system() manpage on my Linux box */
147 int pid,status=0;
148
149#ifdef _OS_SOLARIS // for Solaris we use vfork since it is more memory efficient
150
151 // on Solaris fork() duplicates the memory usage
152 // so we use vfork instead
153
154 // spawn shell
155 if ((pid=vfork())<0)
156 {
157 status=-1;
158 }
159 else if (pid==0)
160 {
161 execl("/bin/sh","sh","-c",fullCmd.data(),(char*)0);
162 _exit(127);
163 }
164 else
165 {
166 while (waitpid(pid,&status,0 )<0)
167 {
168 if (errno!=EINTR)
169 {
170 status=-1;
171 break;
172 }
173 }
174 }
175 return status;
176
177#else // Other Unices just use fork
178
179 pid = fork();
180 if (pid==-1)
181 {
182 perror("fork error");
183 return -1;
184 }
185 if (pid==0)
186 {
187 const char * const argv[4] = { "sh", "-c", fullCmd.data(), 0 };
188 execve("/bin/sh",const_cast<char * const*>(argv),environ);
189 exit(127);
190 }
191 for (;;)
192 {
193 if (waitpid(pid,&status,0)==-1)
194 {
195 if (errno!=EINTR) return -1;
196 }
197 else
198 {
199 if (WIFEXITED(status))
200 {
201 return WEXITSTATUS(status);
202 }
203 else
204 {
205 return status;
206 }
207 }
208 }
209#endif // !_OS_SOLARIS
210
211#else // Win32 specific
212 if (commandHasConsole)
213 {
214 return ::system(fullCmd.data());
215 }
216 else
217 {
218 uint16_t* fullCmdW = nullptr;
219 recodeUtf8StringToW(fullCmd, &fullCmdW);
220
221 STARTUPINFOW sStartupInfo;
222 std::memset(&sStartupInfo, 0, sizeof(sStartupInfo));
223 sStartupInfo.cb = sizeof(sStartupInfo);
224 sStartupInfo.dwFlags |= STARTF_USESHOWWINDOW;
225 sStartupInfo.wShowWindow = SW_HIDE;
226
227 PROCESS_INFORMATION sProcessInfo;
228 std::memset(&sProcessInfo, 0, sizeof(sProcessInfo));
229
230 if (!CreateProcessW(
231 nullptr, // No module name (use command line)
232 reinterpret_cast<wchar_t*>(fullCmdW), // Command line, can be mutated by CreateProcessW
233 nullptr, // Process handle not inheritable
234 nullptr, // Thread handle not inheritable
235 false, // Set handle inheritance to false
236 CREATE_NO_WINDOW,
237 nullptr, // Use parent's environment block
238 nullptr, // Use parent's starting directory
239 &sStartupInfo,
240 &sProcessInfo
241 ))
242 {
243 delete[] fullCmdW;
244 return -1;
245 }
246 else if (sProcessInfo.hProcess) /* executable was launched, wait for it to finish */
247 {
248 WaitForSingleObject(sProcessInfo.hProcess,INFINITE);
249 /* get process exit code */
250 DWORD exitCode;
251 bool retval = GetExitCodeProcess(sProcessInfo.hProcess,&exitCode);
252 CloseHandle(sProcessInfo.hProcess);
253 CloseHandle(sProcessInfo.hThread);
254 delete[] fullCmdW;
255 if (!retval) return -1;
256 return exitCode;
257 }
258 }
259#endif
260 return 1; // we should never get here
261
262}
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
@ ExtCmd
Definition debug.h:37
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:78
char ** environ

References DString::at(), DString::data(), DString::empty(), environ, Debug::ExtCmd, DString::find(), DString::npos, pid(), Debug::print(), recodeUtf8StringToW(), DString::stripWhiteSpace(), and substitute().

Referenced by createCroppedEPS(), createCroppedPDF(), createDVIFile(), createEPSbboxFile(), createPNG(), createPostscriptFile(), FlowChart::createSVG(), createSVGFromPDF(), createSVGFromPDFviaInkscape(), determineInkscapeVersion(), do_mscgen_generate(), Htags::execute(), DocParser::findAndCopyImage(), CitationManager::generatePage(), DotRunner::run(), runHtmlHelpCompiler(), runMermaid(), runPlantumlContent(), runQHelpGenerator(), writeDiaGraphFromFile(), writeDotGraphFromFile(), writeDotImageMapFromFile(), ClassDiagram::writeFigure(), and writeMscGraphFromFile().

◆ unlink()

void Portable::unlink ( const DString & fileName)

Definition at line 560 of file portable.cpp.

561{
562#if defined(_WIN32) && !defined(__CYGWIN__)
563 _unlink(fileName.data());
564#else
565 ::unlink(fileName.data());
566#endif
567}
void unlink(const DString &fileName)
Definition portable.cpp:560

References DString::data(), and unlink().

Referenced by finishWarnExit(), RTFGenerator::preProcessFileInplace(), DotRunner::run(), and unlink().

◆ unsetenv()

void Portable::unsetenv ( const DString & variable)

Definition at line 317 of file portable.cpp.

318{
319#if defined(_WIN32) && !defined(__CYGWIN__)
320 SetEnvironmentVariable(variable.data(),nullptr);
321#else
322 /* Some systems don't have unsetenv(), so we do it ourselves */
323 if (variable.empty() || variable.find('=')!=DString::npos)
324 {
325 return; // not properly formatted
326 }
327
328 auto it = proc_env.find(variable.str());
329 if (it != proc_env.end())
330 {
331 proc_env.erase(it);
332 ::unsetenv(variable.data());
333 }
334#endif
335}
void unsetenv(const DString &variable)
Definition portable.cpp:317

References DString::data(), DString::empty(), DString::find(), DString::npos, proc_env, DString::str(), and unsetenv().

Referenced by setDotFontPath(), unsetDotFontPath(), and unsetenv().