summaryrefslogtreecommitdiffstats
path: root/usr.bin/msgs
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-09-03 04:30:46 +0000
committerache <ache@FreeBSD.org>2001-09-03 04:30:46 +0000
commit3459efd284d5fbe3b8a1b7157c1d30cacdb5c82a (patch)
treeeeabaf6737c2ec138d4ca8a015dfda3a1a4017ff /usr.bin/msgs
parent684688710c7b69dd9b075a0f539028f0c6b9a792 (diff)
downloadFreeBSD-src-3459efd284d5fbe3b8a1b7157c1d30cacdb5c82a.zip
FreeBSD-src-3459efd284d5fbe3b8a1b7157c1d30cacdb5c82a.tar.gz
File positions are off_t nowdays, not long, so:
fseek -> fseeko ftell -> ftello fseek(x, 0L, 0) -> rewind(x) NOTE: that fseek/ftell not works for >long offsets per POSIX: [EOVERFLOW] For fseek( ), the resulting file offset would be a value which cannot be represented correctly in an object of type long. [EOVERFLOW] For ftell ( ), the current file offset cannot be represented correctly in an object of type long.
Diffstat (limited to 'usr.bin/msgs')
-rw-r--r--usr.bin/msgs/msgs.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index e576edb..6f15272 100644
--- a/usr.bin/msgs/msgs.c
+++ b/usr.bin/msgs/msgs.c
@@ -438,7 +438,7 @@ int argc; char *argv[];
}
if (newrc) {
nextmsg = firstmsg;
- fseek(msgsrc, 0L, 0);
+ rewind(msgsrc);
fprintf(msgsrc, "%d\n", nextmsg);
fflush(msgsrc);
}
@@ -582,7 +582,7 @@ cmnd:
sep = "-";
if (msg >= nextmsg) {
nextmsg = msg + 1;
- fseek(msgsrc, 0L, 0);
+ rewind(msgsrc);
fprintf(msgsrc, "%d\n", nextmsg);
fflush(msgsrc);
}
@@ -597,7 +597,7 @@ cmnd:
*/
if (--msg >= nextmsg) {
nextmsg = msg + 1;
- fseek(msgsrc, 0L, 0);
+ rewind(msgsrc);
fprintf(msgsrc, "%d\n", nextmsg);
fflush(msgsrc);
}
@@ -688,7 +688,7 @@ onintr(unused)
exit(0);
sep = "Interrupt";
if (newmsg)
- fseek(newmsg, 0L, 2);
+ fseeko(newmsg, (off_t)0, SEEK_END);
intrpflg = YES;
}
}
@@ -712,14 +712,14 @@ int
linecnt(f)
FILE *f;
{
- off_t oldpos = ftell(f);
+ off_t oldpos = ftello(f);
int l = 0;
char lbuf[BUFSIZ];
while (fgets(lbuf, sizeof lbuf, f))
l++;
clearerr(f);
- fseek(f, oldpos, 0);
+ fseeko(f, oldpos, SEEK_SET);
return (l);
}
@@ -763,7 +763,7 @@ const char *prompt;
cmsg = msg;
snprintf(fname, sizeof(fname), "%s/%d", _PATH_MSGS, cmsg);
- oldpos = ftell(newmsg);
+ oldpos = ftello(newmsg);
cpfrom = fopen(fname, "r");
if (!cpfrom) {
@@ -798,7 +798,7 @@ const char *prompt;
close(fd);
warn("%s", fname);
mailing = NO;
- fseek(newmsg, oldpos, 0);
+ fseeko(newmsg, oldpos, SEEK_SET);
ask(prompt);
return;
}
@@ -808,7 +808,7 @@ const char *prompt;
fclose(cpfrom);
fclose(cpto);
- fseek(newmsg, oldpos, 0); /* reposition current message */
+ fseeko(newmsg, oldpos, SEEK_SET);/* reposition current message */
if (inch == 's')
printf("Message %d saved in \"%s\"\n", cmsg, fname);
else {
@@ -840,7 +840,7 @@ FILE *infile;
* expected form starts with From
*/
seenfrom = YES;
- frompos = ftell(infile);
+ frompos = ftello(infile);
ptr = from;
in = nxtfld(inbuf);
if (*in) {
@@ -864,7 +864,7 @@ FILE *infile;
/*
* not the expected form
*/
- fseek(infile, 0L, 0);
+ rewind(infile);
return;
}
}
@@ -884,7 +884,7 @@ FILE *infile;
*/
if (!seensubj && strncmp(inbuf, "Subj", 4)==0) {
seensubj = YES;
- frompos = ftell(infile);
+ frompos = ftello(infile);
strncpy(subj, nxtfld(inbuf), sizeof subj);
}
}
@@ -892,7 +892,7 @@ FILE *infile;
/*
* ran into EOF
*/
- fseek(infile, frompos, 0);
+ fseeko(infile, frompos, SEEK_SET);
if (!seensubj)
/*
OpenPOWER on IntegriCloud