Skip to content
Browse files

Creating branch fvdl_fs64

  • Loading branch information...
1 parent 272d97a commit 806a6aaf33c5775bdbbc64c643b174648c084f94 cvs committed Jan 2, 2003
Showing with 0 additions and 19,952 deletions.
  1. +0 −59 bin/ls/main.c
  2. +0 −382 bin/ls/print.c
  3. +0 −185 bin/ls/stat_flags.c
  4. +0 −39 bin/ls/stat_flags.h
  5. +0 −82 bin/ls/util.c
  6. +0 −6 bin/mkdir/Makefile
  7. +0 −98 bin/mkdir/mkdir.1
  8. +0 −214 bin/mkdir/mkdir.c
  9. +0 −9 bin/mt/Makefile
  10. +0 −251 bin/mt/mt.1
  11. +0 −319 bin/mt/mt.c
  12. +0 −6 bin/mv/Makefile
  13. +0 −149 bin/mv/mv.1
  14. +0 −381 bin/mv/mv.c
  15. +0 −39 bin/mv/pathnames.h
  16. +0 −68 bin/pax/Makefile
  17. +0 −1,694 bin/pax/ar_io.c
  18. +0 −1,272 bin/pax/ar_subs.c
  19. +0 −999 bin/pax/buf_subs.c
  20. +0 −300 bin/pax/cpio.1
  21. +0 −1,135 bin/pax/cpio.c
  22. +0 −153 bin/pax/cpio.h
  23. +0 −324 bin/pax/extern.h
  24. +0 −1,053 bin/pax/file_subs.c
  25. +0 −748 bin/pax/ftree.c
  26. +0 −52 bin/pax/ftree.h
  27. +0 −408 bin/pax/gen_subs.c
  28. +0 −80 bin/pax/getoldopt.c
  29. +0 −1,986 bin/pax/options.c
  30. +0 −117 bin/pax/options.h
  31. +0 −1,214 bin/pax/pat_rep.c
  32. +0 −56 bin/pax/pat_rep.h
  33. +0 −1,321 bin/pax/pax.1
  34. +0 −459 bin/pax/pax.c
  35. +0 −287 bin/pax/pax.h
  36. +0 −616 bin/pax/sel_subs.c
  37. +0 −73 bin/pax/sel_subs.h
  38. +0 −1,364 bin/pax/tables.c
  39. +0 −180 bin/pax/tables.h
  40. +0 −314 bin/pax/tar.1
  41. +0 −1,304 bin/pax/tar.c
  42. +0 −156 bin/pax/tar.h
Sorry, we could not display the entire diff because too many files (47,991) changed.
View
59 bin/ls/main.c
@@ -1,59 +0,0 @@
-/* $NetBSD: main.c,v 1.2 2000/07/29 03:46:15 lukem Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Luke Mewburn.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-
-#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.2 2000/07/29 03:46:15 lukem Exp $");
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <fts.h>
-
-#include "ls.h"
-#include "extern.h"
-
-int main(int, char *[]);
-
-int
-main(int argc, char *argv[])
-{
-
- return (ls_main(argc, argv));
- /* NOTREACHED */
-}
View
382 bin/ls/print.c
@@ -1,382 +0,0 @@
-/* $NetBSD: print.c,v 1.33 2002/11/09 12:27:08 enami Exp $ */
-
-/*
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Michael Fischbein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
-#else
-__RCSID("$NetBSD: print.c,v 1.33 2002/11/09 12:27:08 enami Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <err.h>
-#include <errno.h>
-#include <fts.h>
-#include <grp.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <tzfile.h>
-#include <unistd.h>
-
-#include "ls.h"
-#include "extern.h"
-
-extern int termwidth;
-
-static int printaname(FTSENT *, int, int);
-static void printlink(FTSENT *);
-static void printtime(time_t);
-static int printtype(u_int);
-
-static time_t now;
-
-#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
-
-void
-printscol(DISPLAY *dp)
-{
- FTSENT *p;
-
- for (p = dp->list; p; p = p->fts_link) {
- if (IS_NOPRINT(p))
- continue;
- (void)printaname(p, dp->s_inode, dp->s_block);
- (void)putchar('\n');
- }
-}
-
-void
-printlong(DISPLAY *dp)
-{
- struct stat *sp;
- FTSENT *p;
- NAMES *np;
- char buf[20];
-
- now = time(NULL);
-
- if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size))
- (void)printf("total %llu\n",
- (long long)(howmany(dp->btotal, blocksize)));
-
- for (p = dp->list; p; p = p->fts_link) {
- if (IS_NOPRINT(p))
- continue;
- sp = p->fts_statp;
- if (f_inode)
- (void)printf("%*lu ", dp->s_inode,
- (unsigned long)sp->st_ino);
- if (f_size)
- (void)printf("%*llu ", dp->s_block,
- (long long)howmany(sp->st_blocks, blocksize));
- (void)strmode(sp->st_mode, buf);
- np = p->fts_pointer;
- (void)printf("%s %*lu %-*s %-*s ", buf, dp->s_nlink,
- (unsigned long)sp->st_nlink, dp->s_user, np->user,
- dp->s_group, np->group);
- if (f_flags)
- (void)printf("%-*s ", dp->s_flags, np->flags);
- if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
- (void)printf("%*u, %*u ",
- dp->s_major, major(sp->st_rdev), dp->s_minor,
- minor(sp->st_rdev));
- else
- (void)printf("%*llu ", dp->s_size,
- (long long)sp->st_size);
- if (f_accesstime)
- printtime(sp->st_atime);
- else if (f_statustime)
- printtime(sp->st_ctime);
- else
- printtime(sp->st_mtime);
- if (f_nonprint)
- (void)printescaped(p->fts_name);
- else
- (void)printf("%s", p->fts_name);
-
- if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
- (void)printtype(sp->st_mode);
- if (S_ISLNK(sp->st_mode))
- printlink(p);
- (void)putchar('\n');
- }
-}
-
-void
-printcol(DISPLAY *dp)
-{
- static FTSENT **array;
- static int lastentries = -1;
- FTSENT *p;
- int base, chcnt, col, colwidth, num;
- int numcols, numrows, row;
-
- colwidth = dp->maxlen;
- if (f_inode)
- colwidth += dp->s_inode + 1;
- if (f_size)
- colwidth += dp->s_block + 1;
- if (f_type || f_typedir)
- colwidth += 1;
-
- colwidth += 1;
-
- if (termwidth < 2 * colwidth) {
- printscol(dp);
- return;
- }
-
- /*
- * Have to do random access in the linked list -- build a table
- * of pointers.
- */
- if (dp->entries > lastentries) {
- lastentries = dp->entries;
- if ((array =
- realloc(array, dp->entries * sizeof(FTSENT *))) == NULL) {
- warn(NULL);
- printscol(dp);
- }
- }
- for (p = dp->list, num = 0; p; p = p->fts_link)
- if (p->fts_number != NO_PRINT)
- array[num++] = p;
-
- numcols = termwidth / colwidth;
- colwidth = termwidth / numcols; /* spread out if possible */
- numrows = num / numcols;
- if (num % numcols)
- ++numrows;
-
- if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size))
- (void)printf("total %llu\n",
- (long long)(howmany(dp->btotal, blocksize)));
- for (row = 0; row < numrows; ++row) {
- for (base = row, chcnt = col = 0; col < numcols; ++col) {
- chcnt = printaname(array[base], dp->s_inode,
- dp->s_block);
- if ((base += numrows) >= num)
- break;
- while (chcnt++ < colwidth)
- (void)putchar(' ');
- }
- (void)putchar('\n');
- }
-}
-
-void
-printacol(DISPLAY *dp)
-{
- FTSENT *p;
- int chcnt, col, colwidth;
- int numcols;
-
- colwidth = dp->maxlen;
- if (f_inode)
- colwidth += dp->s_inode + 1;
- if (f_size)
- colwidth += dp->s_block + 1;
- if (f_type || f_typedir)
- colwidth += 1;
-
- colwidth += 1;
-
- if (termwidth < 2 * colwidth) {
- printscol(dp);
- return;
- }
-
- numcols = termwidth / colwidth;
- colwidth = termwidth / numcols; /* spread out if possible */
-
- if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size))
- (void)printf("total %llu\n",
- (long long)(howmany(dp->btotal, blocksize)));
- chcnt = col = 0;
- for (p = dp->list; p; p = p->fts_link) {
- if (IS_NOPRINT(p))
- continue;
- if (col >= numcols) {
- chcnt = col = 0;
- (void)putchar('\n');
- }
- chcnt = printaname(p, dp->s_inode, dp->s_block);
- while (chcnt++ < colwidth)
- (void)putchar(' ');
- col++;
- }
- (void)putchar('\n');
-}
-
-void
-printstream(DISPLAY *dp)
-{
- FTSENT *p;
- int col;
- int extwidth;
-
- extwidth = 0;
- if (f_inode)
- extwidth += dp->s_inode + 1;
- if (f_size)
- extwidth += dp->s_block + 1;
- if (f_type)
- extwidth += 1;
-
- for (col = 0, p = dp->list; p != NULL; p = p->fts_link) {
- if (IS_NOPRINT(p))
- continue;
- if (col > 0) {
- (void)putchar(','), col++;
- if (col + 1 + extwidth + p->fts_namelen >= termwidth)
- (void)putchar('\n'), col = 0;
- else
- (void)putchar(' '), col++;
- }
- col += printaname(p, dp->s_inode, dp->s_block);
- }
- (void)putchar('\n');
-}
-
-/*
- * print [inode] [size] name
- * return # of characters printed, no trailing characters.
- */
-static int
-printaname(FTSENT *p, int inodefield, int sizefield)
-{
- struct stat *sp;
- int chcnt;
-
- sp = p->fts_statp;
- chcnt = 0;
- if (f_inode)
- chcnt += printf("%*lu ", inodefield, (unsigned long)sp->st_ino);
- if (f_size)
- chcnt += printf("%*llu ", sizefield,
- (long long)howmany(sp->st_blocks, blocksize));
- if (f_nonprint)
- chcnt += printescaped(p->fts_name);
- else
- chcnt += printf("%s", p->fts_name);
- if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
- chcnt += printtype(sp->st_mode);
- return (chcnt);
-}
-
-static void
-printtime(time_t ftime)
-{
- int i;
- char *longstring;
-
- longstring = ctime(&ftime);
- for (i = 4; i < 11; ++i)
- (void)putchar(longstring[i]);
-
-#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
- if (f_sectime)
- for (i = 11; i < 24; i++)
- (void)putchar(longstring[i]);
- else if (ftime + SIXMONTHS > now && ftime - SIXMONTHS < now)
- for (i = 11; i < 16; ++i)
- (void)putchar(longstring[i]);
- else {
- (void)putchar(' ');
- for (i = 20; i < 24; ++i)
- (void)putchar(longstring[i]);
- }
- (void)putchar(' ');
-}
-
-static int
-printtype(u_int mode)
-{
- switch (mode & S_IFMT) {
- case S_IFDIR:
- (void)putchar('/');
- return (1);
- case S_IFIFO:
- (void)putchar('|');
- return (1);
- case S_IFLNK:
- (void)putchar('@');
- return (1);
- case S_IFSOCK:
- (void)putchar('=');
- return (1);
- case S_IFWHT:
- (void)putchar('%');
- return (1);
- }
- if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
- (void)putchar('*');
- return (1);
- }
- return (0);
-}
-
-static void
-printlink(FTSENT *p)
-{
- int lnklen;
- char name[MAXPATHLEN + 1], path[MAXPATHLEN + 1];
-
- if (p->fts_level == FTS_ROOTLEVEL)
- (void)snprintf(name, sizeof(name), "%s", p->fts_name);
- else
- (void)snprintf(name, sizeof(name),
- "%s/%s", p->fts_parent->fts_accpath, p->fts_name);
- if ((lnklen = readlink(name, path, sizeof(path) - 1)) == -1) {
- (void)fprintf(stderr, "\nls: %s: %s\n", name, strerror(errno));
- return;
- }
- path[lnklen] = '\0';
- (void)printf(" -> ");
- if (f_nonprint)
- printescaped(path);
- else
- (void)printf("%s", path);
-}
View
185 bin/ls/stat_flags.c
@@ -1,185 +0,0 @@
-/* $NetBSD: stat_flags.c,v 1.15 2002/11/16 13:42:36 itojun Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if defined(__RCSID) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94";
-#else
-__RCSID("$NetBSD: stat_flags.c,v 1.15 2002/11/16 13:42:36 itojun Exp $");
-#endif
-#endif /* not lint */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#else
-#define HAVE_STRUCT_STAT_ST_FLAGS 1
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fts.h>
-#include <stddef.h>
-#include <string.h>
-
-#include "stat_flags.h"
-
-#define SAPPEND(s) do { \
- if (prefix != NULL) \
- (void)strcat(string, prefix); \
- (void)strcat(string, s); \
- prefix = ","; \
-} while (/* CONSTCOND */ 0)
-
-/*
- * flags_to_string --
- * Convert stat flags to a comma-separated string. If no flags
- * are set, return the default string.
- */
-char *
-flags_to_string(u_long flags, const char *def)
-{
- static char string[128];
- const char *prefix;
-
- string[0] = '\0';
- prefix = NULL;
-#if HAVE_STRUCT_STAT_ST_FLAGS
- if (flags & UF_APPEND)
- SAPPEND("uappnd");
- if (flags & UF_IMMUTABLE)
- SAPPEND("uchg");
- if (flags & UF_NODUMP)
- SAPPEND("nodump");
- if (flags & UF_OPAQUE)
- SAPPEND("opaque");
- if (flags & SF_APPEND)
- SAPPEND("sappnd");
- if (flags & SF_ARCHIVED)
- SAPPEND("arch");
- if (flags & SF_IMMUTABLE)
- SAPPEND("schg");
-#endif
- if (prefix == NULL)
- strlcpy(string, def, sizeof(string));
- return (string);
-}
-
-#define TEST(a, b, f) { \
- if (!strcmp(a, b)) { \
- if (clear) { \
- if (clrp) \
- *clrp |= (f); \
- if (setp) \
- *setp &= ~(f); \
- } else { \
- if (setp) \
- *setp |= (f); \
- if (clrp) \
- *clrp &= ~(f); \
- } \
- break; \
- } \
-}
-
-/*
- * string_to_flags --
- * Take string of arguments and return stat flags. Return 0 on
- * success, 1 on failure. On failure, stringp is set to point
- * to the offending token.
- */
-int
-string_to_flags(char **stringp, u_long *setp, u_long *clrp)
-{
- int clear;
- char *string, *p;
-
- if (setp)
- *setp = 0;
- if (clrp)
- *clrp = 0;
-
-#if HAVE_STRUCT_STAT_ST_FLAGS
- string = *stringp;
- while ((p = strsep(&string, "\t ,")) != NULL) {
- clear = 0;
- *stringp = p;
- if (*p == '\0')
- continue;
- if (p[0] == 'n' && p[1] == 'o') {
- clear = 1;
- p += 2;
- }
- switch (p[0]) {
- case 'a':
- TEST(p, "arch", SF_ARCHIVED);
- TEST(p, "archived", SF_ARCHIVED);
- return (1);
- case 'd':
- clear = !clear;
- TEST(p, "dump", UF_NODUMP);
- return (1);
- case 'n':
- /*
- * Support `nonodump'. Note that
- * the state of clear is not changed.
- */
- TEST(p, "nodump", UF_NODUMP);
- return (1);
- case 'o':
- TEST(p, "opaque", UF_OPAQUE);
- return (1);
- case 's':
- TEST(p, "sappnd", SF_APPEND);
- TEST(p, "sappend", SF_APPEND);
- TEST(p, "schg", SF_IMMUTABLE);
- TEST(p, "schange", SF_IMMUTABLE);
- TEST(p, "simmutable", SF_IMMUTABLE);
- return (1);
- case 'u':
- TEST(p, "uappnd", UF_APPEND);
- TEST(p, "uappend", UF_APPEND);
- TEST(p, "uchg", UF_IMMUTABLE);
- TEST(p, "uchange", UF_IMMUTABLE);
- TEST(p, "uimmutable", UF_IMMUTABLE);
- return (1);
- default:
- return (1);
- }
- }
-#endif
-
- return (0);
-}
View
39 bin/ls/stat_flags.h
@@ -1,39 +0,0 @@
-/* $NetBSD: stat_flags.h,v 1.3 2001/10/18 03:16:20 lukem Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)extern.h 8.1 (Berkeley) 5/31/93
- */
-
-char *flags_to_string(u_long, const char *);
-int string_to_flags(char **, u_long *, u_long *);
View
82 bin/ls/util.c
@@ -1,82 +0,0 @@
-/* $NetBSD: util.c,v 1.23 2002/11/09 12:27:08 enami Exp $ */
-
-/*
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Michael Fischbein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)util.c 8.5 (Berkeley) 4/28/95";
-#else
-__RCSID("$NetBSD: util.c,v 1.23 2002/11/09 12:27:08 enami Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <fts.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ls.h"
-#include "extern.h"
-
-int
-printescaped(const char *src)
-{
- unsigned char c;
- int n;
-
- for (n = 0; (c = *src) != '\0'; ++src, ++n)
- if (isprint(c))
- (void)putchar(c);
- else
- (void)putchar('?');
- return (n);
-}
-
-void
-usage(void)
-{
-
- (void)fprintf(stderr,
- "usage: ls [-ACFLRSTWacdfgiklmnopqrstux1] [file ...]\n");
- exit(EXIT_FAILURE);
- /* NOTREACHED */
-}
View
6 bin/mkdir/Makefile
@@ -1,6 +0,0 @@
-# $NetBSD: Makefile,v 1.8 1997/07/20 22:37:21 christos Exp $
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-PROG= mkdir
-
-.include <bsd.prog.mk>
View
98 bin/mkdir/mkdir.1
@@ -1,98 +0,0 @@
-.\" $NetBSD: mkdir.1,v 1.15 2002/09/25 15:18:40 wiz Exp $
-.\"
-.\" Copyright (c) 1989, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the Institute of Electrical and Electronics Engineers, Inc.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)mkdir.1 8.2 (Berkeley) 1/25/94
-.\"
-.Dd January 25, 1994
-.Dt MKDIR 1
-.Os
-.Sh NAME
-.Nm mkdir
-.Nd make directories
-.Sh SYNOPSIS
-.Nm
-.Op Fl p
-.Op Fl m Ar mode
-.Ar directory_name ...
-.Sh DESCRIPTION
-.Nm
-creates the directories named as operands, in the order specified,
-using mode
-.Li rwxrwxrwx (\&0777)
-as modified by the current
-.Xr umask 2 .
-.Pp
-The options are as follows:
-.Pp
-.Bl -tag -width indent
-.It Fl m
-Set the file permission bits of the final created directory to
-the specified mode.
-The mode argument can be in any of the formats specified to the
-.Xr chmod 1
-utility.
-If a symbolic mode is specified, the operation characters
-.Dq +
-and
-.Dq -
-are interpreted relative to an initial mode of
-.Dq a=rwx .
-.It Fl p
-Create intermediate directories as required.
-If this option is not specified, the full path prefix of each
-operand must already exist.
-Intermediate directories are created with permission bits of
-.Li rwxrwxrwx (\&0777)
-as modified by the current umask, plus write and search
-permission for the owner.
-Do not consider it an error if the argument directory already exists.
-.El
-.Pp
-The user must have write permission in the parent directory.
-.Sh EXIT STATUS
-.Nm
-exits 0 if successful, and \*[Gt]0 if an error occurred.
-.Sh SEE ALSO
-.Xr chmod 1 ,
-.Xr rmdir 1 ,
-.Xr mkdir 2 ,
-.Xr umask 2
-.Sh STANDARDS
-The
-.Nm
-utility is expected to be
-.St -p1003.2
-compatible.
View
214 bin/mkdir/mkdir.c
@@ -1,214 +0,0 @@
-/* $NetBSD: mkdir.c,v 1.27 2002/11/24 23:40:07 chs Exp $ */
-
-/*
- * Copyright (c) 1983, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1983, 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94";
-#else
-__RCSID("$NetBSD: mkdir.c,v 1.27 2002/11/24 23:40:07 chs Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <err.h>
-#include <errno.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int mkpath(char *, mode_t, mode_t);
-void usage(void);
-int main(int, char *[]);
-
-int
-main(int argc, char *argv[])
-{
- int ch, exitval, pflag;
- void *set;
- mode_t mode, dir_mode;
-
- setprogname(argv[0]);
- (void)setlocale(LC_ALL, "");
-
- /*
- * The default file mode is a=rwx (0777) with selected permissions
- * removed in accordance with the file mode creation mask. For
- * intermediate path name components, the mode is the default modified
- * by u+wx so that the subdirectories can always be created.
- */
- mode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~umask(0);
- dir_mode = mode | S_IWUSR | S_IXUSR;
-
- pflag = 0;
- while ((ch = getopt(argc, argv, "m:p")) != -1)
- switch (ch) {
- case 'p':
- pflag = 1;
- break;
- case 'm':
- if ((set = setmode(optarg)) == NULL)
- errx(1, "invalid file mode: %s", optarg);
- mode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO);
- free(set);
- break;
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- if (*argv == NULL)
- usage();
-
- for (exitval = EXIT_SUCCESS; *argv != NULL; ++argv) {
- char *slash;
-
- /* Remove trailing slashes, per POSIX. */
- slash = strrchr(*argv, '\0');
- while (--slash > *argv && *slash == '/')
- *slash = '\0';
-
- if (pflag) {
- if (mkpath(*argv, mode, dir_mode) < 0)
- exitval = EXIT_FAILURE;
- } else {
- if (mkdir(*argv, mode) < 0) {
- warn("%s", *argv);
- exitval = EXIT_FAILURE;
- } else {
- /*
- * The mkdir() and umask() calls both honor
- * only the file permission bits, so if you try
- * to set a mode including the sticky, setuid,
- * setgid bits you lose them. So chmod().
- */
- if ((mode & ~(S_IRWXU|S_IRWXG|S_IRWXO)) != 0 &&
- chmod(*argv, mode) == -1) {
- warn("%s", *argv);
- exitval = EXIT_FAILURE;
- }
- }
- }
- }
- exit(exitval);
- /* NOTREACHED */
-}
-
-/*
- * mkpath -- create directories.
- * path - path
- * mode - file mode of terminal directory
- * dir_mode - file mode of intermediate directories
- */
-int
-mkpath(char *path, mode_t mode, mode_t dir_mode)
-{
- struct stat sb;
- char *slash;
- int done, rv;
-
- done = 0;
- slash = path;
-
- for (;;) {
- slash += strspn(slash, "/");
- slash += strcspn(slash, "/");
-
- done = (*slash == '\0');
- *slash = '\0';
-
- rv = mkdir(path, done ? mode : dir_mode);
- if (rv < 0 && errno != EEXIST) {
- warn("%s", path);
- return (-1);
- }
- if (done) {
- break;
- }
- *slash = '/';
- }
-
- /*
- * Check for the final component being something other than
- * a directory.
- */
-
- if (rv < 0) {
- if (stat(path, &sb) < 0) {
- warn("stat %s failed", path);
- return (-1);
- }
- if (!S_ISDIR(sb.st_mode)) {
- errno = ENOTDIR;
- warn("%s", path);
- return (-1);
- }
- }
-
- /*
- * The mkdir() and umask() calls both honor only the
- * file permission bits, so if you try to set a mode
- * including the sticky, setuid, setgid bits you lose
- * them. So chmod().
- */
-
- if ((mode & ~(S_IRWXU|S_IRWXG|S_IRWXU)) != 0 &&
- chmod(path, mode) == -1) {
- warn("%s", path);
- return (-1);
- }
- return (0);
-}
-
-void
-usage(void)
-{
-
- (void)fprintf(stderr, "usage: %s [-p] [-m mode] dirname ...\n",
- getprogname());
- exit(EXIT_FAILURE);
- /* NOTREACHED */
-}
View
9 bin/mt/Makefile
@@ -1,9 +0,0 @@
-# $NetBSD: Makefile,v 1.8 1997/07/20 22:37:23 christos Exp $
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= mt
-SRCS= mt.c
-LDADD+= -lrmt
-DPADD+= ${LIBRMT}
-
-.include <bsd.prog.mk>
View
251 bin/mt/mt.1
@@ -1,251 +0,0 @@
-.\" $NetBSD: mt.1,v 1.30 2002/09/25 15:18:41 wiz Exp $
-.\"
-.\" Copyright (c) 1981, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)mt.1 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt MT 1
-.Os
-.Sh NAME
-.Nm mt
-.Nd magnetic tape manipulation
-.Sh SYNOPSIS
-.Nm
-.Op Fl f Ar tapename
-.Ar command
-.Op Ar count
-.Sh DESCRIPTION
-The
-.Nm
-program is used to give commands to a magnetic tape drive.
-By default
-.Nm
-performs the requested operation once.
-Operations may be performed multiple times by specifying
-.Ar count .
-.Pp
-Note
-that
-.Ar tapename
-must reference a raw (not block) tape device.
-If
-.Ar tapename
-is of the form
-.Qq host:tapename ,
-or
-.Qq user@host:tapename ,
-.Nm
-writes to the named tape device on the remote host using
-.Xr rmt 8 .
-.Pp
-The
-.Xr rmt 8
-process on the remote host is typically initiated via
-.Xr rsh 1 ,
-although an alternate method such as
-.Xr ssh 1
-can be specified via the
-.Ev RCMD_CMD
-environment variable.
-.Pp
-The available commands are listed below.
-Only as many characters as are required to uniquely identify a command
-need be specified.
-.Bl -tag -width "eof, weof"
-.It Cm asf
-Move forward
-.Ar count
-files from the beginning of the tape.
-This is accomplished by a rewind followed by fsf
-.Ar count .
-.It Cm eof , weof
-Write
-.Ar count
-end-of-file marks at the current position on the tape.
-.It Cm fsf
-Forward space
-.Ar count
-files.
-.It Cm fsr
-Forward space
-.Ar count
-records.
-.It Cm bsf
-Back space
-.Ar count
-files.
-.It Cm bsr
-Back space
-.Ar count
-records.
-.It Cm rewind
-Rewind the tape
-(Count is ignored).
-.It Cm offline , rewoffl
-Rewind the tape and place the tape unit off-line
-(Count is ignored).
-.It Cm status
-Print status information about the tape unit
-(Count is ignored).
-.It Cm retension
-Retensions the tape
-(Not all tape drives support this feature; count is ignored).
-.It Cm erase
-Erases the tape
-(Not all tape drives support this feature; count is ignored).
-.It Cm eew
-Enable or disabled early warning EOM behaviour.
-.Ar Count
-is set to nonzero to enable, zero to disable.
-.It Cm eom
-Forward space to the end of recorded media
-(Count is ignored).
-.It Cm blocksize , setblk
-Set the tape blocksize to
-.Ar count
-bytes.
-A
-.Ar count
-of zero sets variable blocksize.
-.It Cm density , setdensity
-Set the tape density code to
-.Ar count
-as specified in the
-.Tn SCSI-3
-specification.
-See the
-.Sx DENSITY CODES
-section for a list of codes for commonly used media types.
-.It Cm rdspos
-Read the logical block position of the tape
-(Not all tape drives support this feature; count is ignored).
-.It Cm rdhpos
-Read the hardware block position of the tape
-(Not all tape drives support this feature; count is ignored).
-.It Cm setspos
-Set the logical block position of the tape to
-.Ar count
-(not all tape drives support this feature).
-.It Cm sethpos
-Set the hardware block position of the tape to
-.Ar count
-(not all tape drives support this feature).
-.It Cm compress
-If
-.Ar count
-is zero, disable compression.
-Otherwise enable compression (not all tape drives support this feature).
-.El
-.Pp
-If a tape name is not specified, and the environment variable
-.Ev TAPE
-is not set, then
-.Nm
-uses the device
-.Pa /dev/nrst0 .
-.Sh EXIT STATUS
-.Nm
-returns a 0 exit status when the operation(s) were successful,
-1 if the command was unrecognized, and 2 if an operation failed.
-.Sh DENSITY CODES
-The SCSI-3 specification defines a number of density codes for
-various tape media, some of which are listed here.
-Note that many tape drive vendors also define model-specific codes.
-.Pp
-.Bl -column "Code" "Format" -compact
-.It Em "Code Format"
-.It Li 0 Ta Device default
-.It Li 1 Ta 1/2" 800 bpi
-.It Li 2 Ta 1/2" 1600 bpi
-.It Li 3 Ta 1/2" 6250 bpi
-.It Li 4 Ta QIC-11
-.It Li 5 Ta QIC-24
-.It Li 15 Ta QIC-120
-.It Li 16 Ta QIC-150
-.It Li 17 Ta QIC-320/525
-.It Li 18 Ta QIC-1320/1350
-.It Li 19 Ta DDS
-.It Li 28 Ta QIC-385M
-.It Li 29 Ta QIC-410M
-.It Li 30 Ta QIC-1000C
-.It Li 31 Ta QIC-2100C
-.It Li 32 Ta QIC-6GB
-.It Li 33 Ta QIC-20GB
-.It Li 34 Ta QIC-2GB
-.It Li 35 Ta QIC-875M
-.It Li 36 Ta DDS-2
-.It Li 37 Ta DDS-3
-.It Li 38 Ta DDS-4
-.El
-.Sh ENVIRONMENT
-If the following environment variables exist, they are utilized by
-.Nm "" .
-.Bl -tag -width Fl
-.It Ev TAPE
-.Nm
-uses device filename given in the
-.Ev TAPE
-environment variable if the
-.Ar tapename
-argument is not given.
-.It Ev RCMD_CMD
-.Nm
-will use
-.Ev RCMD_CMD
-rather than
-.Pa /usr/bin/rsh
-to invoke
-.Xr rmt 8
-on a remote machine.
-The full path name must be specified.
-.El
-.Sh FILES
-.Bl -tag -width /dev/rst* -compact
-.It Pa /dev/rst*
-Raw
-.Tn SCSI
-tape device
-.It Pa /dev/rmt*
-Raw magnetic tape device
-.El
-.Sh SEE ALSO
-.Xr dd 1 ,
-.Xr ioctl 2 ,
-.Xr mtio 4 ,
-.Xr st 4 ,
-.Xr environ 7
-.Sh HISTORY
-The
-.Nm
-utility appeared in
-.Bx 4.3 .
View
319 bin/mt/mt.c
@@ -1,319 +0,0 @@
-/* $NetBSD: mt.c,v 1.36 2001/09/16 21:57:34 wiz Exp $ */
-
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 6/6/93";
-#else
-__RCSID("$NetBSD: mt.c,v 1.36 2001/09/16 21:57:34 wiz Exp $");
-#endif
-#endif /* not lint */
-
-/*
- * mt --
- * magnetic tape manipulation program
- */
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <rmt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/* pseudo ioctl constants */
-#define MTASF 100
-
-struct commands {
- const char *c_name; /* command */
- int c_spcl; /* ioctl request */
- int c_code; /* ioctl code for MTIOCTOP command */
- int c_ronly; /* open tape read-only */
- int c_mincount; /* min allowed count value */
-};
-
-const struct commands com[] = {
- { "asf", MTIOCTOP, MTASF, 1, 0 },
- { "blocksize", MTIOCTOP, MTSETBSIZ, 1, 0 },
- { "bsf", MTIOCTOP, MTBSF, 1, 1 },
- { "bsr", MTIOCTOP, MTBSR, 1, 1 },
- { "compress", MTIOCTOP, MTCMPRESS, 1, 0 },
- { "density", MTIOCTOP, MTSETDNSTY, 1, 0 },
- { "eof", MTIOCTOP, MTWEOF, 0, 1 },
- { "eom", MTIOCTOP, MTEOM, 1, 0 },
- { "erase", MTIOCTOP, MTERASE, 0, 0 },
- { "fsf", MTIOCTOP, MTFSF, 1, 1 },
- { "fsr", MTIOCTOP, MTFSR, 1, 1 },
- { "offline", MTIOCTOP, MTOFFL, 1, 0 },
- { "rdhpos", MTIOCRDHPOS, 0, 1, 0 },
- { "rdspos", MTIOCRDSPOS, 0, 1, 0 },
- { "retension", MTIOCTOP, MTRETEN, 1, 0 },
- { "rewind", MTIOCTOP, MTREW, 1, 0 },
- { "rewoffl", MTIOCTOP, MTOFFL, 1, 0 },
- { "setblk", MTIOCTOP, MTSETBSIZ, 1, 0 },
- { "setdensity", MTIOCTOP, MTSETDNSTY, 1, 0 },
- { "sethpos", MTIOCHLOCATE, 0, 1, 0 },
- { "setspos", MTIOCSLOCATE, 0, 1, 0 },
- { "status", MTIOCGET, MTNOP, 1, 0 },
- { "weof", MTIOCTOP, MTWEOF, 0, 1 },
- { "eew", MTIOCTOP, MTEWARN, 1, 0 },
- { NULL }
-};
-
-void printreg(const char *, u_int, const char *);
-void status(struct mtget *);
-void usage(void);
-int main(int, char *[]);
-
-int
-main(int argc, char *argv[])
-{
- const struct commands *comp = (const struct commands *) NULL;
- struct mtget mt_status;
- struct mtop mt_com;
- int ch, len, mtfd, flags;
- char *p;
- const char *tape;
- int count;
-
- setprogname(argv[0]);
- if ((tape = getenv("TAPE")) == NULL)
- tape = _PATH_DEFTAPE;
-
- while ((ch = getopt(argc, argv, "f:t:")) != -1)
- switch (ch) {
- case 'f':
- case 't':
- tape = optarg;
- break;
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- if (argc < 1 || argc > 2)
- usage();
-
- len = strlen(p = *argv++);
- for (comp = com;; comp++) {
- if (comp->c_name == NULL)
- errx(1, "%s: unknown command", p);
- if (strncmp(p, comp->c_name, len) == 0)
- break;
- }
-
- if (*argv) {
- count = strtol(*argv, &p, 10);
- if (count < comp->c_mincount || *p)
- errx(2, "%s: illegal count", *argv);
- } else
- count = 1;
-
- flags = comp->c_ronly ? O_RDONLY : O_WRONLY;
-
- if ((mtfd = open(tape, flags)) < 0)
- err(2, "%s", tape);
-
- switch (comp->c_spcl) {
- case MTIOCTOP:
- if (comp->c_code == MTASF) {
-
- /* If mtget.mt_fileno was implemented, We could
- compute the minimal seek needed to position
- the tape. Until then, rewind and seek from
- begining-of-tape */
-
- mt_com.mt_op = MTREW;
- mt_com.mt_count = 1;
- if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0)
- err(2, "%s", tape);
-
- if (count > 0) {
- mt_com.mt_op = MTFSF;
- mt_com.mt_count = count;
- if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0)
- err(2, "%s", tape);
- }
-
- } else {
- mt_com.mt_op = comp->c_code;
- mt_com.mt_count = count;
-
- if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0)
- err(2, "%s: %s", tape, comp->c_name);
-
- }
- break;
-
- case MTIOCGET:
- if (ioctl(mtfd, MTIOCGET, &mt_status) < 0)
- err(2, "%s: %s", tape, comp->c_name);
- status(&mt_status);
- break;
-
- case MTIOCRDSPOS:
- case MTIOCRDHPOS:
- if (ioctl(mtfd, comp->c_spcl, (caddr_t) &count) < 0)
- err(2, "%s", tape);
- printf("%s: block location %u\n", tape, (unsigned int) count);
- break;
-
- case MTIOCSLOCATE:
- case MTIOCHLOCATE:
- if (ioctl(mtfd, comp->c_spcl, (caddr_t) &count) < 0)
- err(2, "%s", tape);
- break;
-
- default:
- errx(1, "internal error: unknown request %d", comp->c_spcl);
- }
-
- exit(0);
- /* NOTREACHED */
-}
-
-#if defined(sun) && !defined(__SVR4)
-#include <sundev/tmreg.h>
-#include <sundev/arreg.h>
-#endif
-
-#ifdef tahoe
-#include <tahoe/vba/cyreg.h>
-#endif
-
-const struct tape_desc {
- short t_type; /* type of magtape device */
- const char *t_name; /* printing name */
- const char *t_dsbits; /* "drive status" register */
- const char *t_erbits; /* "error" register */
-} tapes[] = {
-#if defined(sun) && !defined(__SVR4)
- { MT_ISCPC, "TapeMaster", TMS_BITS, 0 },
- { MT_ISAR, "Archive", ARCH_CTRL_BITS, ARCH_BITS },
-#endif
-#ifdef tahoe
- { MT_ISCY, "cipher", CYS_BITS, CYCW_BITS },
-#endif
-#define SCSI_DS_BITS "\20\5WriteProtect\2Mounted"
- { 0x7, "SCSI", SCSI_DS_BITS, "76543210" },
- { 0 }
-};
-
-
-/*
- * Interpret the status buffer returned
- */
-void
-status(struct mtget *bp)
-{
- const struct tape_desc *mt;
-
- for (mt = tapes;; mt++) {
- if (mt->t_type == 0) {
- (void)printf("%d: unknown tape drive type\n",
- bp->mt_type);
- return;
- }
- if (mt->t_type == bp->mt_type)
- break;
- }
- (void)printf("%s tape drive, residual=%d\n", mt->t_name, bp->mt_resid);
- printreg("ds", bp->mt_dsreg, mt->t_dsbits);
- printreg("\ner", bp->mt_erreg, mt->t_erbits);
- (void)putchar('\n');
- (void)printf("blocksize: %d (%d, %d, %d, %d)\n",
- bp->mt_blksiz, bp->mt_mblksiz[0], bp->mt_mblksiz[1],
- bp->mt_mblksiz[2], bp->mt_mblksiz[3]);
- (void)printf("density: %d (%d, %d, %d, %d)\n",
- bp->mt_density, bp->mt_mdensity[0], bp->mt_mdensity[1],
- bp->mt_mdensity[2], bp->mt_mdensity[3]);
- (void)printf("current file number: %d\n", bp->mt_fileno);
- (void)printf("current block number: %d\n", bp->mt_blkno);
-}
-
-/*
- * Print a register a la the %b format of the kernel's printf.
- */
-void
-printreg(const char *s, u_int v, const char *bits)
-{
- int any, i;
- char c;
-
- any = 0;
- if (bits && *bits == 8)
- printf("%s=%o", s, v);
- else
- printf("%s=%x", s, v);
- bits++;
- if (v && *bits) {
- putchar('<');
- while ((i = *bits++)) {
- if (v & (1 << (i-1))) {
- if (any)
- putchar(',');
- any = 1;
- for (; (c = *bits) > 32; bits++)
- putchar(c);
- } else
- for (; *bits > 32; bits++)
- ;
- }
- putchar('>');
- }
-}
-
-void
-usage(void)
-{
- (void)fprintf(stderr, "usage: %s [-f device] command [ count ]\n", getprogname());
- exit(1);
- /* NOTREACHED */
-}
View
6 bin/mv/Makefile
@@ -1,6 +0,0 @@
-# $NetBSD: Makefile,v 1.9 2002/11/30 03:16:14 lukem Exp $
-# @(#)Makefile 8.2 (Berkeley) 4/2/94
-
-PROG= mv
-
-.include <bsd.prog.mk>
View
149 bin/mv/mv.1
@@ -1,149 +0,0 @@
-.\" $NetBSD: mv.1,v 1.21 2002/12/28 21:16:49 wiz Exp $
-.\"
-.\" Copyright (c) 1989, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the Institute of Electrical and Electronics Engineers, Inc.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)mv.1 8.1 (Berkeley) 5/31/93
-.\"
-.Dd December 26, 2002
-.Dt MV 1
-.Os
-.Sh NAME
-.Nm mv
-.Nd move files
-.Sh SYNOPSIS
-.Nm
-.Op Fl fiv
-.Ar source target
-.Nm ""
-.Op Fl fiv
-.Ar source ... directory
-.Sh DESCRIPTION
-In its first form, the
-.Nm
-utility renames the file named by the
-.Ar source
-operand to the destination path named by the
-.Ar target
-operand.
-This form is assumed when the last operand does not name an already
-existing directory.
-.Pp
-In its second form,
-.Nm
-moves each file named by a
-.Ar source
-operand to a destination file in the existing directory named by the
-.Ar directory
-operand.
-The destination path for each operand is the pathname produced by the
-concatenation of the last operand, a slash, and the final pathname
-component of the named file.
-.Pp
-The following options are available:
-.Bl -tag -width flag
-.It Fl f
-Do not prompt for confirmation before overwriting the destination
-path.
-.It Fl i
-Causes
-.Nm
-to write a prompt to standard error before moving a file that would
-overwrite an existing file.
-If the response from the standard input begins with the character ``y'',
-the move is attempted.
-.It Fl v
-Cause
-.Nm
-to be verbose, showing files as they are processed.
-.El
-The last of any
-.Fl f
-or
-.Fl i
-options is the one which affects
-.Nm Ns 's
-behavior.
-.Pp
-It is an error for any of the
-.Ar source
-operands to specify a nonexistent file or directory.
-.Pp
-It is an error for the
-.Ar source
-operand to specify a directory if the
-.Ar target
-exists and is not a directory.
-.Pp
-If the destination path does not have a mode which permits writing,
-.Nm
-prompts the user for confirmation as specified for the
-.Fl i
-option.
-.Pp
-Should the
-.Xr rename 2
-call fail because
-.Ar source
-and
-.Ar target
-are on different file systems,
-.Nm
-will remove the destination file, copy the source file to the
-destination, and then remove the source.
-The effect is roughly equivalent to:
-.Bd -literal -offset indent
-rm -f destination_path \*[Am]\*[Am] \e
-\tcp -PRp source_file destination_path \*[Am]\*[Am] \e
-\trm -rf source_file
-.Ed
-.Sh EXIT STATUS
-The
-.Nm
-utility exits 0 on success, and \*[Gt]0 if an error occurs.
-.Sh SEE ALSO
-.Xr cp 1 ,
-.Xr rename 2 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Nm
-utility is expected to be
-.St -p1003.2
-compatible.
-.Pp
-The
-.Fl v
-option is an extension to
-.St -p1003.2 .
View
381 bin/mv/mv.c
@@ -1,381 +0,0 @@
-/* $NetBSD: mv.c,v 1.28 2002/12/26 21:37:17 jrf Exp $ */
-
-/*
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ken Smith of The State University of New York at Buffalo.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n");
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: mv.c,v 1.28 2002/12/26 21:37:17 jrf Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <locale.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "pathnames.h"
-
-int fflg, iflg, vflg;
-int stdin_ok;
-
-int copy(char *, char *);
-int do_move(char *, char *);
-int fastcopy(char *, char *, struct stat *);
-void usage(void);
-int main(int, char *[]);
-
-int
-main(int argc, char *argv[])
-{
- int baselen, ch, len, rval;
- char *p, *endp;
- struct stat sb;
- char path[MAXPATHLEN + 1];
-
- setprogname(argv[0]);
- (void)setlocale(LC_ALL, "");
-
- while ((ch = getopt(argc, argv, "ifv")) != -1)
- switch (ch) {
- case 'i':
- fflg = 0;
- iflg = 1;
- break;
- case 'f':
- iflg = 0;
- fflg = 1;
- break;
- case 'v':
- vflg = 1;
- break;
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- if (argc < 2)
- usage();
-
- stdin_ok = isatty(STDIN_FILENO);
-
- /*
- * If the stat on the target fails or the target isn't a directory,
- * try the move. More than 2 arguments is an error in this case.
- */
- if (stat(argv[argc - 1], &sb) || !S_ISDIR(sb.st_mode)) {
- if (argc > 2)
- usage();
- exit(do_move(argv[0], argv[1]));
- }
-
- /* It's a directory, move each file into it. */
- (void)strcpy(path, argv[argc - 1]);
- baselen = strlen(path);
- endp = &path[baselen];
- *endp++ = '/';
- ++baselen;
- for (rval = 0; --argc; ++argv) {
- p = *argv + strlen(*argv) - 1;
- while (*p == '/' && p != *argv)
- *p-- = '\0';
- if ((p = strrchr(*argv, '/')) == NULL)
- p = *argv;
- else
- ++p;
-
- if ((baselen + (len = strlen(p))) >= MAXPATHLEN) {
- warnx("%s: destination pathname too long", *argv);
- rval = 1;
- } else {
- memmove(endp, p, len + 1);
- if (do_move(*argv, path))
- rval = 1;
- }
- }
- exit(rval);
- /* NOTREACHED */
-}
-
-int
-do_move(char *from, char *to)
-{
- struct stat sb;
- char modep[15];
-
- /*
- * (1) If the destination path exists, the -f option is not specified
- * and either of the following conditions are true:
- *
- * (a) The permissions of the destination path do not permit
- * writing and the standard input is a terminal.
- * (b) The -i option is specified.
- *
- * the mv utility shall write a prompt to standard error and
- * read a line from standard input. If the response is not
- * affirmative, mv shall do nothing more with the current
- * source file...
- */
- if (!fflg && !access(to, F_OK)) {
- int ask = 1;
- int ch;
-
- if (iflg) {
- if (access(from, F_OK)) {
- warn("rename %s", from);
- return (1);
- }
- (void)fprintf(stderr, "overwrite %s? ", to);
- } else if (stdin_ok && access(to, W_OK) && !stat(to, &sb)) {
- if (access(from, F_OK)) {
- warn("rename %s", from);
- return (1);
- }
- strmode(sb.st_mode, modep);
- (void)fprintf(stderr, "override %s%s%s/%s for %s? ",
- modep + 1, modep[9] == ' ' ? "" : " ",
- user_from_uid(sb.st_uid, 0),
- group_from_gid(sb.st_gid, 0), to);
- } else
- ask = 0;
- if (ask) {
- if ((ch = getchar()) != EOF && ch != '\n')
- while (getchar() != '\n');
- if (ch != 'y' && ch != 'Y')
- return (0);
- }
- }
-
- /*
- * (2) If rename() succeeds, mv shall do nothing more with the
- * current source file. If it fails for any other reason than
- * EXDEV, mv shall write a diagnostic message to the standard
- * error and do nothing more with the current source file.
- *
- * (3) If the destination path exists, and it is a file of type
- * directory and source_file is not a file of type directory,
- * or it is a file not of type directory, and source file is
- * a file of type directory, mv shall write a diagnostic
- * message to standard error, and do nothing more with the
- * current source file...
- */
- if (!rename(from, to)) {
- if (vflg)
- printf("%s -> %s\n", from, to);
- return (0);
- }
-
- if (errno != EXDEV) {
- warn("rename %s to %s", from, to);
- return (1);
- }
-
- /*
- * (4) If the destination path exists, mv shall attempt to remove it.
- * If this fails for any reason, mv shall write a diagnostic
- * message to the standard error and do nothing more with the
- * current source file...
- */
- if (!lstat(to, &sb)) {
- if ((S_ISDIR(sb.st_mode)) ? rmdir(to) : unlink(to)) {
- warn("can't remove %s", to);
- return (1);
- }
- }
-
- /*
- * (5) The file hierarchy rooted in source_file shall be duplicated
- * as a file hierarchy rooted in the destination path...
- */
- if (lstat(from, &sb)) {
- warn("%s", from);
- return (1);
- }
- return (S_ISREG(sb.st_mode) ?
- fastcopy(from, to, &sb) : copy(from, to));
-}
-
-int
-fastcopy(char *from, char *to, struct stat *sbp)
-{
- struct timeval tval[2];
- static u_int blen;
- static char *bp;
- int nread, from_fd, to_fd;
-
- if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
- warn("%s", from);
- return (1);
- }
- if ((to_fd =
- open(to, O_CREAT | O_TRUNC | O_WRONLY, sbp->st_mode)) < 0) {
- warn("%s", to);
- (void)close(from_fd);
- return (1);
- }
- if (!blen && !(bp = malloc(blen = sbp->st_blksize))) {
- warn(NULL);
- return (1);
- }
- while ((nread = read(from_fd, bp, blen)) > 0)
- if (write(to_fd, bp, nread) != nread) {
- warn("%s", to);
- goto err;
- }
- if (nread < 0) {
- warn("%s", from);
-err: if (unlink(to))
- warn("%s: remove", to);
- (void)close(from_fd);
- (void)close(to_fd);
- return (1);
- }
- (void)close(from_fd);
-#ifdef BSD4_4
- TIMESPEC_TO_TIMEVAL(&tval[0], &sbp->st_atimespec);
- TIMESPEC_TO_TIMEVAL(&tval[1], &sbp->st_mtimespec);
-#else
- tval[0].tv_sec = sbp->st_atime;
- tval[1].tv_sec = sbp->st_mtime;
- tval[0].tv_usec = 0;
- tval[1].tv_usec = 0;
-#endif
-#ifdef __SVR4
- if (utimes(to, tval))
-#else
- if (futimes(to_fd, tval))
-#endif
- warn("%s: set times", to);
- if (fchown(to_fd, sbp->st_uid, sbp->st_gid)) {
- if (errno != EPERM)
- warn("%s: set owner/group", to);
- sbp->st_mode &= ~(S_ISUID | S_ISGID);
- }
- if (fchmod(to_fd, sbp->st_mode))
- warn("%s: set mode", to);
- if (fchflags(to_fd, sbp->st_flags) && (errno != EOPNOTSUPP))
- warn("%s: set flags (was: 0%07o)", to, sbp->st_flags);
-
- if (close(to_fd)) {
- warn("%s", to);
- return (1);
- }
-
- if (unlink(from)) {
- warn("%s: remove", from);
- return (1);
- }
-
- if (vflg)
- printf("%s -> %s\n", from, to);
-
- return (0);
-}
-
-int
-copy(char *from, char *to)
-{
- int pid, status;
-
- if ((pid = vfork()) == 0) {
- execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", from, to, NULL);
- warn("%s", _PATH_CP);
- _exit(1);
- }
- if (waitpid(pid, &status, 0) == -1) {
- warn("%s: waitpid", _PATH_CP);
- return (1);
- }
- if (!WIFEXITED(status)) {
- warn("%s: did not terminate normally", _PATH_CP);
- return (1);
- }
- if (WEXITSTATUS(status)) {
- warn("%s: terminated with %d (non-zero) status",
- _PATH_CP, WEXITSTATUS(status));
- return (1);
- }
- if (!(pid = vfork())) {
- execl(_PATH_RM, "mv", "-rf", from, NULL);
- warn("%s", _PATH_RM);
- _exit(1);
- }
- if (waitpid(pid, &status, 0) == -1) {
- warn("%s: waitpid", _PATH_RM);
- return (1);
- }
- if (!WIFEXITED(status)) {
- warn("%s: did not terminate normally", _PATH_RM);
- return (1);
- }
- if (WEXITSTATUS(status)) {
- warn("%s: terminated with %d (non-zero) status",
- _PATH_RM, WEXITSTATUS(status));
- return (1);
- }
- return (0);
-}
-
-void
-usage(void)
-{
- (void)fprintf(stderr, "usage: %s [-fiv] source target\n"
- " %s [-fiv] source ... directory\n", getprogname(),
- getprogname());
- exit(1);
- /* NOTREACHED */
-}
View
39 bin/mv/pathnames.h
@@ -1,39 +0,0 @@
-/* $NetBSD: pathnames.h,v 1.6 1995/03/21 09:06:55 cgd Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_RM "/bin/rm"
-#define _PATH_CP "/bin/cp"
View
68 bin/pax/Makefile
@@ -1,68 +0,0 @@
-# $NetBSD: Makefile,v 1.27 2002/11/30 03:12:55 lukem Exp $
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-# To install on versions prior to BSD 4.4 the following may have to be
-# defined with CPPFLAGS +=
-#
-# -DNET2_STAT Use NET2 or older stat structure. The version of the
-# stat structure is easily determined by looking at the
-# basic type of an off_t (often defined in the file:
-# /usr/include/sys/types.h). If off_t is a long (and is
-# NOT A long long) then you must define NET2_STAT.
-# This define is important, as if you do have a long long
-# off_t and define NET2_STAT, pax will compile but will
-# NOT RUN PROPERLY.
-#
-# -DNET2_FTS Use the older NET2 fts. To identify the version,
-# examine the file: /usr/include/fts.h. If FTS_COMFOLLOW
-# is not defined then you must define NET2_FTS.
-# Pax may not compile if this not (un)defined properly.
-#
-# -DNET2_REGEX Use the older regexp.h not regex.h. The regex version
-# is determined by looking at the value returned by
-# regexec() (man 3 regexec). If regexec return a 1 for
-# success (and NOT a 0 for success) you have the older
-# regex routines and must define NET2_REGEX.
-# Pax may not compile if this not (un)defined properly.
-
-.include <bsd.own.mk>
-
-PROG= pax
-SRCS= ar_io.c ar_subs.c buf_subs.c cpio.c file_subs.c ftree.c\
- gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\
- tar.c tty_subs.c
-
-.ifdef SMALLPROG
-CPPFLAGS+= -DSMALL
-.else
-SRCS+= getid.c spec.c misc.c stat_flags.c pack_dev.c
-CPPFLAGS+= -I${NETBSDSRCDIR}/usr.sbin/mtree \
- -I${NETBSDSRCDIR}/sbin/mknod \
- -I${NETBSDSRCDIR}/bin/ls
-.PATH: ${NETBSDSRCDIR}/usr.sbin/mtree \
- ${NETBSDSRCDIR}/sbin/mknod \
- ${NETBSDSRCDIR}/bin/ls
-.endif
-
-MAN= pax.1 tar.1 cpio.1
-
-.if !defined(HOSTPROG)
-LINKS+= ${BINDIR}/pax ${BINDIR}/tar
-SYMLINKS+=${BINDIR}/tar /usr/bin/tar
-
-LINKS+= ${BINDIR}/pax ${BINDIR}/cpio
-SYMLINKS+=${BINDIR}/cpio /usr/bin/cpio
-.endif
-
-NOHTML=doc2html-error
-
-.if !defined(HOSTPROG) && !defined(SMALLPROG)
-CPPFLAGS+= -DSUPPORT_RMT
-
-LDADD+= -lrmt
-DPADD+= ${LIBRMT}
-.endif
-
-.if !defined(HOSTPROG)
-.include <bsd.prog.mk>
-.endif
View
1,694 bin/pax/ar_io.c
@@ -1,1694 +0,0 @@
-/* $NetBSD: ar_io.c,v 1.30 2002/12/12 05:00:42 christos Exp $ */
-
-/*-
- * Copyright (c) 1992 Keith Muller.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Keith Muller of the University of California, San Diego.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if defined(__RCSID) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
-#else
-__RCSID("$NetBSD: ar_io.c,v 1.30 2002/12/12 05:00:42 christos Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#include <sys/param.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#ifdef SUPPORT_RMT
-#define __RMTLIB_PRIVATE
-#include <rmt.h>
-#endif /* SUPPORT_RMT */
-#include "pax.h"
-#include "options.h"
-#include "extern.h"
-
-/*
- * Routines which deal directly with the archive I/O device/file.
- */
-
-#define DMOD 0666 /* default mode of created archives */
-#define EXT_MODE O_RDONLY /* open mode for list/extract */
-#define AR_MODE (O_WRONLY | O_CREAT | O_TRUNC) /* mode for archive */
-#define APP_MODE O_RDWR /* mode for append */
-#define STDO "<STDOUT>" /* pseudo name for stdout */
-#define STDN "<STDIN>" /* pseudo name for stdin */
-static int arfd = -1; /* archive file descriptor */
-static int artyp = ISREG; /* archive type: file/FIFO/tape */
-static int arvol = 1; /* archive volume number */
-static int lstrval = -1; /* return value from last i/o */
-static int io_ok; /* i/o worked on volume after resync */
-static int did_io; /* did i/o ever occur on volume? */
-static int done; /* set via tty termination */
-static struct stat arsb; /* stat of archive device at open */
-static int invld_rec; /* tape has out of spec record size */
-static int wr_trail = 1; /* trailer was rewritten in append */
-static int can_unlnk = 0; /* do we unlink null archives? */
-const char *arcname; /* printable name of archive */
-const char *gzip_program; /* name of gzip program */
-static pid_t zpid = -1; /* pid of child process */
-time_t starttime; /* time the run started */
-int force_one_volume; /* 1 if we ignore volume changes */
-
-static int get_phys(void);
-extern sigset_t s_mask;
-static void ar_start_gzip(int, const char *, int);
-static const char *timefmt(char *, size_t, off_t, time_t);
-static const char *sizefmt(char *, size_t, off_t);
-
-#ifdef SUPPORT_RMT
-#ifdef SYS_NO_RESTART
-static int rmtread_with_restart(int, void *, int);
-static int rmtwrite_with_restart(int, void *, int);
-#else
-#define rmtread_with_restart(a, b, c) rmtread((a), (b), (c))
-#define rmtwrite_with_restart(a, b, c) rmtwrite((a), (b), (c))
-#endif
-#endif /* SUPPORT_RMT */
-
-/*
-