cmd1.c revision 196c7f05d2deba7404e90ad67f3861185c78ca2d
/*
* 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.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Joyent, Inc.
*/
/*
* Copyright 2001 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#include <err.h>
#include "rcv.h"
#include <locale.h>
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*
* User commands.
*/
/*
* Print the current active headings.
* Don't change dot if invoker didn't give an argument.
*/
static int curscreen = 0, oldscreensize = 0;
int
{
int size;
size = screensize();
n = msgvec[0];
if (n != 0)
if (curscreen < 0)
curscreen = 0;
flag = 0;
if (Hflag)
mesg++;
continue;
break;
sreset();
}
if (flag == 0) {
return (1);
}
return (0);
}
/*
*/
int
{
register int s, size;
int cur[1];
cur[0] = 0;
size = screensize();
s = curscreen;
switch (*arg) {
case 0:
case '+':
s++;
return (0);
}
curscreen = s;
break;
case '-':
if (--s < 0) {
return (0);
}
curscreen = s;
break;
default:
return (1);
}
}
/*
* Compute what the screen size should be.
* We use the following algorithm:
* If user specifies with screen option, use that.
* If baud rate < 1200, use 5
* If baud rate = 1200, use 10
* If baud rate > 1200, use 20
*/
int
screensize(void)
{
register char *cp;
register int newscreensize, tmp;
#ifdef TIOCGWINSZ
#endif
newscreensize = tmp;
newscreensize = 5;
newscreensize = 10;
#ifdef TIOCGWINSZ
#endif
else
newscreensize = 20;
/* renormalize the value of curscreen */
if (newscreensize != oldscreensize) {
}
return (newscreensize);
}
/*
* Print out the headlines for each message
* in the passed message list.
*/
int
{
register int *ip;
sreset();
}
return (0);
}
/*
* Print out the header of a specific message.
* This is a slight improvement to the standard one.
*/
void
{
char *fromline;
headline_t *hl;
register char *cp;
int showto;
if (headline_alloc(&hl) != 0) {
}
subjline = "";
dispc = ' ';
showto = 0;
dispc = 'R';
dispc = 'O';
dispc = 'N';
dispc = 'U';
if ((int)value("bsdcompat"))
dispc = '*';
else
dispc = 'S';
if ((int)value("bsdcompat"))
dispc = 'P';
else
dispc = 'H';
dispc = 'M';
}
}
}
/*
* Netnews interface?
*/
if (newsflg) {
fromline = "<>";
else
*cp = '\0';
break;
}
}
/*
* else regular.
*/
} else {
if (value("showto") &&
showto = 1;
}
if (value("showname"))
else
}
if ((int)value("showfull")) {
if (showto)
else
} else {
if (showto)
else
}
printf("%16.16s %4ld/%-5ld %-.25s\n",
subjline);
} else {
}
}
/*
* Return the full name from an RFC-822 header line
* or the last two (or one) component of the address.
*/
static char *
{
if (hdr == 0)
return (0);
*cp = 0;
*cp = 0;
return (hdr);
*cp = 0;
*cp = 0;
return (hdr);
}
}
return (cp);
}
/*
* Print out the value of dot.
*/
int
pdot(void)
{
return (0);
}
/*
* Print out all the possible commands.
*/
int
pcmdlist(void)
{
register int cc;
printf("Commands are:\n");
if (cc > 72) {
printf("\n");
}
else
}
return (0);
}
/*
* Paginate messages, honor ignored fields.
*/
int
{
}
/*
* Paginate messages, even printing ignored fields.
*/
int
{
}
/*
* Type out messages, honor ignored fields.
*/
int
{
}
/*
* Type out messages, even printing ignored fields.
*/
int
{
}
/*
* Type out the messages requested.
*/
static int
{
int *ip;
register int mesg;
register char *cp;
long nlines;
int setsigs = 0;
}
goto ret0;
}
if (!page) {
nlines = 0;
}
if (page ||
} else {
setsigs++;
}
}
}
}
}
ret0:
if (setsigs) {
}
return (0);
}
/*
* Respond to a broken pipe signal --
* probably caused by user quitting more.
*/
void
#ifdef __cplusplus
brokpipe(int)
#else
/* ARGSUSED */
brokpipe(int s)
#endif
{
#ifdef OLD_BSD_SIGS
#endif
}
/*
* Print the indicated message on standard output.
*/
static void
{
} else {
}
}
/*
* Print the top so many lines of each desired message.
* The number of lines is taken from the variable "toplines"
* and defaults to 5.
*/
int
{
register int *ip;
register int mesg;
char *valtop;
top_maxlines = 5;
top_maxlines = 5;
}
top_lineb = 1;
if (!top_lineb)
printf("\n");
top_linecount = 0;
} else {
}
}
}
return (0);
}
int
{
if (top_linecount++ >= top_maxlines)
}
/*
* Touch all the given messages so that they will
* get mboxed.
*/
int
{
register int *ip;
}
return (0);
}
/*
* Make sure all passed messages get mboxed.
*/
int
{
register int *ip;
}
return (0);
}
/*
* List the folders the user currently has.
*/
int
{
return (-1);
}
if (*arglist) {
}
}