Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-01-09 11:22:05 +0300
committerChristopher Faylor <me@cgf.cx>2003-01-09 11:22:05 +0300
commit85ba109de7c313449a8d4cd8bcc7b0606d0f15ec (patch)
treeee0dac5c3f1406d3c39f6ef39148dc40dae2698f
parent9f05d3a44a4f7c12a832b972fad9c4f0cc693421 (diff)
Use isdirsep rather than SLASH_P throughout.
* path.cc (iscygdrive): Disallow /cygdrive\x. (normalize_posix_path): "Normalize" a windows path, if detected, rather than converting to posix. * fhandler_serial.cc (fhandler_serial::tcsetattr): Add support and capability checking for B230400 bitrate. (fhandler_serial::tcgetattr): Add support for B230400 bitrate. * include/sys/termios.h: Add B230400 definition for Posix support of 230.4Kbps.
-rw-r--r--winsup/cygwin/ChangeLog15
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc2
-rw-r--r--winsup/cygwin/fhandler_proc.cc4
-rw-r--r--winsup/cygwin/fhandler_process.cc4
-rw-r--r--winsup/cygwin/fhandler_registry.cc14
-rw-r--r--winsup/cygwin/fhandler_serial.cc7
-rw-r--r--winsup/cygwin/include/sys/termios.h3
-rw-r--r--winsup/cygwin/path.cc44
-rw-r--r--winsup/cygwin/winsup.h3
9 files changed, 58 insertions, 38 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4060b1f01..f0d86c1df 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,18 @@
+2003-01-09 Christopher Faylor <cgf@redhat.com>
+
+ Use isdirsep rather than SLASH_P throughout.
+ * path.cc (iscygdrive): Disallow /cygdrive\x.
+ (normalize_posix_path): "Normalize" a windows path, if detected, rather
+ than converting to posix.
+
+2003-01-06 Troy Curtiss <troyc@usa.net>
+
+ * fhandler_serial.cc (fhandler_serial::tcsetattr): Add support and
+ capability checking for B230400 bitrate.
+ (fhandler_serial::tcgetattr): Add support for B230400 bitrate.
+ * include/sys/termios.h: Add B230400 definition for Posix support of
+ 230.4Kbps.
+
2003-01-05 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (_pinfo::commune_send): Use myself->lock rather than just
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 33dd62551..586c5a5e7 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -598,7 +598,7 @@ fhandler_disk_file::opendir (path_conv& real_name)
dir->__d_u.__d_data.__fh = this;
/* FindFirstFile doesn't seem to like duplicate /'s. */
len = strlen (dir->__d_dirname);
- if (len == 0 || SLASH_P (dir->__d_dirname[len - 1]))
+ if (len == 0 || isdirsep (dir->__d_dirname[len - 1]))
strcat (dir->__d_dirname, "*");
else
strcat (dir->__d_dirname, "\\*"); /**/
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index f887e8cb7..2bfe48a94 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -87,7 +87,7 @@ fhandler_proc::get_proc_fhandler (const char *path)
* it being normalised and therefore the path may have runs of slashes
* in it.
*/
- while (SLASH_P (*path))
+ while (isdirsep (*path))
path++;
/* Check if this is the root of the virtual filesystem (i.e. /proc). */
@@ -105,7 +105,7 @@ fhandler_proc::get_proc_fhandler (const char *path)
bool has_subdir = false;
while (*path)
- if (SLASH_P (*path++))
+ if (isdirsep (*path++))
{
has_subdir = true;
break;
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 03000a21d..7cadcb40d 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -85,7 +85,7 @@ fhandler_process::exists ()
const char *path = get_name ();
debug_printf ("exists (%s)", path);
path += proc_len + 1;
- while (*path != 0 && !SLASH_P (*path))
+ while (*path != 0 && !isdirsep (*path))
path++;
if (*path == 0)
return 2;
@@ -172,7 +172,7 @@ fhandler_process::open (path_conv *pc, int flags, mode_t mode)
const char *path;
path = get_name () + proc_len + 1;
pid = atoi (path);
- while (*path != 0 && !SLASH_P (*path))
+ while (*path != 0 && !isdirsep (*path))
path++;
if (*path == 0)
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
index 8a9f27ed9..f1427dc6d 100644
--- a/winsup/cygwin/fhandler_registry.cc
+++ b/winsup/cygwin/fhandler_registry.cc
@@ -114,9 +114,9 @@ fhandler_registry::exists ()
}
pathlen = strlen (path);
file = path + pathlen - 1;
- if (SLASH_P (*file) && pathlen > 1)
+ if (isdirsep (*file) && pathlen > 1)
file--;
- while (!SLASH_P (*file))
+ while (!isdirsep (*file))
file--;
file++;
@@ -240,9 +240,9 @@ fhandler_registry::fstat (struct __stat64 *buf, path_conv *pc)
{
int pathlen = strlen (path);
const char *value_name = path + pathlen - 1;
- if (SLASH_P (*value_name) && pathlen > 1)
+ if (isdirsep (*value_name) && pathlen > 1)
value_name--;
- while (!SLASH_P (*value_name))
+ while (!isdirsep (*value_name))
value_name--;
value_name++;
DWORD dwSize;
@@ -429,9 +429,9 @@ fhandler_registry::open (path_conv * pc, int flags, mode_t mode)
path++;
pathlen = strlen (path);
file = path + pathlen - 1;
- if (SLASH_P (*file) && pathlen > 1)
+ if (isdirsep (*file) && pathlen > 1)
file--;
- while (!SLASH_P (*file))
+ while (!isdirsep (*file))
file--;
file++;
@@ -625,7 +625,7 @@ open_key (const char *name, REGSAM access, bool isValue)
while (*name)
{
const char *anchor = name;
- while (*name && !SLASH_P (*name))
+ while (*name && !isdirsep (*name))
name++;
strncpy (component, anchor, name - anchor);
component[name - anchor] = '\0';
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index 7081db3d5..2f41eb9c7 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -591,6 +591,9 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
case B115200:
state.BaudRate = CBR_115200;
break;
+ case B230400:
+ state.BaudRate = 230400 /* CBR_230400 - not defined */;
+ break;
default:
/* Unsupported baud rate! */
termios_printf ("Invalid t->c_ospeed %d", t->c_ospeed);
@@ -722,7 +725,6 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
state.fAbortOnError = TRUE;
- /* -------------- Set state and exit ------------------ */
if (memcmp (&ostate, &state, sizeof (state)) != 0)
SetCommState (get_handle (), &state);
@@ -891,6 +893,9 @@ fhandler_serial::tcgetattr (struct termios *t)
case CBR_115200:
t->c_cflag = t->c_ospeed = t->c_ispeed = B115200;
break;
+ case 230400: /* CBR_230400 - not defined */
+ t->c_cflag = t->c_ospeed = t->c_ispeed = B230400;
+ break;
default:
/* Unsupported baud rate! */
termios_printf ("Invalid baud rate %d", state.BaudRate);
diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
index 20a84aa78..f7f88be61 100644
--- a/winsup/cygwin/include/sys/termios.h
+++ b/winsup/cygwin/include/sys/termios.h
@@ -177,7 +177,8 @@ POSIX commands */
#define B57600 0x01001
#define B115200 0x01002
#define B128000 0x01003
-#define B256000 0x01003
+#define B230400 0x01004
+#define B256000 0x01005
#define CRTSXOFF 0x04000
#define CRTSCTS 0x08000
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 405b72a4a..5ff147c68 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -132,7 +132,7 @@ create_shortcut_header (void)
#define iscygdrive_device(path) \
(isalpha (path[mount_table->cygdrive_len]) && \
- (isdirsep (path[mount_table->cygdrive_len + 1]) || \
+ (path[mount_table->cygdrive_len + 1] == '/' || \
!path[mount_table->cygdrive_len + 1]))
#define isproc(path) \
@@ -159,16 +159,16 @@ int
path_prefix_p (const char *path1, const char *path2, int len1)
{
/* Handle case where PATH1 has trailing '/' and when it doesn't. */
- if (len1 > 0 && SLASH_P (path1[len1 - 1]))
+ if (len1 > 0 && isdirsep (path1[len1 - 1]))
len1--;
if (len1 == 0)
- return SLASH_P (path2[0]) && !SLASH_P (path2[1]);
+ return isdirsep (path2[0]) && !isdirsep (path2[1]);
if (!pathnmatch (path1, path2, len1))
return 0;
- return SLASH_P (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':';
+ return isdirsep (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':';
}
/* Return non-zero if paths match in first len chars.
@@ -203,11 +203,10 @@ normalize_posix_path (const char *src, char *dst)
char *dst_start = dst;
syscall_printf ("src %s", src);
+
if (isdrive (src) || strpbrk (src, "\\:"))
- {
- cygwin_conv_to_full_posix_path (src, dst);
- return 0;
- }
+ return normalize_win32_path (src, dst);
+
if (!isslash (src[0]))
{
if (!cygheap->cwd.get (dst))
@@ -1190,18 +1189,18 @@ normalize_win32_path (const char *src, char *dst)
while (*src)
{
/* Strip duplicate /'s. */
- if (SLASH_P (src[0]) && SLASH_P (src[1]))
+ if (isdirsep (src[0]) && isdirsep (src[1]))
src++;
/* Ignore "./". */
- else if (src[0] == '.' && SLASH_P (src[1])
- && (src == src_start || SLASH_P (src[-1])))
+ else if (src[0] == '.' && isdirsep (src[1])
+ && (src == src_start || isdirsep (src[-1])))
src += 2;
/* Backup if "..". */
else if (src[0] == '.' && src[1] == '.'
/* dst must be greater than dst_start */
&& dst[-1] == '\\'
- && (SLASH_P (src[2]) || src[2] == 0))
+ && (isdirsep (src[2]) || src[2] == 0))
{
/* Back up over /, but not if it's the first one. */
if (dst > dst_root_start + 1)
@@ -1210,7 +1209,7 @@ normalize_win32_path (const char *src, char *dst)
while (dst > dst_root_start + 1 && dst[-1] != '\\' && dst[-2] != ':')
dst--;
src += 2;
- if (SLASH_P (*src))
+ if (isdirsep (*src))
src++;
}
/* Otherwise, add char to result. */
@@ -1289,7 +1288,7 @@ nofinalslash (const char *src, char *dst)
int len = strlen (src);
if (src != dst)
memcpy (dst, src, len + 1);
- while (len > 1 && SLASH_P (dst[--len]))
+ while (len > 1 && isdirsep (dst[--len]))
dst[len] = '\0';
}
@@ -1599,13 +1598,13 @@ mount_info::cygdrive_posix_path (const char *src, char *dst, int trailing_slash_
The cygdrive prefix always ends with a trailing slash so
the drive letter is added after the path. */
dst[len++] = cyg_tolower (src[0]);
- if (!src[2] || (SLASH_P (src[2]) && !src[3]))
+ if (!src[2] || (isdirsep (src[2]) && !src[3]))
dst[len++] = '\000';
else
{
int n;
dst[len++] = '/';
- if (SLASH_P (src[2]))
+ if (isdirsep (src[2]))
n = 3;
else
n = 2;
@@ -1657,7 +1656,7 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
else
{
const char *lastchar = src_path + src_path_len - 1;
- trailing_slash_p = SLASH_P (*lastchar) && lastchar[-1] != ':';
+ trailing_slash_p = isdirsep (*lastchar) && lastchar[-1] != ':';
}
debug_printf ("conv_to_posix_path (%s, %s, %s)", src_path,
@@ -1705,7 +1704,7 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
if (!*p || !p[1])
nextchar = 0;
- else if (isdirsep (*p))
+ else if (*p == '/')
nextchar = -1;
else
nextchar = 1;
@@ -1756,7 +1755,8 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
{
/* The use of src_path and not pathbuf here is intentional.
We couldn't translate the path, so just ensure no \'s are present. */
- slashify (src_path, posix_path, trailing_slash_p);
+ strcpy (posix_path, src_path);
+ // slashify (src_path, posix_path, trailing_slash_p);
}
out:
@@ -3573,7 +3573,7 @@ cygwin_split_path (const char *path, char *dir, char *file)
*file = 0;
return;
}
- if (SLASH_P (*path))
+ if (isdirsep (*path))
++path;
dir_started_p = 1;
}
@@ -3582,7 +3582,7 @@ cygwin_split_path (const char *path, char *dir, char *file)
We pretend as if they don't exist. */
const char *end = path + strlen (path);
/* path + 1: keep leading slash. */
- while (end > path + 1 && SLASH_P (end[-1]))
+ while (end > path + 1 && isdirsep (end[-1]))
--end;
/* At this point, END points to one beyond the last character
@@ -3591,7 +3591,7 @@ cygwin_split_path (const char *path, char *dir, char *file)
/* Point LAST_SLASH at the last slash (duh...). */
const char *last_slash;
for (last_slash = end - 1; last_slash >= path; --last_slash)
- if (SLASH_P (*last_slash))
+ if (isdirsep (*last_slash))
break;
if (last_slash == path)
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index e46c0721a..2f6e4966e 100644
--- a/winsup/cygwin/winsup.h
+++ b/winsup/cygwin/winsup.h
@@ -105,7 +105,7 @@ extern HANDLE title_mutex;
/**************************** Convenience ******************************/
/* Used when treating / and \ as equivalent. */
-#define SLASH_P(ch) \
+#define isdirsep(ch) \
({ \
char __c = (ch); \
((__c) == '/' || (__c) == '\\'); \
@@ -124,7 +124,6 @@ extern unsigned int signal_shift_subtract;
#undef issep
#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)
-#define isdirsep SLASH_P
#define isabspath(p) \
(isdirsep (*(p)) || (isalpha (*(p)) && (p)[1] == ':' && (!(p)[2] || isdirsep ((p)[2]))))