Warren Young:

> You can open a file called NUL on Windows to get the same effect as
> /dev/null on POSIX type platforms.

A very interesting topic!

  (void*)0, or nullptr (was used in a confusing manner, in my post)

  Windows NT (object manager) equivalent to /dev/null

  Windows NT global symlink to \Device\Null
  Not accepted by Win32 APIs

  Local Device and Root Local Device forms of \??\NUL
  Works with Win32 APIs

  (\\.\ and \\?\ both escape to \DosDevices, the latter without any path
  name preprocessing, and on current versions of Windows NT, \DosDevices
  is a is a symlink to \??, which is a virtual directory containing both
  objects from the \GLOBAL?? and from the user session directories)

  Win32 API magic file name mapped to \\.\NUL

  Path to file C:\dev\NUL (must be specified as an absolute path)
  Works with Win32 APIs

  (\\?\ escapes to \DosDevices, which links to \??, where the symlink
  named C: is found, pointing to \Device\HarddiskVolumeN, and finally
  resolving to \Device\HarddiskVolumeN\dev\NUL)

> That’s no concern here, since the Fossil code will likely just say
> "NUL".

Yes, I think the Win32 variant should be:

(a) g.httpOut = fossil_fopen("NUL", "wb");

instead of:

(b) g.httpOut = fossil_fopen("/dev/null", "wb");

Code snippet (a) returns a valid (i.e. non-zero) FILE*, on Windows.

If the root drive of the fossil.exe current (working) directory has a
directory named "dev", say "C:\dev", code snippet (b) creates the file
"C:\dev\null", on Windows.

Just tested with fossil_open().

fossil-users mailing list

Reply via email to