summaryrefslogtreecommitdiff
path: root/libc/inet/rpc/xdr_stdio.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-09 20:06:30 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-09 20:06:30 +0000
commitc1fe19d4c1db610692365472a90f4661e48449c1 (patch)
treed0b0219ffca3c4c4256f55c4aea4513e43d6aecd /libc/inet/rpc/xdr_stdio.c
parent9efafb8bbc7408b04643dcd53825d971577b4d9d (diff)
Bug ugly formatting update
Diffstat (limited to 'libc/inet/rpc/xdr_stdio.c')
-rw-r--r--libc/inet/rpc/xdr_stdio.c132
1 files changed, 65 insertions, 67 deletions
diff --git a/libc/inet/rpc/xdr_stdio.c b/libc/inet/rpc/xdr_stdio.c
index 694774f6f..7ae5fbdab 100644
--- a/libc/inet/rpc/xdr_stdio.c
+++ b/libc/inet/rpc/xdr_stdio.c
@@ -28,7 +28,9 @@
* Mountain View, California 94043
*/
#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
+static char sccsid[] =
+
+ "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
#endif
/*
@@ -45,27 +47,27 @@ static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
#include <stdio.h>
#include <rpc/xdr.h>
-static bool_t xdrstdio_getlong();
-static bool_t xdrstdio_putlong();
-static bool_t xdrstdio_getbytes();
-static bool_t xdrstdio_putbytes();
-static u_int xdrstdio_getpos();
-static bool_t xdrstdio_setpos();
-static long * xdrstdio_inline();
-static void xdrstdio_destroy();
+static bool_t xdrstdio_getlong();
+static bool_t xdrstdio_putlong();
+static bool_t xdrstdio_getbytes();
+static bool_t xdrstdio_putbytes();
+static u_int xdrstdio_getpos();
+static bool_t xdrstdio_setpos();
+static long *xdrstdio_inline();
+static void xdrstdio_destroy();
/*
* Ops vector for stdio type XDR
*/
-static struct xdr_ops xdrstdio_ops = {
- xdrstdio_getlong, /* deseraialize a long int */
- xdrstdio_putlong, /* seraialize a long int */
- xdrstdio_getbytes, /* deserialize counted bytes */
- xdrstdio_putbytes, /* serialize counted bytes */
- xdrstdio_getpos, /* get offset in the stream */
- xdrstdio_setpos, /* set offset in the stream */
- xdrstdio_inline, /* prime stream for inline macros */
- xdrstdio_destroy /* destroy stream */
+static struct xdr_ops xdrstdio_ops = {
+ xdrstdio_getlong, /* deseraialize a long int */
+ xdrstdio_putlong, /* seraialize a long int */
+ xdrstdio_getbytes, /* deserialize counted bytes */
+ xdrstdio_putbytes, /* serialize counted bytes */
+ xdrstdio_getpos, /* get offset in the stream */
+ xdrstdio_setpos, /* set offset in the stream */
+ xdrstdio_inline, /* prime stream for inline macros */
+ xdrstdio_destroy /* destroy stream */
};
/*
@@ -73,16 +75,15 @@ static struct xdr_ops xdrstdio_ops = {
* Sets the xdr stream handle xdrs for use on the stream file.
* Operation flag is set to op.
*/
-void
-xdrstdio_create(xdrs, file, op)
- register XDR *xdrs;
- FILE *file;
- enum xdr_op op;
+void xdrstdio_create(xdrs, file, op)
+register XDR *xdrs;
+FILE *file;
+enum xdr_op op;
{
xdrs->x_op = op;
xdrs->x_ops = &xdrstdio_ops;
- xdrs->x_private = (caddr_t)file;
+ xdrs->x_private = (caddr_t) file;
xdrs->x_handy = 0;
xdrs->x_base = 0;
}
@@ -91,89 +92,86 @@ xdrstdio_create(xdrs, file, op)
* Destroy a stdio xdr stream.
* Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
*/
-static void
-xdrstdio_destroy(xdrs)
- register XDR *xdrs;
+static void xdrstdio_destroy(xdrs)
+register XDR *xdrs;
{
- (void)fflush((FILE *)xdrs->x_private);
+ (void) fflush((FILE *) xdrs->x_private);
/* xx should we close the file ?? */
};
-static bool_t
-xdrstdio_getlong(xdrs, lp)
- XDR *xdrs;
- register long *lp;
+static bool_t xdrstdio_getlong(xdrs, lp)
+XDR *xdrs;
+register long *lp;
{
- if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
- return (FALSE);
+ if (fread((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
+ 1) return (FALSE);
+
#ifndef mc68000
*lp = ntohl(*lp);
#endif
return (TRUE);
}
-static bool_t
-xdrstdio_putlong(xdrs, lp)
- XDR *xdrs;
- long *lp;
+static bool_t xdrstdio_putlong(xdrs, lp)
+XDR *xdrs;
+long *lp;
{
#ifndef mc68000
long mycopy = htonl(*lp);
+
lp = &mycopy;
#endif
- if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
- return (FALSE);
+ if (fwrite((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
+ 1) return (FALSE);
+
return (TRUE);
}
-static bool_t
-xdrstdio_getbytes(xdrs, addr, len)
- XDR *xdrs;
- caddr_t addr;
- u_int len;
+static bool_t xdrstdio_getbytes(xdrs, addr, len)
+XDR *xdrs;
+caddr_t addr;
+u_int len;
{
- if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
+ if ((len != 0)
+ && (fread(addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
return (FALSE);
return (TRUE);
}
-static bool_t
-xdrstdio_putbytes(xdrs, addr, len)
- XDR *xdrs;
- caddr_t addr;
- u_int len;
+static bool_t xdrstdio_putbytes(xdrs, addr, len)
+XDR *xdrs;
+caddr_t addr;
+u_int len;
{
- if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
+ if ((len != 0)
+ && (fwrite(addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
return (FALSE);
return (TRUE);
}
-static u_int
-xdrstdio_getpos(xdrs)
- XDR *xdrs;
+static u_int xdrstdio_getpos(xdrs)
+XDR *xdrs;
{
- return ((u_int) ftell((FILE *)xdrs->x_private));
+ return ((u_int) ftell((FILE *) xdrs->x_private));
}
-static bool_t
-xdrstdio_setpos(xdrs, pos)
- XDR *xdrs;
- u_int pos;
-{
+static bool_t xdrstdio_setpos(xdrs, pos)
+XDR *xdrs;
+u_int pos;
+{
- return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
- FALSE : TRUE);
+ return ((fseek((FILE *) xdrs->x_private, (long) pos, 0) < 0) ?
+ FALSE : TRUE);
}
-static long *
-xdrstdio_inline(xdrs, len)
- XDR *xdrs;
- u_int len;
+static long *xdrstdio_inline(xdrs, len)
+XDR *xdrs;
+u_int len;
{
/*