Cleanup to make more ANSI compliant; checkpoint
This commit is contained in:
parent
996b2b5c54
commit
6f0b0cdc86
@ -1,10 +1,10 @@
|
||||
# $Id: Makefile,v 1.4 1994/08/04 19:39:32 brezak Exp $
|
||||
# $Id: Makefile,v 1.5 1994/08/22 21:55:58 brezak Exp $
|
||||
|
||||
LIB= sa
|
||||
|
||||
#DEBUGFLAGS= -DNFS_DEBUG -DRPC_DEBUG -DRARP_DEBUG -DDEBUG -DPARANOID -Wall
|
||||
#DEBUGFLAGS= -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG -DRPC_DEBUG -DRARP_DEBUG -DDEBUG -DPARANOID -Wall
|
||||
#DEBUGFLAGS= -ansi -pedantic -Wall
|
||||
CFLAGS+=-DSTANDALONE $(DEBUGFLAGS) -I${.CURDIR} -I${.CURDIR}/../..
|
||||
CFLAGS+=-DSTANDALONE -DCOMPAT_UFS $(DEBUGFLAGS) -I${.CURDIR} -I${.CURDIR}/../..
|
||||
|
||||
# stand routines
|
||||
SRCS+= alloc.c bcopy.c exit.c exec.c getfile.c gets.c globals.c \
|
||||
|
@ -61,11 +61,12 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: close.c,v 1.2 1994/05/08 16:11:19 brezak Exp $
|
||||
* $Id: close.c,v 1.3 1994/08/22 21:55:59 brezak Exp $
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
int
|
||||
close(fd)
|
||||
int fd;
|
||||
{
|
||||
@ -93,6 +94,7 @@ close(fd)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
closeall()
|
||||
{
|
||||
int i;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)dev.c 8.1 (Berkeley) 6/11/93
|
||||
* $Id: dev.c,v 1.1 1994/01/26 02:03:41 brezak Exp $
|
||||
* $Id: dev.c,v 1.2 1994/08/22 21:56:01 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,6 +41,7 @@
|
||||
|
||||
int errno;
|
||||
|
||||
int
|
||||
nodev()
|
||||
{
|
||||
return (ENXIO);
|
||||
@ -52,6 +53,7 @@ nullsys()
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
noioctl(f, cmd, data)
|
||||
struct open_file *f;
|
||||
int cmd;
|
||||
|
@ -31,18 +31,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)disklabel.c 8.1 (Berkeley) 6/11/93
|
||||
* $Id: disklabel.c,v 1.1 1994/01/26 02:03:42 brezak Exp $
|
||||
* $Id: disklabel.c,v 1.2 1994/08/22 21:56:02 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
int dkcksum __P((struct disklabel *));
|
||||
|
||||
char *
|
||||
getdisklabel(buf, lp)
|
||||
const char *buf;
|
||||
struct disklabel *lp;
|
||||
{
|
||||
register struct buf *bp;
|
||||
struct disklabel *dlp, *elp;
|
||||
char *msg = (char *)0;
|
||||
|
||||
@ -67,6 +68,7 @@ getdisklabel(buf, lp)
|
||||
/*
|
||||
* Compute checksum for disk label.
|
||||
*/
|
||||
int
|
||||
dkcksum(lp)
|
||||
register struct disklabel *lp;
|
||||
{
|
||||
|
@ -30,11 +30,9 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exec.c,v 1.1 1994/05/08 16:11:21 brezak Exp $
|
||||
* $Id: exec.c,v 1.2 1994/08/22 21:56:03 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
|
@ -24,12 +24,16 @@
|
||||
* 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 $
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: exit.c,v 1.2 1994/05/08 16:11:22 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
#include "stand.h"
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
@ -39,8 +43,9 @@ panic(fmt /*, va_alist */)
|
||||
char *fmt;
|
||||
#endif
|
||||
{
|
||||
extern void closeall __P((void));
|
||||
extern void _rtt __P((void));
|
||||
va_list ap;
|
||||
|
||||
static int paniced;
|
||||
|
||||
if (!paniced) {
|
||||
@ -48,14 +53,20 @@ panic(fmt /*, va_alist */)
|
||||
closeall();
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
printf(fmt, ap);
|
||||
printf("\n");
|
||||
va_end(ap);
|
||||
_rtt();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
exit()
|
||||
void volatile exit()
|
||||
{
|
||||
panic("exit");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
@ -31,9 +31,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)getfile.c 8.1 (Berkeley) 6/11/93
|
||||
* $Id: getfile.c,v 1.1 1994/01/26 02:03:45 brezak Exp $
|
||||
* $Id: getfile.c,v 1.2 1994/08/22 21:56:06 brezak Exp $
|
||||
*/
|
||||
#include "stand.h"
|
||||
|
||||
int
|
||||
getfile(prompt, mode)
|
||||
char *prompt;
|
||||
int mode;
|
||||
|
@ -31,9 +31,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)gets.c 8.1 (Berkeley) 6/11/93
|
||||
* $Id: gets.c,v 1.3 1994/08/09 14:00:06 pk Exp $
|
||||
* $Id: gets.c,v 1.4 1994/08/22 21:56:07 brezak Exp $
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
void
|
||||
gets(buf)
|
||||
char *buf;
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: nfs.c,v 1.2 1994/06/20 07:50:17 glass Exp $
|
||||
* $Id: nfs.c,v 1.3 1994/08/22 21:56:08 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -394,7 +394,7 @@ recvreaddata(d, pkt, len)
|
||||
static int
|
||||
readdata(d, off, addr, len)
|
||||
register struct nfs_iodesc *d;
|
||||
register u_long off;
|
||||
register off_t off;
|
||||
register void *addr;
|
||||
register u_long len;
|
||||
{
|
||||
@ -414,7 +414,7 @@ readdata(d, off, addr, len)
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("readdata: addr=%x, off=%d len=%d\n", (u_int)addr, off, len);
|
||||
printf("readdata: addr=%x, off=%d len=%d\n", (u_int)addr, (u_int)off, len);
|
||||
#endif
|
||||
if (len == 0)
|
||||
return (0);
|
||||
@ -432,7 +432,7 @@ readdata(d, off, addr, len)
|
||||
ns->xid = d->iodesc->xid;
|
||||
++d->iodesc->xid;
|
||||
|
||||
ns->off = off;
|
||||
ns->off = (u_int)off;
|
||||
ns->len = len;
|
||||
if (ns->len > NFSREAD_SIZE)
|
||||
ns->len = NFSREAD_SIZE;
|
||||
@ -609,7 +609,7 @@ nfs_read(f, addr, size, resid)
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_read: size=%d off=%d\n", size, fp->off);
|
||||
printf("nfs_read: size=%d off=%d\n", size, (int)fp->off);
|
||||
#endif
|
||||
while (size > 0) {
|
||||
cc = readdata(fp->iodesc, fp->off, (void *)addr, size);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)printf.c 8.1 (Berkeley) 6/11/93
|
||||
* $Id: printf.c,v 1.2 1994/07/27 07:37:25 cgd Exp $
|
||||
* $Id: printf.c,v 1.3 1994/08/22 21:56:10 brezak Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -59,19 +59,18 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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
|
||||
#include "stand.h"
|
||||
|
||||
static void kprintn __P((u_long, int));
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
#ifdef __STDC__
|
||||
printf(const char *fmt, ...)
|
||||
#else
|
||||
printf(fmt, va_alist)
|
||||
@ -84,7 +83,11 @@ printf(fmt, va_alist)
|
||||
int lflag, set;
|
||||
va_list ap;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
for (;;) {
|
||||
while ((ch = *fmt++) != '%') {
|
||||
if (ch == '\0')
|
||||
@ -104,7 +107,7 @@ reswitch: switch (ch = *fmt++) {
|
||||
if (!ul)
|
||||
break;
|
||||
|
||||
for (set = 0; n = *p++;) {
|
||||
for (set = 0; (n = *p++);) {
|
||||
if (ul & (1 << (n - 1))) {
|
||||
putchar(set ? ',' : '<');
|
||||
for (; (n = *p) > ' '; ++p)
|
||||
@ -122,7 +125,7 @@ reswitch: switch (ch = *fmt++) {
|
||||
break;
|
||||
case 's':
|
||||
p = va_arg(ap, char *);
|
||||
while (ch = *p++)
|
||||
while ((ch = *p++))
|
||||
putchar(ch);
|
||||
break;
|
||||
case 'd':
|
||||
|
@ -61,14 +61,15 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: read.c,v 1.1 1994/01/26 02:03:54 brezak Exp $
|
||||
* $Id: read.c,v 1.2 1994/08/22 21:56:11 brezak Exp $
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
int
|
||||
read(fd, dest, bcount)
|
||||
int fd;
|
||||
char *dest;
|
||||
void *dest;
|
||||
u_int bcount;
|
||||
{
|
||||
register struct open_file *f = &files[fd];
|
||||
@ -86,7 +87,7 @@ read(fd, dest, bcount)
|
||||
return (resid);
|
||||
}
|
||||
resid = bcount;
|
||||
if (errno = (f->f_ops->read)(f, dest, bcount, &resid))
|
||||
if ((errno = (f->f_ops->read)(f, dest, bcount, &resid)))
|
||||
return (-1);
|
||||
return (bcount - resid);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)stand.h 8.1 (Berkeley) 6/11/93
|
||||
* $Id: stand.h,v 1.3 1994/08/04 19:39:40 brezak Exp $
|
||||
* $Id: stand.h,v 1.4 1994/08/22 21:56:13 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -110,11 +110,16 @@ void free __P((void *ptr, unsigned size));
|
||||
struct disklabel;
|
||||
char *getdisklabel __P((const char *buf, struct disklabel *lp));
|
||||
|
||||
int printf __P((char *, ...));
|
||||
void panic __P((char *, ...));
|
||||
void printf __P((const char *, ...));
|
||||
void gets __P((char *));
|
||||
void panic __P((const char *, ...));
|
||||
int getchar __P((void));
|
||||
int exec __P((char *, char *, int));
|
||||
|
||||
int open __P((char *,int));
|
||||
int close __P((int));
|
||||
int read __P((int, void *, u_int));
|
||||
int write __P((int, void *, u_int));
|
||||
|
||||
int nodev(), noioctl();
|
||||
void nullsys();
|
||||
|
||||
@ -127,6 +132,8 @@ int null_write __P((struct open_file *f, char *buf,
|
||||
off_t null_seek __P((struct open_file *f, off_t offset, int where));
|
||||
int null_stat __P((struct open_file *f, struct stat *sb));
|
||||
|
||||
/* Machine dependant functions */
|
||||
/* Machine dependent functions */
|
||||
void machdep_start __P((char *, int, char *, char *, char *));
|
||||
int machdep_exec __P((char *, char *, int));
|
||||
int getchar __P((void));
|
||||
void putchar __P((int));
|
||||
|
@ -31,11 +31,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)stat.c 8.1 (Berkeley) 6/11/93
|
||||
* $Id: stat.c,v 1.1 1994/01/26 02:03:59 brezak Exp $
|
||||
* $Id: stat.c,v 1.2 1994/08/22 21:56:14 brezak Exp $
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
int
|
||||
fstat(fd, sb)
|
||||
int fd;
|
||||
struct stat *sb;
|
||||
@ -57,6 +58,7 @@ fstat(fd, sb)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
stat(str, sb)
|
||||
const char *str;
|
||||
struct stat *sb;
|
||||
|
@ -61,13 +61,14 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: ufs.c,v 1.6 1994/07/27 07:58:45 cgd Exp $
|
||||
* $Id: ufs.c,v 1.7 1994/08/22 21:56:15 brezak Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Stand-alone file reading package.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
@ -97,6 +98,10 @@ struct file {
|
||||
daddr_t f_buf_blkno; /* block number of data block */
|
||||
};
|
||||
|
||||
#ifdef COMPAT_UFS
|
||||
void ffs_oldfscompat __P((struct fs *));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read a new inode into a file structure.
|
||||
*/
|
||||
@ -374,12 +379,12 @@ ufs_open(path, f)
|
||||
register char *cp, *ncp;
|
||||
register int c;
|
||||
ino_t inumber, parent_inumber;
|
||||
int nlinks = 0;
|
||||
struct file *fp;
|
||||
struct fs *fs;
|
||||
int rc;
|
||||
u_int buf_size;
|
||||
#if 0
|
||||
int nlinks = 0;
|
||||
char namebuf[MAXPATHLEN+1];
|
||||
#endif
|
||||
|
||||
@ -401,7 +406,9 @@ ufs_open(path, f)
|
||||
rc = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
#ifdef COMPAT_UFS
|
||||
ffs_oldfscompat(fs);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Calculate indirect block levels.
|
||||
@ -656,11 +663,13 @@ ufs_stat(f, sb)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_UFS
|
||||
/*
|
||||
* Sanity checks for old file systems.
|
||||
*
|
||||
* XXX - goes away some day.
|
||||
*/
|
||||
void
|
||||
ffs_oldfscompat(fs)
|
||||
struct fs *fs;
|
||||
{
|
||||
@ -681,5 +690,5 @@ ffs_oldfscompat(fs)
|
||||
fs->fs_qbmask = ~fs->fs_bmask; /* XXX */
|
||||
fs->fs_qfmask = ~fs->fs_fmask; /* XXX */
|
||||
} /* XXX */
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
@ -61,14 +61,15 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: write.c,v 1.1 1994/01/26 02:04:03 brezak Exp $
|
||||
* $Id: write.c,v 1.2 1994/08/22 21:56:17 brezak Exp $
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
int
|
||||
write(fd, dest, bcount)
|
||||
int fd;
|
||||
char *dest;
|
||||
void *dest;
|
||||
u_int bcount;
|
||||
{
|
||||
register struct open_file *f = &files[fd];
|
||||
@ -86,7 +87,7 @@ write(fd, dest, bcount)
|
||||
return (resid);
|
||||
}
|
||||
resid = bcount;
|
||||
if (errno = (f->f_ops->write)(f, dest, bcount, &resid))
|
||||
if ((errno = (f->f_ops->write)(f, dest, bcount, &resid)))
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user