diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-29 08:28:24 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-29 08:28:24 +0300 |
commit | 711ded6d2866e00b42e4d7c1136b201944e16578 (patch) | |
tree | 4813c3e9737e7bf1f90abfc758a8e3d67e071ff0 /winsup/cygwin/path.cc | |
parent | aa9d50a1c15b5aa4f4a192b9a146a377de4d42cb (diff) |
* fhandler.h (fhandler_serial::fhandler_serial): Change to only accept unit
argument.
* fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
(fhandler_serial::open): Avoid else when previous clause is a return().
* path.cc (get_devn): Alias /dev/ttyS0 -> /dev/com1, etc.
(get_device_number): Reallow standalone "com1" as a valid name for /dev/com1.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index ad3008c08..3115d3b8d 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -846,7 +846,10 @@ get_devn (const char *name, int &unit) else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0) devn = FH_SERIAL; else if (deveqn ("ttyS", 4) && (unit = digits (name + 4)) >= 0) - devn = FH_SERIAL; + { + devn = FH_SERIAL; + unit++; + } else if (deveq ("pipe") || deveq ("piper") || deveq ("pipew")) devn = FH_PIPE; else if (deveq ("tcp") || deveq ("udp") || deveq ("streamsocket") @@ -979,14 +982,21 @@ get_device_number (const char *unix_path, const char *w32_path, int &unit) devn = get_devn (unix_path, unit); if (devn == FH_BAD && *w32_path == '\\' && wdeveqn ("\\dev\\", 5)) devn = get_devn (w32_path, unit); - if (devn == FH_BAD && udeveqn ("com", 3) - && (unit = digits (unix_path + 3)) >= 0) - devn = FH_SERIAL; if (devn == FH_BAD && wdeveqn ("\\\\.\\", 4)) devn = get_raw_device_number (unix_path + 5, w32_path + 4, unit); if (devn == FH_BAD) devn = get_raw_device_number (unix_path + 5, NULL, unit); } + else + { + char *p = strrchr (unix_path, '/'); + if (p) + unix_path = p + 1; + if (udeveqn ("com", 3) + && (unit = digits (unix_path + 3)) >= 0) + devn = FH_SERIAL; + } + return devn; } |