version 1.1, 1995/10/18 08:45:38 |
version 1.2, 1996/06/11 12:53:33 |
|
|
|
/* $OpenBSD$ */ |
|
/* $NetBSD: cmd2.c,v 1.5 1996/06/08 19:48:13 christos Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1980, 1993 |
* Copyright (c) 1980, 1993 |
* The Regents of the University of California. All rights reserved. |
* The Regents of the University of California. All rights reserved. |
|
|
*/ |
*/ |
|
|
#ifndef lint |
#ifndef lint |
static char sccsid[] = "from: @(#)cmd2.c 8.1 (Berkeley) 6/6/93"; |
#if 0 |
static char rcsid[] = "$Id$"; |
static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93"; |
|
#else |
|
static char rcsid[] = "$OpenBSD$"; |
|
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include "rcv.h" |
#include "rcv.h" |
|
|
* |
* |
* More user commands. |
* More user commands. |
*/ |
*/ |
|
static int igcomp __P((const void *, const void *)); |
|
|
/* |
/* |
* If any arguments were given, go to the next applicable argument |
* If any arguments were given, go to the next applicable argument |
|
|
* If given as first command with no arguments, print first message. |
* If given as first command with no arguments, print first message. |
*/ |
*/ |
int |
int |
next(msgvec) |
next(v) |
int *msgvec; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
register struct message *mp; |
register struct message *mp; |
register int *ip, *ip2; |
register int *ip, *ip2; |
int list[2], mdot; |
int list[2], mdot; |
|
|
* so we can discard when the user quits. |
* so we can discard when the user quits. |
*/ |
*/ |
int |
int |
save(str) |
save(v) |
char str[]; |
void *v; |
{ |
{ |
|
char *str = v; |
|
|
return save1(str, 1, "save", saveignore); |
return save1(str, 1, "save", saveignore); |
} |
} |
|
|
* Copy a message to a file without affected its saved-ness |
* Copy a message to a file without affected its saved-ness |
*/ |
*/ |
int |
int |
copycmd(str) |
copycmd(v) |
char str[]; |
void *v; |
{ |
{ |
|
char *str = v; |
|
|
return save1(str, 0, "copy", saveignore); |
return save1(str, 0, "copy", saveignore); |
} |
} |
|
|
* file name, minus header and trailing blank line. |
* file name, minus header and trailing blank line. |
*/ |
*/ |
int |
int |
swrite(str) |
swrite(v) |
char str[]; |
void *v; |
{ |
{ |
|
char *str = v; |
|
|
return save1(str, 1, "write", ignoreall); |
return save1(str, 1, "write", ignoreall); |
} |
} |
|
|
* Delete messages. |
* Delete messages. |
*/ |
*/ |
int |
int |
delete(msgvec) |
delete(v) |
int msgvec[]; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
delm(msgvec); |
delm(msgvec); |
return 0; |
return 0; |
} |
} |
|
|
* Delete messages, then type the new dot. |
* Delete messages, then type the new dot. |
*/ |
*/ |
int |
int |
deltype(msgvec) |
deltype(v) |
int msgvec[]; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
int list[2]; |
int list[2]; |
int lastdot; |
int lastdot; |
|
|
|
|
* Undelete the indicated messages. |
* Undelete the indicated messages. |
*/ |
*/ |
int |
int |
undeletecmd(msgvec) |
undeletecmd(v) |
int *msgvec; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
register struct message *mp; |
register struct message *mp; |
register *ip; |
register *ip; |
|
|
|
|
* Interactively dump core on "core" |
* Interactively dump core on "core" |
*/ |
*/ |
int |
int |
core() |
core(v) |
|
void *v; |
{ |
{ |
int pid; |
int pid; |
extern union wait wait_status; |
extern union wait wait_status; |
|
|
* Clobber as many bytes of stack as the user requests. |
* Clobber as many bytes of stack as the user requests. |
*/ |
*/ |
int |
int |
clobber(argv) |
clobber(v) |
char **argv; |
void *v; |
{ |
{ |
|
char **argv = v; |
register int times; |
register int times; |
|
|
if (argv[0] == 0) |
if (argv[0] == 0) |
|
|
* If no arguments, print the current list of retained fields. |
* If no arguments, print the current list of retained fields. |
*/ |
*/ |
int |
int |
retfield(list) |
retfield(v) |
char *list[]; |
void *v; |
{ |
{ |
|
char **list = v; |
|
|
return ignore1(list, ignore + 1, "retained"); |
return ignore1(list, ignore + 1, "retained"); |
} |
} |
|
|
* If no arguments, print the current list of ignored fields. |
* If no arguments, print the current list of ignored fields. |
*/ |
*/ |
int |
int |
igfield(list) |
igfield(v) |
char *list[]; |
void *v; |
{ |
{ |
|
char **list = v; |
|
|
return ignore1(list, ignore, "ignored"); |
return ignore1(list, ignore, "ignored"); |
} |
} |
|
|
int |
int |
saveretfield(list) |
saveretfield(v) |
char *list[]; |
void *v; |
{ |
{ |
|
char **list = v; |
|
|
return ignore1(list, saveignore + 1, "retained"); |
return ignore1(list, saveignore + 1, "retained"); |
} |
} |
|
|
int |
int |
saveigfield(list) |
saveigfield(v) |
char *list[]; |
void *v; |
{ |
{ |
|
char **list = v; |
|
|
return ignore1(list, saveignore, "ignored"); |
return ignore1(list, saveignore, "ignored"); |
} |
} |
|
|
register int h; |
register int h; |
struct ignore *igp; |
struct ignore *igp; |
char **ap, **ring; |
char **ap, **ring; |
int igcomp(); |
|
|
|
if (tab->i_count == 0) { |
if (tab->i_count == 0) { |
printf("No fields currently being %s.\n", which); |
printf("No fields currently being %s.\n", which); |
|
|
/* |
/* |
* Compare two names for sorting ignored field list. |
* Compare two names for sorting ignored field list. |
*/ |
*/ |
int |
static int |
igcomp(l, r) |
igcomp(l, r) |
const void *l, *r; |
const void *l, *r; |
{ |
{ |