Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: don't need to escape characters is code blocks

Wiki Markup
C99 defines {{getenv}} as follows \[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] defines {{getenv}} as follows:

The getenv function returns a pointer to a string associated with the matched list member. The string pointed to shall not be modified by the program, but may be overwritten by a subsequent call to the getenv function. If the specified name cannot be found, a null pointer is returned.

...

This non-compliant code example modifies the string returned by getenv() by replacing all double quote (") characters with underscores.

...

Code Block
bgColor#ffcccc
char *env = getenv("TEST_ENV");
if (env == NULL) {
  /* Handle Error */
}

strtr(env,'\"', '_');

Compliant Solution (local copy)

...

The modified string may be overwritten by a subsequent call to the getenv() function.   Depending on the implementation, modifying the string returned by getenv() may or may not modify the environment.

...