From 5ea26d084d49fb55bf37a998d921c7a2f32c2ff4 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Wed, 3 Nov 2004 20:31:59 +0000 Subject: [PATCH] * dir.c (file_type_to_num): Added initial support for the Special Named Files. They are displayed as block devices, but with '#' prefix in it's names. Needed on QNX Neutrino. * file.c (copy_file_file): Likewise. * fs.h: Likewise. * screen.c (string_file_type): Likewise. (file_compute_color): Likewise. * util.c (string_perm): Likewise. * pipethrough.c: Added sys/select.h if found according to config.h. --- src/ChangeLog | 13 +++++++++++++ src/dir.c | 2 ++ src/file.c | 1 + src/fs.h | 4 ++++ src/pipethrough.c | 3 +++ src/screen.c | 4 ++++ src/util.c | 2 ++ 7 files changed, 29 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index d99b84ff8..cecc24805 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2004-11-04 Mike Gorchak + + * dir.c (file_type_to_num): Added initial support for the Special Named + Files. They are displayed as block devices, but with '#' prefix in it's + names. Needed on QNX Neutrino. + * file.c (copy_file_file): Likewise. + * fs.h: Likewise. + * screen.c (string_file_type): Likewise. + (file_compute_color): Likewise. + * util.c (string_perm): Likewise. + + * pipethrough.c: Added sys/select.h if found according to config.h. + 2004-11-04 Jindrich Novy * screen.c (show_dir): A small fix to avoid a crash in show_dir() with diff --git a/src/dir.c b/src/dir.c index 332c46199..0fd35f840 100644 --- a/src/dir.c +++ b/src/dir.c @@ -284,6 +284,8 @@ file_type_to_num (const file_entry *fe) return 6; if (S_ISFIFO (s->st_mode)) return 7; + if (S_ISNAM (s->st_mode)) /* Special named files will be shown as block devices */ + return 6; if (is_exe (s->st_mode)) return 8; return 9; diff --git a/src/file.c b/src/file.c index fe8074305..278fd3ef9 100644 --- a/src/file.c +++ b/src/file.c @@ -547,6 +547,7 @@ copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path, if (S_ISCHR (sb.st_mode) || S_ISBLK (sb.st_mode) || S_ISFIFO (sb.st_mode) + || S_ISNAM (sb.st_mode) || S_ISSOCK (sb.st_mode)) { while (mc_mknod (dst_path, sb.st_mode & ctx->umask_kill, diff --git a/src/fs.h b/src/fs.h index 0adc8ccd5..600adfaf5 100644 --- a/src/fs.h +++ b/src/fs.h @@ -36,6 +36,10 @@ # define S_ISDOOR(x) 0 #endif +/* Special named files are widely used in QNX6 */ +#ifndef S_ISNAM +# define S_ISNAM(x) 0 +#endif #ifndef MAXPATHLEN diff --git a/src/pipethrough.c b/src/pipethrough.c index d395a31f1..cf1584254 100644 --- a/src/pipethrough.c +++ b/src/pipethrough.c @@ -27,6 +27,9 @@ #include /* On Solaris, FD_SET invokes memset(3) */ #include #include +#ifdef HAVE_SYS_SELECT_H +# include +#endif #include diff --git a/src/screen.c b/src/screen.c index faee6ceab..20bc96f63 100644 --- a/src/screen.c +++ b/src/screen.c @@ -255,6 +255,8 @@ string_file_type (file_entry *fe, int len) buffer[0] = '+'; else if (S_ISFIFO (fe->st.st_mode)) buffer[0] = '|'; + else if (S_ISNAM (fe->st.st_mode)) + buffer[0] = '#'; else if (!S_ISREG (fe->st.st_mode)) buffer[0] = '?'; /* non-regular of unknown kind */ else if (is_exe (fe->st.st_mode)) @@ -493,6 +495,8 @@ file_compute_color (int attr, file_entry *fe) return (DEVICE_COLOR); else if (S_ISBLK (fe->st.st_mode)) return (DEVICE_COLOR); + else if (S_ISNAM (fe->st.st_mode)) + return (DEVICE_COLOR); else if (S_ISFIFO (fe->st.st_mode)) return (SPECIAL_COLOR); else if (S_ISDOOR (fe->st.st_mode)) diff --git a/src/util.c b/src/util.c index 245dde5ed..fd439e03d 100644 --- a/src/util.c +++ b/src/util.c @@ -377,6 +377,8 @@ string_perm (mode_t mode_bits) mode[0] = 'l'; if (S_ISFIFO (mode_bits)) mode[0] = 'p'; + if (S_ISNAM (mode_bits)) + mode[0] = 'n'; if (S_ISSOCK (mode_bits)) mode[0] = 's'; if (S_ISDOOR (mode_bits))