Deleted Added
full compact
lex.c (99112) lex.c (126415)
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 23 unchanged lines hidden (view full) ---

32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
37#endif
38#endif /* not lint */
39#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 23 unchanged lines hidden (view full) ---

32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
37#endif
38#endif /* not lint */
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/usr.bin/mail/lex.c 99112 2002-06-30 05:25:07Z obrien $");
40__FBSDID("$FreeBSD: head/usr.bin/mail/lex.c 126415 2004-02-29 20:44:44Z mikeh $");
41
42#include "rcv.h"
43#include <errno.h>
44#include <fcntl.h>
45#include "extern.h"
46
47/*
48 * Mail -- a mail program

--- 6 unchanged lines hidden (view full) ---

55extern const struct cmd cmdtab[];
56extern const char *version;
57
58/*
59 * Set up editing on the given file name.
60 * If the first character of name is %, we are considered to be
61 * editing the file, otherwise we are reading our mail which has
62 * signficance for mbox and so forth.
41
42#include "rcv.h"
43#include <errno.h>
44#include <fcntl.h>
45#include "extern.h"
46
47/*
48 * Mail -- a mail program

--- 6 unchanged lines hidden (view full) ---

55extern const struct cmd cmdtab[];
56extern const char *version;
57
58/*
59 * Set up editing on the given file name.
60 * If the first character of name is %, we are considered to be
61 * editing the file, otherwise we are reading our mail which has
62 * signficance for mbox and so forth.
63 *
64 * If the -e option is being passed to mail, this function has a
65 * tri-state return code: -1 on error, 0 on no mail, 1 if there is
66 * mail.
63 */
64int
65setfile(name)
66 char *name;
67{
68 FILE *ibuf;
67 */
68int
69setfile(name)
70 char *name;
71{
72 FILE *ibuf;
69 int i, fd;
73 int checkmode, i, fd;
70 struct stat stb;
71 char isedit = *name != '%' || getuserid(myname) != getuid();
72 char *who = name[1] ? name + 1 : myname;
73 char tempname[PATHSIZE];
74 static int shudclob;
75
76 if ((name = expand(name)) == NULL)
77 return (-1);

--- 64 unchanged lines hidden (view full) ---

142 * New mail may have arrived while we were reading
143 * the mail file, so reset mailsize to be where
144 * we really are in the file...
145 */
146 mailsize = ftello(ibuf);
147 (void)Fclose(ibuf);
148 relsesigs();
149 sawcom = 0;
74 struct stat stb;
75 char isedit = *name != '%' || getuserid(myname) != getuid();
76 char *who = name[1] ? name + 1 : myname;
77 char tempname[PATHSIZE];
78 static int shudclob;
79
80 if ((name = expand(name)) == NULL)
81 return (-1);

--- 64 unchanged lines hidden (view full) ---

146 * New mail may have arrived while we were reading
147 * the mail file, so reset mailsize to be where
148 * we really are in the file...
149 */
150 mailsize = ftello(ibuf);
151 (void)Fclose(ibuf);
152 relsesigs();
153 sawcom = 0;
150 if (!edit && msgCount == 0) {
154 checkmode = value("checkmode") != NULL;
155
156 if ((checkmode || !edit) && msgCount == 0) {
151nomail:
157nomail:
152 fprintf(stderr, "No mail for %s\n", who);
153 return (-1);
158 if (!checkmode) {
159 fprintf(stderr, "No mail for %s\n", who);
160 return (-1);
161 } else
162 return (0);
154 }
163 }
155 return (0);
164 return (checkmode ? 1 : 0);
156}
157
158/*
159 * Incorporate any new mail that has arrived since we first
160 * started reading mail.
161 */
162int
163incfile()

--- 546 unchanged lines hidden ---
165}
166
167/*
168 * Incorporate any new mail that has arrived since we first
169 * started reading mail.
170 */
171int
172incfile()

--- 546 unchanged lines hidden ---