Clean up deleted files.
This commit is contained in:
parent
02ecc2e160
commit
8854a8d447
@ -1,57 +0,0 @@
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* $Id $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*From: */
|
||||
/* static char sccsid[] = "@(#)cat.c 8.1 (Berkeley) 6/11/93";*/
|
||||
static char rcsid[] = "$Id: cat.c,v 1.1 1994/01/26 02:03:37 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
main()
|
||||
{
|
||||
register int fd;
|
||||
char c;
|
||||
|
||||
fd = getfile("File", 0);
|
||||
while (read(fd, &c, 1) == 1)
|
||||
putchar(c);
|
||||
exit(0);
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/* From:
|
||||
static char sccsid[] = "@(#)copy.c 8.1 (Berkeley) 6/11/93"; */
|
||||
static char rcsid[] = "$Id: copy.c,v 1.1 1994/01/26 02:03:40 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#define BSIZE 10240
|
||||
|
||||
/*
|
||||
* Copy from from to to. Intended for use in system installation.
|
||||
*/
|
||||
main()
|
||||
{
|
||||
extern int errno;
|
||||
register int from, to, record, rcc, wcc, bsize = BSIZE;
|
||||
char buf[BSIZE];
|
||||
|
||||
from = getfile("From", 0);
|
||||
to = getfile("To", 1);
|
||||
for (record = 0;; ++record) {
|
||||
if (!(rcc = read(from, buf, bsize)))
|
||||
break;
|
||||
if (rcc < 0) {
|
||||
printf("Record %d: read error, errno=%d\n",
|
||||
record, errno);
|
||||
break;
|
||||
}
|
||||
if (rcc != bsize) {
|
||||
if (record == 0) {
|
||||
bsize = rcc;
|
||||
printf("Block size set from input; %d bytes\n",
|
||||
bsize);
|
||||
} else
|
||||
printf("Record %d: read short; expected %d, got %d\n",
|
||||
record, bsize, rcc);
|
||||
}
|
||||
#ifdef vax
|
||||
/* For bug in ht driver. */
|
||||
if (rcc > bsize)
|
||||
rcc = bsize;
|
||||
#endif
|
||||
if ((wcc = write(to, buf, rcc)) < 0) {
|
||||
printf("Record %d: write error: errno=%d\n",
|
||||
record, errno);
|
||||
break;
|
||||
}
|
||||
if (wcc < rcc) {
|
||||
printf("Record %d: write short; expected %d, got %d\n",
|
||||
record, rcc, wcc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("copy completed: %d records copied\n", record);
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/* From:
|
||||
static char sccsid[] = "@(#)ls.c 8.1 (Berkeley) 6/11/93"; */
|
||||
static char rcsid[] = "$Id: ls.c,v 1.1 1994/01/26 02:03:50 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <ufs/dir.h>
|
||||
#include <sys/ttychars.h>
|
||||
#include "stand.h"
|
||||
|
||||
main()
|
||||
{
|
||||
struct dinode *ip;
|
||||
int fd;
|
||||
|
||||
for (;;) {
|
||||
if ((fd = getfile("ls", 0)) == -1)
|
||||
exit();
|
||||
ip = &iob[fd - 3].i_ino;
|
||||
if ((ip->di_mode & IFMT) != IFDIR) {
|
||||
printf("ls: not a directory\n");
|
||||
continue;
|
||||
}
|
||||
if (ip->di_size == 0) {
|
||||
printf("ls: zero length directory\n");
|
||||
continue;
|
||||
}
|
||||
ls(fd);
|
||||
}
|
||||
}
|
||||
|
||||
#define CTRL(x) (x&037)
|
||||
|
||||
getfile(prompt, mode)
|
||||
char *prompt;
|
||||
int mode;
|
||||
{
|
||||
int fd;
|
||||
char buf[100];
|
||||
|
||||
do {
|
||||
printf("%s: ", prompt);
|
||||
gets(buf);
|
||||
if (buf[0] == CTRL('d') && buf[1] == 0)
|
||||
return (-1);
|
||||
} while ((fd = open(buf, mode)) < 0);
|
||||
return(fd);
|
||||
}
|
||||
|
||||
typedef struct direct DP;
|
||||
static
|
||||
ls(fd)
|
||||
register int fd;
|
||||
{
|
||||
register int size;
|
||||
register char *dp;
|
||||
char dirbuf[DIRBLKSIZ];
|
||||
|
||||
printf("\ninode\tname\n");
|
||||
while ((size = read(fd, dirbuf, DIRBLKSIZ)) == DIRBLKSIZ)
|
||||
for (dp = dirbuf; (dp < (dirbuf + size)) &&
|
||||
(dp + ((DP *)dp)->d_reclen) < (dirbuf + size);
|
||||
dp += ((DP *)dp)->d_reclen) {
|
||||
if (((DP *)dp)->d_ino == 0)
|
||||
continue;
|
||||
if (((DP *)dp)->d_namlen > MAXNAMLEN+1) {
|
||||
printf("Corrupt file name length! Run fsck soon!\n");
|
||||
return;
|
||||
}
|
||||
printf("%d\t%s\n", ((DP *)dp)->d_ino,
|
||||
((DP *)dp)->d_name);
|
||||
}
|
||||
}
|
159
sys/stand/dev.c
159
sys/stand/dev.c
@ -1,159 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988 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.
|
||||
*
|
||||
* from: @(#)dev.c 7.14 (Berkeley) 5/5/91
|
||||
* $Id: dev.c,v 1.2 1993/05/20 03:53:59 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <setjmp.h>
|
||||
#include "saio.h"
|
||||
|
||||
/*
|
||||
* NB: the value "io->i_dev", used to offset the devsw[] array in the
|
||||
* routines below, is munged by the machine specific stand Makefiles
|
||||
* to work for certain boots.
|
||||
*/
|
||||
|
||||
jmp_buf exception;
|
||||
|
||||
devread(io)
|
||||
register struct iob *io;
|
||||
{
|
||||
int cc;
|
||||
|
||||
io->i_flgs |= F_RDDATA;
|
||||
io->i_error = 0;
|
||||
cc = (*devsw[io->i_dev].dv_strategy)(io, F_READ);
|
||||
io->i_flgs &= ~F_TYPEMASK;
|
||||
#ifndef SMALL
|
||||
if (scankbd())
|
||||
_longjmp(exception, 1);
|
||||
#endif
|
||||
return (cc);
|
||||
}
|
||||
|
||||
devwrite(io)
|
||||
register struct iob *io;
|
||||
{
|
||||
int cc;
|
||||
|
||||
io->i_flgs |= F_WRDATA;
|
||||
io->i_error = 0;
|
||||
cc = (*devsw[io->i_dev].dv_strategy)(io, F_WRITE);
|
||||
io->i_flgs &= ~F_TYPEMASK;
|
||||
#ifndef SMALL
|
||||
if (scankbd())
|
||||
_longjmp(exception, 1);
|
||||
#endif
|
||||
return (cc);
|
||||
}
|
||||
|
||||
devopen(io)
|
||||
register struct iob *io;
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!(ret = (*devsw[io->i_dev].dv_open)(io)))
|
||||
return (0);
|
||||
#ifdef SMALL
|
||||
printf("open error\n");
|
||||
#else
|
||||
printf("%s(%d,%d,%d,%d): ", devsw[io->i_dev].dv_name,
|
||||
io->i_adapt, io->i_ctlr, io->i_unit, io->i_part);
|
||||
switch(ret) {
|
||||
case EIO:
|
||||
break; /* already reported */
|
||||
case EADAPT:
|
||||
printf("bad adaptor number\n");
|
||||
break;
|
||||
case ECTLR:
|
||||
printf("bad controller number\n");
|
||||
break;
|
||||
case EUNIT:
|
||||
printf("bad drive number\n");
|
||||
break;
|
||||
case EPART:
|
||||
printf("bad partition\n");
|
||||
break;
|
||||
case ERDLAB:
|
||||
printf("can't read disk label\n");
|
||||
break;
|
||||
case EUNLAB:
|
||||
printf("unlabeled\n");
|
||||
break;
|
||||
case ENXIO:
|
||||
printf("bad device specification\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknown open error\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return (ret);
|
||||
}
|
||||
|
||||
devclose(io)
|
||||
register struct iob *io;
|
||||
{
|
||||
(*devsw[io->i_dev].dv_close)(io);
|
||||
}
|
||||
|
||||
devioctl(io, cmd, arg)
|
||||
register struct iob *io;
|
||||
int cmd;
|
||||
caddr_t arg;
|
||||
{
|
||||
return ((*devsw[io->i_dev].dv_ioctl)(io, cmd, arg));
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
nullsys(io)
|
||||
struct iob *io;
|
||||
{}
|
||||
|
||||
/* ARGSUSED */
|
||||
nodev(io)
|
||||
struct iob *io;
|
||||
{
|
||||
errno = EBADF;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
noioctl(io, cmd, arg)
|
||||
struct iob *io;
|
||||
int cmd;
|
||||
caddr_t arg;
|
||||
{
|
||||
return (ECMD);
|
||||
}
|
@ -1,177 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991 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.
|
||||
*
|
||||
* from: @(#)printf.c 5.6 (Berkeley) 5/25/91
|
||||
* $Id: printf.c,v 1.2 1993/05/20 03:54:01 cgd Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Scaled down version of printf(3).
|
||||
*
|
||||
* One additional format:
|
||||
*
|
||||
* The format %b is supported to decode error registers.
|
||||
* Its usage is:
|
||||
*
|
||||
* printf("reg=%b\n", regval, "<base><arg>*");
|
||||
*
|
||||
* where <base> is the output base expressed as a control character, e.g.
|
||||
* \10 gives octal; \20 gives hex. Each arg is a sequence of characters,
|
||||
* the first of which gives the bit number to be inspected (origin 1), and
|
||||
* the next characters (up to a control character, i.e. a character <= 32),
|
||||
* give the name of the register. Thus:
|
||||
*
|
||||
* printf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n");
|
||||
*
|
||||
* would produce output:
|
||||
*
|
||||
* reg=3<BITTWO,BITONE>
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Note that stdarg.h and the ANSI style va_start macro is used for both
|
||||
* ANSI and traditional C compilers.
|
||||
*/
|
||||
#define KERNEL
|
||||
#include <machine/stdarg.h>
|
||||
#undef KERNEL
|
||||
|
||||
static void kprintn __P((u_long, int));
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
printf(const char *fmt, ...)
|
||||
#else
|
||||
printf(fmt /* , va_alist */)
|
||||
char *fmt;
|
||||
#endif
|
||||
{
|
||||
register char *p;
|
||||
register int ch, n;
|
||||
unsigned long ul;
|
||||
int lflag, set;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
for (;;) {
|
||||
while ((ch = *fmt++) != '%') {
|
||||
if (ch == '\0')
|
||||
return;
|
||||
putchar(ch);
|
||||
}
|
||||
lflag = 0;
|
||||
reswitch: switch (ch = *fmt++) {
|
||||
case 'l':
|
||||
lflag = 1;
|
||||
goto reswitch;
|
||||
case 'b':
|
||||
ul = va_arg(ap, int);
|
||||
p = va_arg(ap, char *);
|
||||
kprintn(ul, *p++);
|
||||
|
||||
if (!ul)
|
||||
break;
|
||||
|
||||
for (set = 0; n = *p++;) {
|
||||
if (ul & (1 << (n - 1))) {
|
||||
putchar(set ? ',' : '<');
|
||||
for (; (n = *p) > ' '; ++p)
|
||||
putchar(n);
|
||||
set = 1;
|
||||
} else
|
||||
for (; *p > ' '; ++p);
|
||||
}
|
||||
if (set)
|
||||
putchar('>');
|
||||
break;
|
||||
case 'c':
|
||||
ch = va_arg(ap, int);
|
||||
putchar(ch & 0x7f);
|
||||
break;
|
||||
case 's':
|
||||
p = va_arg(ap, char *);
|
||||
while (ch = *p++)
|
||||
putchar(ch);
|
||||
break;
|
||||
case 'd':
|
||||
ul = lflag ?
|
||||
va_arg(ap, long) : va_arg(ap, int);
|
||||
if ((long)ul < 0) {
|
||||
putchar('-');
|
||||
ul = -(long)ul;
|
||||
}
|
||||
kprintn(ul, 10);
|
||||
break;
|
||||
case 'o':
|
||||
ul = lflag ?
|
||||
va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
kprintn(ul, 8);
|
||||
break;
|
||||
case 'u':
|
||||
ul = lflag ?
|
||||
va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
kprintn(ul, 10);
|
||||
break;
|
||||
case 'x':
|
||||
ul = lflag ?
|
||||
va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
kprintn(ul, 16);
|
||||
break;
|
||||
default:
|
||||
putchar('%');
|
||||
if (lflag)
|
||||
putchar('l');
|
||||
putchar(ch);
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
kprintn(ul, base)
|
||||
unsigned long ul;
|
||||
int base;
|
||||
{
|
||||
/* hold a long in base 8 */
|
||||
char *p, buf[(sizeof(long) * NBBY / 3) + 1];
|
||||
|
||||
p = buf;
|
||||
do {
|
||||
*p++ = "0123456789abcdef"[ul % base];
|
||||
} while (ul /= base);
|
||||
do {
|
||||
putchar(*--p);
|
||||
} while (p > buf);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1988 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.
|
||||
*
|
||||
* from: @(#)saerrno.h 7.3 (Berkeley) 6/28/90
|
||||
* $Id: saerrno.h,v 1.2 1993/05/20 03:54:02 cgd Exp $
|
||||
*/
|
||||
|
||||
extern int errno; /* just like unix */
|
||||
|
||||
/* error codes */
|
||||
#define EADAPT 1 /* bad adaptor */
|
||||
#define ECTLR 2 /* bad controller */
|
||||
#define EUNIT 3 /* bad drive */
|
||||
#define EPART 4 /* bad partition */
|
||||
#define ERDLAB 5 /* can't read disk label */
|
||||
#define EUNLAB 6 /* unlabeled disk */
|
||||
#define ENXIO 7 /* bad device specification */
|
||||
#define EBADF 8 /* bad file descriptor */
|
||||
#define EOFFSET 9 /* relative seek not supported */
|
||||
#define ESRCH 10 /* directory search for file failed */
|
||||
#define EIO 11 /* generic error */
|
||||
#define ECMD 12 /* undefined driver command */
|
||||
#define EBSE 13 /* bad sector error */
|
||||
#define EWCK 14 /* write check error */
|
||||
#define EECC 15 /* uncorrectable ecc error */
|
||||
#define EHER 16 /* hard error */
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1988 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.
|
||||
*
|
||||
* from: @(#)saioctl.h 7.4 (Berkeley) 6/28/90
|
||||
* $Id: saioctl.h,v 1.2 1993/05/20 03:54:03 cgd Exp $
|
||||
*/
|
||||
|
||||
/* ioctl's -- for disks just now */
|
||||
#define SAIOHDR (('d'<<8)|1) /* next i/o includes header */
|
||||
#define SAIOCHECK (('d'<<8)|2) /* next i/o checks data */
|
||||
#define SAIOHCHECK (('d'<<8)|3) /* next i/o checks header & data */
|
||||
#define SAIONOBAD (('d'<<8)|4) /* inhibit bad sector forwarding */
|
||||
#define SAIODOBAD (('d'<<8)|5) /* enable bad sector forwarding */
|
||||
#define SAIOECCLIM (('d'<<8)|6) /* set limit to ecc correction, bits */
|
||||
#define SAIOECCUNL (('d'<<8)|7) /* use standard ecc procedures */
|
||||
#define SAIORETRIES (('d'<<8)|8) /* set retry count for unit */
|
||||
#define SAIODEVDATA (('d'<<8)|9) /* get pointer to pack label */
|
||||
#define SAIOSSI (('d'<<8)|10) /* set skip sector inhibit */
|
||||
#define SAIONOSSI (('d'<<8)|11) /* inhibit skip sector handling */
|
||||
#define SAIOSSDEV (('d'<<8)|12) /* is device skip sector type? */
|
||||
#define SAIODEBUG (('d'<<8)|13) /* enable/disable debugging */
|
||||
#define SAIOGBADINFO (('d'<<8)|14) /* get bad-sector table */
|
@ -1,75 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991 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.
|
||||
*
|
||||
* from: @(#)stat.c 7.1 (Berkeley) 5/5/91
|
||||
* $Id: stat.c,v 1.2 1993/05/20 03:54:05 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include "saio.h"
|
||||
|
||||
#ifndef SMALL
|
||||
fstat(fd, sb)
|
||||
int fd;
|
||||
struct stat *sb;
|
||||
{
|
||||
register struct iob *io;
|
||||
|
||||
fd -= 3;
|
||||
if (fd < 0 || fd >= SOPEN_MAX ||
|
||||
((io = &iob[fd])->i_flgs & F_ALLOC) == 0) {
|
||||
errno = EBADF;
|
||||
return (-1);
|
||||
}
|
||||
/* only important stuff */
|
||||
sb->st_mode = io->i_ino.di_mode;
|
||||
sb->st_uid = io->i_ino.di_uid;
|
||||
sb->st_gid = io->i_ino.di_gid;
|
||||
sb->st_size = io->i_ino.di_size;
|
||||
return (0);
|
||||
}
|
||||
|
||||
stat(str, sb)
|
||||
const char *str;
|
||||
struct stat *sb;
|
||||
{
|
||||
int fd, rv;
|
||||
|
||||
fd = open(str, 0);
|
||||
if (fd < 0)
|
||||
return(-1);
|
||||
rv = fstat(fd, sb);
|
||||
close(fd);
|
||||
return(rv);
|
||||
}
|
||||
#endif SMALL
|
Loading…
Reference in New Issue
Block a user