Fossil

Check-in [61fd10ecd1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement the fossil_clearenv() function for Win32.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 61fd10ecd1d1c9f31258fd85ad1edaaeab2692d0d7434c1a12877ebeb42e19b5
User & Date: mistachkin 2019-08-01 23:31:04.863
Context
2019-08-02
00:10
The test-httpmsg command now sends the payload uncompressed unless the new --compress option is used. check-in: c31ff76fe9 user: drh tags: trunk
2019-08-01
23:31
Implement the fossil_clearenv() function for Win32. check-in: 61fd10ecd1 user: mistachkin tags: trunk
21:05
When rendering HTML pages using the fossil-doc class and the data-title="..." attribute, reverse the HTML escapes in the argument to data-title since they will be reencoded prior to rendering. check-in: 54e01c60e2 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
1723
1724
1725
1726
1727
1728
1729











1730





























1731
1732
1733
1734
1735
1736
1737
}

/*
** Clear all environment variables
*/
int fossil_clearenv(void){
#ifdef _WIN32











  /* FIXME: Not yet supported */





























#else
  return clearenv();
#endif
}

/*
** Like fopen() but always takes a UTF8 argument.







>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
}

/*
** Clear all environment variables
*/
int fossil_clearenv(void){
#ifdef _WIN32
  int rc = 0;
  LPWCH zzEnv = GetEnvironmentStringsW();
  if( zzEnv ){
    LPCWSTR zEnv = zzEnv; /* read-only */
    while( 1 ){
      LPWSTR zNewEnv = _wcsdup(zEnv); /* writable */
      if( zNewEnv ){
        LPWSTR zEquals = wcsstr(zNewEnv, L"=");
        if( zEquals ){
          zEquals[1] = 0; /* no value */
          if( zNewEnv==zEquals || _wputenv(zNewEnv)==0 ){ /* via CRT */
            /* do nothing */
          }else{
            zEquals[0] = 0; /* name only */
            if( !SetEnvironmentVariableW(zNewEnv, NULL) ){ /* via Win32 */
              rc = 1;
            }
          }
          if( rc==0 ){
            zEnv += (lstrlenW(zEnv) + 1); /* double NUL term? */
            if( zEnv[0]==0 ){
              free(zNewEnv);
              break; /* no more vars */
            }
          }
        }else{
          rc = 1;
        }
      }else{
        rc = 1;
      }
      free(zNewEnv);
      if( rc!=0 ) break;
    }
    if( !FreeEnvironmentStringsW(zzEnv) ){
      rc = 2;
    }
  }else{
    rc = 1;
  }
  return rc;
#else
  return clearenv();
#endif
}

/*
** Like fopen() but always takes a UTF8 argument.