SCCS-vsn: usr.bin/mail/glob.h 5.6
SCCS-vsn: usr.bin/mail/main.c 5.10
SCCS-vsn: usr.bin/mail/cmd1.c 5.7
-static char sccsid[] = "@(#)cmd1.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)cmd1.c 5.7 (Berkeley) %G%";
#endif /* notdef */
#include "rcv.h"
#endif /* notdef */
#include "rcv.h"
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++)
nlines += message[*ip - 1].m_lines;
}
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++)
nlines += message[*ip - 1].m_lines;
}
- if (page || nlines > atoi(cp)) {
+ if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) {
cp = value("PAGER");
if (cp == NULL || *cp == '\0')
cp = MORE;
cp = value("PAGER");
if (cp == NULL || *cp == '\0')
cp = MORE;
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
- * @(#)glob.h 5.5 (Berkeley) %G%
+ * @(#)glob.h 5.6 (Berkeley) %G%
char *sflag; /* Subject given from non tty */
int outtty; /* True if standard output a tty */
int intty; /* True if standard input a tty */
char *sflag; /* Subject given from non tty */
int outtty; /* True if standard output a tty */
int intty; /* True if standard input a tty */
-int baud; /* Output baud rate */
char mbox[PATHSIZE]; /* Name of mailbox file */
char mailname[PATHSIZE]; /* Name of system mailbox */
int uid; /* The invoker's user id */
char mbox[PATHSIZE]; /* Name of mailbox file */
char mailname[PATHSIZE]; /* Name of system mailbox */
int uid; /* The invoker's user id */
int debug; /* Debug flag set */
int rmail; /* Being called as rmail */
int screenwidth; /* Screen width, or best guess */
int debug; /* Debug flag set */
int rmail; /* Being called as rmail */
int screenwidth; /* Screen width, or best guess */
-int screenheight; /* Screen height, or best guess */
+int screenheight; /* Screen height, or best guess,
+ for "header" command */
+int realscreenheight; /* the real screen height */
#endif /* notdef */
#ifdef notdef
#endif /* notdef */
#ifdef notdef
-static char sccsid[] = "@(#)main.c 5.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.10 (Berkeley) %G%";
#endif /* notdef */
#include "rcv.h"
#endif /* notdef */
#include "rcv.h"
register int i;
struct name *to, *cc, *bcc, *smopts;
int mustsend, hdrstop(), (*prevint)(), f;
register int i;
struct name *to, *cc, *bcc, *smopts;
int mustsend, hdrstop(), (*prevint)(), f;
extern int getopt(), optind, opterr;
extern char *optarg;
extern int getopt(), optind, opterr;
extern char *optarg;
mypid = getpid();
intty = isatty(0);
outtty = isatty(1);
mypid = getpid();
intty = isatty(0);
outtty = isatty(1);
- if (outtty) {
- gtty(1, &tbuf);
- baud = tbuf.sg_ospeed;
- } else
- baud = B9600;
- * Compute what the screen size should be.
+ * Compute what the screen size for printing headers should be.
* We use the following algorithm for the height:
* If baud rate < 1200, use 9
* If baud rate = 1200, use 14
* We use the following algorithm for the height:
* If baud rate < 1200, use 9
* If baud rate = 1200, use 14
#ifdef TIOCGWINSZ
struct winsize ws;
if (ioctl(fileno(stdout), TIOCGWINSZ, (char *) &ws) < 0)
#ifdef TIOCGWINSZ
struct winsize ws;
if (ioctl(fileno(stdout), TIOCGWINSZ, (char *) &ws) < 0)
- ws.ws_col = ws.ws_row = 0;
+ ws.ws_col = ws.ws_row = 0;
+ if (outtty)
+ gtty(1, &tbuf);
+ else
+ tbuf.sg_ospeed = B9600;
+ if (tbuf.sg_ospeed < B1200)
- else if (baud == B1200)
+ else if (tbuf.sg_ospeed == B1200)
else if (ws.ws_row != 0)
screenheight = ws.ws_row;
else if (ws.ws_row != 0)
screenheight = ws.ws_row;
-#ifdef TIOCGWINSZ
- if (ws.ws_col != 0)
- screenwidth = ws.ws_col;
- else
-#endif
+ if ((realscreenheight = ws.ws_row) == 0)
+ realscreenheight = 24;
+ if ((screenwidth = ws.ws_col) == 0)