From: Peter Avalos Date: Mon, 12 Jan 2009 01:27:15 +0000 (-0500) Subject: Use off_t for file positions in comsat. X-Git-Tag: v2.3.0~45 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/f0f595f68f002e4e25643ee6b06f08b1fbf4d824?ds=sidebyside Use off_t for file positions in comsat. While I'm here, sync the manual page. Obtained-from: FreeBSD --- diff --git a/libexec/comsat/comsat.8 b/libexec/comsat/comsat.8 index 261b4a0718..7f7916bc80 100644 --- a/libexec/comsat/comsat.8 +++ b/libexec/comsat/comsat.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)comsat.8 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/libexec/comsat/comsat.8,v 1.6.2.4 2002/08/18 17:30:53 johan Exp $ +.\" $FreeBSD: src/libexec/comsat/comsat.8,v 1.14 2005/02/13 23:45:48 ru Exp $ .\" $DragonFly: src/libexec/comsat/comsat.8,v 1.3 2006/02/17 19:33:31 swildner Exp $ .\" .Dd August 9, 2002 @@ -42,11 +42,13 @@ .Sh SYNOPSIS .Nm .Sh DESCRIPTION -.Nm Comsat -is the server process which receives reports of incoming mail +The +.Nm +utility is the server process which receives reports of incoming mail and notifies users if they have requested this service. -.Nm Comsat -receives messages on a datagram port associated with the +The +.Nm +utility receives messages on a datagram port associated with the .Dq biff service specification (see @@ -55,38 +57,43 @@ and .Xr inetd 8 ) . The one line messages are of the form: .Pp -.Dl user@mailbox-offset[:mailbox-name] +.D1 Ar user Ns @ Ns Ar mailbox Ns - Ns Ar offset Ns Op : Ns Ar mailbox-name .Pp If the -.Em user +.Ar user specified is logged in to the system and the associated terminal has the owner execute bit turned on (by a -.Dq Li biff y ) , +.Dq Nm biff Cm y ) , the -.Em offset +.Ar offset is used as a seek offset into the appropriate mailbox file and the first 7 lines or 560 characters of the message are printed -on the user's terminal. Lines which appear to be part of +on the user's terminal. +Lines which appear to be part of the message header other than the -.Dq From , -.Dq \&To , -.Dq Date , +.Dq Li From , +.Dq Li \&To , +.Dq Li Date , or -.Dq Subject +.Dq Li Subject lines are not included in the displayed message. .Pp If the -.Em user +.Ar user specified is logged in to the system and the associated terminal has the group execute bit turned on (by a -.Dq Li biff b ) , -two bell characters (ASCII \\007) are printed on the user's terminal. +.Dq Nm biff Cm b ) , +two bell characters +.Tn ( ASCII +\\007) are printed on the user's terminal. .Pp -If mailbox-name omitted, standard mailbox assumed. +If +.Ar mailbox-name +omitted, standard mailbox assumed. .Sh FILES -.Bl -tag -width /var/mail/user -compact +.Bl -tag -width ".Pa /var/mail/user" -compact .It Pa /var/run/utmp -to find out who's logged on and on what terminals +to find out who is logged on and on what terminals .It Pa /var/mail/user standard mailbox .El @@ -96,7 +103,7 @@ standard mailbox .Sh HISTORY The .Nm -command appeared in +utility appeared in .Bx 4.2 . .Sh BUGS The message header filtering is prone to error. diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c index 000ea4ec25..5582fe0451 100644 --- a/libexec/comsat/comsat.c +++ b/libexec/comsat/comsat.c @@ -30,9 +30,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)comsat.c 8.1 (Berkeley) 6/4/93 - * $FreeBSD: src/libexec/comsat/comsat.c,v 1.13.2.1 2002/08/09 02:56:30 johan Exp $ + * $FreeBSD: src/libexec/comsat/comsat.c,v 1.17 2005/02/14 17:42:56 stefanf Exp $ * $DragonFly: src/libexec/comsat/comsat.c,v 1.6 2005/05/03 17:39:03 liamfoy Exp $ */ @@ -149,8 +148,8 @@ onalrm(int signo __unused) exit(1); } } - lseek(uf, (off_t)0, L_SET); - nutmp = read(uf, utmp, (int)statbf.st_size)/sizeof(struct utmp); + lseek(uf, (off_t)0, SEEK_SET); + nutmp = read(uf, utmp, (size_t)statbf.st_size)/sizeof(struct utmp); } } @@ -168,7 +167,7 @@ mailfor(char *name) if (!(cp = strchr(name, '@'))) return; *cp = '\0'; - offset = atoi(cp + 1); + offset = strtoll(cp + 1, NULL, 10); if (!(cp = strchr(cp + 1, ':'))) file = name; else @@ -259,7 +258,7 @@ jkfprintf(FILE *tp, const char *user, const char *file, off_t offset) if ((fi = fopen(file, "r")) == NULL) return; - fseek(fi, offset, L_SET); + fseeko(fi, offset, SEEK_SET); /* * Print the first 7 lines or 560 characters of the new mail * (whichever comes first). Skip header crap other than