* Makefile.in: Add dependencies for fhandler_random.o

* fhandler.h: Add device type FH_RANDOM. Add class
        fhandler_dev_random.
        * fhandler_random.cc: New file. Implementation of
        fhandler_dev_random.
        * hinfo.cc (build_fhandler): Add case for FH_RANDOM.
        * path.cc: Add device names for random devices to
        windows_device_names.
        (get_device_number): Add if branch for random devices.
        (win32_device_name): Add device name generation for
        random devices.
        winsup.h: Include <wincrypt.h>.
This commit is contained in:
Corinna Vinschen
2000-05-03 15:39:10 +00:00
parent 49d64538cd
commit 1c0c369b36
7 changed files with 144 additions and 3 deletions

View File

@@ -436,6 +436,7 @@ const char *windows_device_names[] =
"\\dev\\st%d",
"nul",
"\\dev\\zero",
"\\dev\\%srandom",
};
static int
@@ -500,6 +501,11 @@ get_device_number (const char *name, int &unit, BOOL from_conv)
devn = FH_NULL;
else if (deveq ("zero"))
devn = FH_ZERO;
else if (deveq ("random") || deveq ("urandom"))
{
devn = FH_RANDOM;
unit = 8 + (deveqn ("u", 1) ? 1 : 0); /* Keep unit Linux conformant */
}
else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0)
devn = FH_SERIAL;
else if (deveq ("pipe") || deveq ("piper") || deveq ("pipew"))
@@ -535,7 +541,10 @@ win32_device_name (const char *src_path, char *win32_path,
if ((devfmt = windows_device_names[FHDEVN (devn)]) == NULL)
return FALSE;
__small_sprintf (win32_path, devfmt, unit);
if (devn == FH_RANDOM)
__small_sprintf (win32_path, devfmt, unit == 8 ? "" : "u");
else
__small_sprintf (win32_path, devfmt, unit);
return TRUE;
}