summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbc/libc/sys/sys5/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libbc/libc/sys/sys5/read.c')
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/read.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/usr/src/lib/libbc/libc/sys/sys5/read.c b/usr/src/lib/libbc/libc/sys/sys5/read.c
index 35262a4f34..a52f3f3cae 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/read.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/read.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,9 +18,10 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -30,11 +30,11 @@
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
-#include <syscall.h>
+#include <sys/syscall.h>
/*
* If reading from the utmp file, map the data to the SunOS 4.1
- * format on the fly.
+ * format on the fly.
*/
extern void to_utmp(char *, char *, int);
@@ -50,16 +50,16 @@ bc_read(int fd, char *buf, int size)
{
int ret, off;
char *nbuf;
-
+
if (fd_get(fd) != -1) { /* we're reading utmp (utmpx, really) */
- size = getmodsize(size, sizeof (struct compat_utmp),
+ size = getmodsize(size, sizeof (struct compat_utmp),
sizeof (struct utmpx));
if ((nbuf = (void *)malloc(size)) == NULL) {
(void) fprintf(stderr, "read: malloc failed\n");
exit(-1);
}
-
+
if ((ret = _read(fd, nbuf, size)) == -1) {
free(nbuf);
return (-1);
@@ -67,7 +67,7 @@ bc_read(int fd, char *buf, int size)
to_utmp(buf, nbuf, ret);
- ret = getmodsize(ret, sizeof (struct utmpx),
+ ret = getmodsize(ret, sizeof (struct utmpx),
sizeof (struct compat_utmp));
free(nbuf);
return (ret);
@@ -82,15 +82,15 @@ to_utmp(char *buf, char *nbuf, int len)
struct compat_utmp *ut;
struct utmpx *utx;
- utx = (struct utmpx *) nbuf;
- ut = (struct compat_utmp *) buf;
+ utx = (struct utmpx *)nbuf;
+ ut = (struct compat_utmp *)buf;
while ((char *)utx < (nbuf + len)) {
(void) strncpy(ut->ut_line, utx->ut_line, sizeof (ut->ut_line));
- (void) strncpy(ut->ut_name, utx->ut_user, sizeof (ut->ut_name));
- (void) strncpy(ut->ut_host, utx->ut_host, sizeof (ut->ut_host));
- ut->ut_time = utx->ut_tv.tv_sec;
- utx++;
- ut++;
- }
+ (void) strncpy(ut->ut_name, utx->ut_user, sizeof (ut->ut_name));
+ (void) strncpy(ut->ut_host, utx->ut_host, sizeof (ut->ut_host));
+ ut->ut_time = utx->ut_tv.tv_sec;
+ utx++;
+ ut++;
+ }
}