Skip to content

Commit

Permalink
Remove all reference to '%HOME%'.
Browse files Browse the repository at this point in the history
(use only '%APPDATA%' as base reference).
  • Loading branch information
gvanem committed Sep 7, 2021
1 parent a30158d commit 23e7807
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,15 @@ The trace-level and other settings are controlled by a config-file
`wsock_trace`. This file is searched along these places until found:
* The file pointed to by `%WSOCK_TRACE`.
* The current directory.
* The `%HOME` directory.
* Then finally the `%APPDATA` directory.
* Then finally the `%APPDATA%` directory.

`wsock_trace` is read in **[init.c](https://github.com/gvanem/wsock-trace/blob/master/src/init.c)**
at startup. Read it's contents; the comments therein should be self-explanatory.<br>
If `wsock_trace` is not found in one of the above directories, the default
`trace_level` is set to 1.

There is currently no `install.bat` file for Wsock-trace. So you should copy the following files (here at GitHub) to your <br>
`%HOME` or `%APPDATA` directory:
`%APPDATA%` directory:
```
wsock_trace
GeoIP.csv
Expand All @@ -170,9 +169,6 @@ These environment variables are on the form:
* `<drive>:\Documents and Settings\<User Name>\ProgramData`. (Win-XP)
* `<drive>:\Users\<User Name>\AppData\Roaming`. (Win-Vista+)

Since it's a confusing subject what a program's configuration directory should be,
it's best to define a `%HOME%` to point to the excact place for such config-files.

### Running samples

Example output from `src/ws_tool.exe test` (built with MSVC):
Expand Down Expand Up @@ -288,7 +284,7 @@ And another example from [**C-ares**](https://github.com/c-ares/c-ares)'s
By default, the tracing of `htons()`,`htonl()`, `ntohs()` and `ntohl()` are
excluded from the trace.<br>
You can edit the `%HOME/wsock_trace` config-file and exclude whatever calls you like.
You can edit the `%APPDATA%/wsock_trace` config-file and exclude whatever calls you like.
And the 2 traces above is showing the effect of the config-value `compact = 1`.
A more eleborated example from 2 **[OpenVPN](https://openvpn.net/)** programs; a client and a
Expand Down
12 changes: 5 additions & 7 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ BOOL exclude_list_add (const char *name, unsigned exclude_which)
*
* First try file pointed to by %WSOCK_TRACE%,
* then in current_dir.
* then in %APPDATA% or %HOME%.
* then in %APPDATA%.
*/

/*
Expand All @@ -555,7 +555,7 @@ static char fname [MAX_PATH];

static FILE *open_config_file (const char *base_name)
{
char *home, *env = getenv_expand ("WSOCK_TRACE", fname, sizeof(fname));
char *appdata, *env = getenv_expand ("WSOCK_TRACE", fname, sizeof(fname));
FILE *fil;

TRACE (2, "%%WSOCK_TRACE%%=%s.\n", env);
Expand All @@ -574,12 +574,10 @@ static FILE *open_config_file (const char *base_name)
fil = fopen (fname, "r");
if (!fil)
{
home = getenv ("APPDATA");
if (!home)
home = getenv ("HOME");
if (home)
appdata = getenv ("APPDATA");
if (appdata)
{
snprintf (fname, sizeof(fname), "%s\\%s", home, base_name);
snprintf (fname, sizeof(fname), "%s\\%s", appdata, base_name);
fil = fopen (fname, "r");
}
}
Expand Down

0 comments on commit 23e7807

Please sign in to comment.