diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-02-27 14:18:23 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-02-27 14:18:23 +0000 |
commit | b0298c2b68308f9a68e0c0efedaf53413a225263 (patch) | |
tree | 4f223375c9f8ffca30e09fb7cfa3a5fd819db92a | |
parent | 86fcf95cb0106d520e91260362c268e114e7fddf (diff) | |
download | cpio-b0298c2b68308f9a68e0c0efedaf53413a225263.tar.gz cpio-b0298c2b68308f9a68e0c0efedaf53413a225263.tar.bz2 |
Remove __MSDOS__ conditionals
-rw-r--r-- | src/copyin.c | 26 | ||||
-rw-r--r-- | src/copyout.c | 15 | ||||
-rw-r--r-- | src/copypass.c | 13 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/tar.c | 14 | ||||
-rw-r--r-- | src/util.c | 60 |
6 files changed, 5 insertions, 127 deletions
diff --git a/src/copyin.c b/src/copyin.c index 17e6744..7c7f759 100644 --- a/src/copyin.c +++ b/src/copyin.c @@ -196,7 +196,7 @@ read_in_old_ascii (file_hdr, in_des) free (file_hdr->c_name); file_hdr->c_name = (char *) xmalloc (file_hdr->c_namesize + 1); tape_buffered_read (file_hdr->c_name, in_des, (long) file_hdr->c_namesize); -#ifndef __MSDOS__ + /* HP/UX cpio creates archives that look just like ordinary archives, but for devices it sets major = 0, minor = 1, and puts the actual major/minor number in the filesize field. See if this @@ -225,7 +225,6 @@ read_in_old_ascii (file_hdr, in_des) default: break; } -#endif /* __MSDOS__ */ } /* Fill in FILE_HDR by reading a new-format ASCII format cpio header from @@ -320,7 +319,6 @@ read_in_binary (file_hdr, in_des) if (file_hdr->c_namesize % 2) tape_toss_input (in_des, 1L); -#ifndef __MSDOS__ /* HP/UX cpio creates archives that look just like ordinary archives, but for devices it sets major = 0, minor = 1, and puts the actual major/minor number in the filesize field. See if this @@ -349,7 +347,6 @@ read_in_binary (file_hdr, in_des) default: break; } -#endif /* __MSDOS__ */ } /* Exchange the bytes of each element of the array of COUNT shorts @@ -427,9 +424,6 @@ process_copy_in () time (¤t_time); } -#ifdef __MSDOS__ - setmode (archive_des, O_BINARY); -#endif /* Check whether the input file might be a tape. */ in_file_des = archive_des; if (_isrmt (in_file_des)) @@ -768,7 +762,6 @@ copyin_file(file_hdr, in_file_des) copyin_directory(file_hdr, existing_dir); break; -#ifndef __MSDOS__ case CP_IFCHR: case CP_IFBLK: #ifdef CP_IFSOCK @@ -779,7 +772,6 @@ copyin_file(file_hdr, in_file_des) #endif copyin_device(file_hdr); break; -#endif #ifdef CP_IFLNK case CP_IFLNK: @@ -844,7 +836,6 @@ copyin_regular_file(file_hdr, in_file_des) { int out_file_des; /* Output file descriptor. */ -#ifndef __MSDOS__ /* Can the current file be linked to a previously copied file? */ if (file_hdr->c_nlink > 1 && (archive_format == arf_newascii || archive_format == arf_crcascii) ) @@ -917,7 +908,6 @@ copyin_regular_file(file_hdr, in_file_des) } return; } -#endif /* If not linked, copy the contents of the file. */ out_file_des = open (file_hdr->c_name, @@ -1252,12 +1242,9 @@ long_format (file_hdr, link_name) printf ("%s %3u ", mbuf, file_hdr->c_nlink); -#ifndef __MSDOS__ if (numeric_uid) -#endif printf ("%-8u %-8u ", (unsigned int) file_hdr->c_uid, (unsigned int) file_hdr->c_gid); -#ifndef __MSDOS__ else printf ("%-8.8s %-8.8s ", getuser (file_hdr->c_uid), getgroup (file_hdr->c_gid)); @@ -1267,7 +1254,6 @@ long_format (file_hdr, link_name) printf ("%3u, %3u ", file_hdr->c_rdev_maj, file_hdr->c_rdev_min); else -#endif printf ("%8lu ", file_hdr->c_filesize); printf ("%s ", tbuf + 4); @@ -1291,11 +1277,9 @@ print_name_with_quoting (p) { switch (c) { -#ifndef __MSDOS__ case '\\': printf ("\\\\"); break; -#endif case '\n': printf ("\\n"); @@ -1326,13 +1310,7 @@ print_name_with_quoting (p) break; default: - if (c > 040 && -#ifdef __MSDOS__ - c < 0377 && c != 0177 -#else - c < 0177 -#endif - ) + if (c > 040 && c < 0177) putchar (c); else printf ("\\%03o", (unsigned int) c); diff --git a/src/copyout.c b/src/copyout.c index 6be7983..44086b1 100644 --- a/src/copyout.c +++ b/src/copyout.c @@ -73,7 +73,6 @@ write_out_header (file_hdr, out_des) else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii) { char ascii_header[78]; -#ifndef __MSDOS__ dev_t dev; dev_t rdev; @@ -107,9 +106,6 @@ write_out_header (file_hdr, out_des) break; } } -#else - int dev = 0, rdev = 0; -#endif if ((file_hdr->c_ino >> 16) != 0) error (0, 0, _("%s: truncating inode number"), file_hdr->c_name); @@ -216,9 +212,6 @@ process_copy_out () bzero (×, sizeof (struct utimbuf)); file_hdr.c_magic = 070707; -#ifdef __MSDOS__ - setmode (archive_des, O_BINARY); -#endif /* Check whether the output file might be a tape. */ out_file_des = archive_des; if (_isrmt (out_file_des)) @@ -348,7 +341,6 @@ process_copy_out () switch (file_hdr.c_mode & CP_IFMT) { case CP_IFREG: -#ifndef __MSDOS__ if (archive_format == arf_tar || archive_format == arf_ustar) { char *otherfile; @@ -374,7 +366,6 @@ process_copy_out () break; } } -#endif in_file_des = open (input_name.ds_string, O_RDONLY | O_BINARY, 0); if (in_file_des < 0) @@ -393,11 +384,9 @@ process_copy_out () warn_if_file_changed(input_name.ds_string, file_hdr.c_filesize, file_hdr.c_mtime); -#ifndef __MSDOS__ if (archive_format == arf_tar || archive_format == arf_ustar) add_inode (file_hdr.c_ino, file_hdr.c_name, file_hdr.c_dev_maj, file_hdr.c_dev_min); -#endif tape_pad_output (out_file_des, file_hdr.c_filesize); @@ -423,7 +412,6 @@ process_copy_out () write_out_header (&file_hdr, out_file_des); break; -#ifndef __MSDOS__ case CP_IFCHR: case CP_IFBLK: #ifdef CP_IFSOCK @@ -459,7 +447,6 @@ process_copy_out () file_hdr.c_filesize = 0; write_out_header (&file_hdr, out_file_des); break; -#endif #ifdef CP_IFLNK case CP_IFLNK: @@ -800,11 +787,9 @@ writeout_defered_file (header, out_file_des) copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, header->c_name); warn_if_file_changed(header->c_name, file_hdr.c_filesize, file_hdr.c_mtime); -#ifndef __MSDOS__ if (archive_format == arf_tar || archive_format == arf_ustar) add_inode (file_hdr.c_ino, file_hdr.c_name, file_hdr.c_dev_maj, file_hdr.c_dev_min); -#endif tape_pad_output (out_file_des, file_hdr.c_filesize); diff --git a/src/copypass.c b/src/copypass.c index a852a3d..ba1b977 100644 --- a/src/copypass.c +++ b/src/copypass.c @@ -131,7 +131,6 @@ process_copy_pass () /* Do the real copy or link. */ if (S_ISREG (in_file_stat.st_mode)) { -#ifndef __MSDOS__ /* Can the current file be linked to a another file? Set link_name to the original file name. */ if (link_flag) @@ -145,7 +144,6 @@ process_copy_pass () major (in_file_stat.st_dev), minor (in_file_stat.st_dev), in_file_stat.st_ino); -#endif /* If the file was not linked, copy contents of file. */ if (link_res < 0) @@ -291,7 +289,6 @@ process_copy_pass () error (0, errno, "%s", output_name.ds_string); } } -#ifndef __MSDOS__ else if (S_ISCHR (in_file_stat.st_mode) || S_ISBLK (in_file_stat.st_mode) || #ifdef S_ISFIFO @@ -346,7 +343,6 @@ process_copy_pass () } } } -#endif #ifdef S_ISLNK else if (S_ISLNK (in_file_stat.st_mode)) @@ -428,7 +424,6 @@ link_to_maj_min_ino (file_name, st_dev_maj, st_dev_min, st_ino) int link_res; char *link_name; link_res = -1; -#ifndef __MSDOS__ /* Is the file a link to a previously copied file? */ link_name = find_inode_file (st_ino, st_dev_maj, @@ -439,7 +434,6 @@ link_to_maj_min_ino (file_name, st_dev_maj, st_dev_min, st_ino) st_dev_min); else link_res = link_to_name (file_name, link_name); -#endif return link_res; } @@ -456,11 +450,7 @@ link_to_name (link_name, link_target) char *link_name; char *link_target; { - int res; -#ifdef __MSDOS__ - res = -1; -#else /* not __MSDOS__ */ - res = link (link_target, link_name); + int res = link (link_target, link_name); if (res < 0 && create_dir_flag) { create_all_directories (link_name); @@ -477,6 +467,5 @@ link_to_name (link_name, link_target) error (0, errno, _("cannot link %s to %s"), link_target, link_name); } -#endif /* not __MSDOS__ */ return res; } @@ -319,7 +319,6 @@ crc newc odc bin ustar tar (all-caps also recognized)"), optarg); case 'R': /* Set the owner. */ if (no_chown_flag) usage (stderr, 2); -#ifndef __MSDOS__ { char *e, *u, *g; @@ -337,7 +336,6 @@ crc newc odc bin ustar tar (all-caps also recognized)"), optarg); set_group_flag = TRUE; } } -#endif break; case 's': /* Swap bytes. */ @@ -458,13 +456,11 @@ crc newc odc bin ustar tar (all-caps also recognized)"), optarg); error (1, errno, "%s", archive_name); } -#ifndef __MSDOS__ /* Prevent SysV non-root users from giving away files inadvertantly. This happens automatically on BSD, where only root can give away files. */ if (set_owner_flag == FALSE && set_group_flag == FALSE && geteuid ()) no_chown_flag = TRUE; -#endif } /* Initialize the input and output buffers to their proper size and @@ -122,7 +122,6 @@ write_out_tar_header (file_hdr, out_des) case CP_IFDIR: tar_hdr->typeflag = DIRTYPE; break; -#ifndef __MSDOS__ case CP_IFCHR: tar_hdr->typeflag = CHRTYPE; break; @@ -144,7 +143,6 @@ write_out_tar_header (file_hdr, out_des) to_oct (0, 12, tar_hdr->size); break; #endif /* CP_IFLNK */ -#endif /* !__MSDOS__ */ } if (archive_format == arf_ustar) @@ -154,14 +152,12 @@ write_out_tar_header (file_hdr, out_des) strncpy (tar_hdr->magic, TMAGIC, TMAGLEN); strncpy (tar_hdr->magic + TMAGLEN, TVERSION, TVERSLEN); -#ifndef __MSDOS__ name = getuser (file_hdr->c_uid); if (name) strcpy (tar_hdr->uname, name); name = getgroup (file_hdr->c_gid); if (name) strcpy (tar_hdr->gname, name); -#endif to_oct (file_hdr->c_rdev_maj, 8, tar_hdr->devmajor); to_oct (file_hdr->c_rdev_min, 8, tar_hdr->devminor); @@ -202,10 +198,8 @@ read_in_tar_header (file_hdr, in_des) int warned = FALSE; union tar_record tar_rec; struct tar_header *tar_hdr = (struct tar_header *) &tar_rec; -#ifndef __MSDOS__ uid_t *uidp; gid_t *gidp; -#endif tape_buffered_read ((char *) &tar_rec, in_des, TARRECORDSIZE); @@ -268,19 +262,16 @@ read_in_tar_header (file_hdr, in_des) /* Debian hack: This version of cpio uses the -n flag also to extract tar archives using the numeric UID/GID instead of the user/group names in /etc/passwd and /etc/groups. (98/10/15) -BEM */ -#ifndef __MSDOS__ if (archive_format == arf_ustar && !numeric_uid && (uidp = getuidbyname (tar_hdr->uname))) file_hdr->c_uid = *uidp; else -#endif otoa (tar_hdr->uid, &file_hdr->c_uid); -#ifndef __MSDOS__ + if (archive_format == arf_ustar && !numeric_uid && (gidp = getgidbyname (tar_hdr->gname))) file_hdr->c_gid = *gidp; else -#endif otoa (tar_hdr->gid, &file_hdr->c_gid); otoa (tar_hdr->size, &file_hdr->c_filesize); otoa (tar_hdr->mtime, &file_hdr->c_mtime); @@ -298,7 +289,6 @@ read_in_tar_header (file_hdr, in_des) case DIRTYPE: file_hdr->c_mode |= CP_IFDIR; break; -#ifndef __MSDOS__ case CHRTYPE: file_hdr->c_mode |= CP_IFCHR; /* If a POSIX tar header has a valid linkname it's always supposed @@ -341,7 +331,7 @@ read_in_tar_header (file_hdr, in_des) file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname); file_hdr->c_filesize = 0; break; -#endif /* !__MSDOS__ */ + case AREGTYPE: /* Old tar format; if the last char in filename is '/' then it is a directory, otherwise it's a regular file. */ @@ -28,11 +28,7 @@ #include "extern.h" #include "rmt.h" -#ifndef __MSDOS__ #include <sys/ioctl.h> -#else -#include <io.h> -#endif #ifdef HAVE_SYS_MTIO_H #ifdef HAVE_SYS_IO_TRIOCTL_H @@ -706,7 +702,6 @@ find_inode_file (node_num, major_num, minor_num) unsigned long major_num; unsigned long minor_num; { -#ifndef __MSDOS__ int start; /* Initial hash location. */ int temp; /* Rehash search variable. */ @@ -735,7 +730,6 @@ find_inode_file (node_num, major_num, minor_num) return hash_table[temp]->file_name; } } -#endif return NULL; } @@ -748,7 +742,6 @@ add_inode (node_num, file_name, major_num, minor_num) unsigned long major_num; unsigned long minor_num; { -#ifndef __MSDOS__ struct inode_val *temp; /* Create new inode record. */ @@ -791,7 +784,6 @@ add_inode (node_num, file_name, major_num, minor_num) hash table. */ hash_insert (temp); hash_num++; -#endif /* __MSDOS__ */ } /* Do the hash insert. Used in normal inserts and resizing the hash @@ -1037,58 +1029,6 @@ umasked_symlink (name1, name2, mode) } #endif /* SYMLINK_USES_UMASK */ -#if defined(__MSDOS__) && !defined(__GNUC__) -int -chown (path, owner, group) - char *path; - int owner, group; -{ - return 0; -} -#endif - -#ifdef __TURBOC__ -#include <time.h> -#include <fcntl.h> -#include <io.h> - -int -utime (char *filename, struct utimbuf *utb) -{ - struct tm *tm; - struct ftime filetime; - time_t when; - int fd; - int status; - - if (utb == 0) - when = time (0); - else - when = utb->modtime; - - fd = _open (filename, O_RDWR); - if (fd == -1) - return -1; - - tm = localtime (&when); - if (tm->tm_year < 80) - filetime.ft_year = 0; - else - filetime.ft_year = tm->tm_year - 80; - filetime.ft_month = tm->tm_mon + 1; - filetime.ft_day = tm->tm_mday; - if (tm->tm_hour < 0) - filetime.ft_hour = 0; - else - filetime.ft_hour = tm->tm_hour; - filetime.ft_min = tm->tm_min; - filetime.ft_tsec = tm->tm_sec / 2; - - status = setftime (fd, &filetime); - _close (fd); - return status; -} -#endif #ifdef HPUX_CDF /* When we create a cpio archive we mark CDF's by putting an extra `/' after their component name so we can distinguish the CDF's when we |