version 1.1, 1995/10/18 08:45:38 |
version 1.2, 1996/06/11 12:53:34 |
|
|
|
/* $OpenBSD$ */ |
|
/* $NetBSD: cmd3.c,v 1.5 1996/06/08 19:48:14 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 |
|
#if 0 |
static char sccsid[] = "@(#)cmd3.c 8.1 (Berkeley) 6/6/93"; |
static char sccsid[] = "@(#)cmd3.c 8.1 (Berkeley) 6/6/93"; |
static char rcsid[] = "$Id$"; |
#else |
|
static char rcsid[] = "$OpenBSD$"; |
|
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include "rcv.h" |
#include "rcv.h" |
|
|
* |
* |
* Still more user commands. |
* Still more user commands. |
*/ |
*/ |
|
static int diction __P((const void *, const void *)); |
|
|
/* |
/* |
* Process a shell escape by saving signals, ignoring signals, |
* Process a shell escape by saving signals, ignoring signals, |
* and forking a sh -c |
* and forking a sh -c |
*/ |
*/ |
int |
int |
shell(str) |
shell(v) |
char *str; |
void *v; |
{ |
{ |
|
char *str = v; |
sig_t sigint = signal(SIGINT, SIG_IGN); |
sig_t sigint = signal(SIGINT, SIG_IGN); |
char *shell; |
char *shell; |
char cmd[BUFSIZ]; |
char cmd[BUFSIZ]; |
|
|
*/ |
*/ |
/*ARGSUSED*/ |
/*ARGSUSED*/ |
int |
int |
dosh(str) |
dosh(v) |
char *str; |
void *v; |
{ |
{ |
sig_t sigint = signal(SIGINT, SIG_IGN); |
sig_t sigint = signal(SIGINT, SIG_IGN); |
char *shell; |
char *shell; |
|
|
*/ |
*/ |
|
|
int |
int |
help() |
help(v) |
|
void *v; |
{ |
{ |
register c; |
register c; |
register FILE *f; |
register FILE *f; |
|
|
* Change user's working directory. |
* Change user's working directory. |
*/ |
*/ |
int |
int |
schdir(arglist) |
schdir(v) |
char **arglist; |
void *v; |
{ |
{ |
|
char **arglist = v; |
char *cp; |
char *cp; |
|
|
if (*arglist == NOSTR) |
if (*arglist == NOSTR) |
|
|
} |
} |
|
|
int |
int |
respond(msgvec) |
respond(v) |
int *msgvec; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
if (value("Replyall") == NOSTR) |
if (value("Replyall") == NOSTR) |
return (_respond(msgvec)); |
return (_respond(msgvec)); |
else |
else |
|
|
* back to the system mailbox. |
* back to the system mailbox. |
*/ |
*/ |
int |
int |
preserve(msgvec) |
preserve(v) |
int *msgvec; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
register struct message *mp; |
register struct message *mp; |
register int *ip, mesg; |
register int *ip, mesg; |
|
|
|
|
* Mark all given messages as unread. |
* Mark all given messages as unread. |
*/ |
*/ |
int |
int |
unread(msgvec) |
unread(v) |
int msgvec[]; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
register int *ip; |
register int *ip; |
|
|
for (ip = msgvec; *ip != NULL; ip++) { |
for (ip = msgvec; *ip != NULL; ip++) { |
|
|
* Print the size of each message. |
* Print the size of each message. |
*/ |
*/ |
int |
int |
messize(msgvec) |
messize(v) |
int *msgvec; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
register struct message *mp; |
register struct message *mp; |
register int *ip, mesg; |
register int *ip, mesg; |
|
|
|
|
* by returning an error. |
* by returning an error. |
*/ |
*/ |
int |
int |
rexit(e) |
rexit(v) |
int e; |
void *v; |
{ |
{ |
if (sourcing) |
if (sourcing) |
return(1); |
return(1); |
exit(e); |
exit(0); |
/*NOTREACHED*/ |
/*NOTREACHED*/ |
} |
} |
|
|
|
|
* of csh. |
* of csh. |
*/ |
*/ |
int |
int |
set(arglist) |
set(v) |
char **arglist; |
void *v; |
{ |
{ |
|
char **arglist = v; |
register struct var *vp; |
register struct var *vp; |
register char *cp, *cp2; |
register char *cp, *cp2; |
char varbuf[BUFSIZ], **ap, **p; |
char varbuf[BUFSIZ], **ap, **p; |
|
|
* Unset a bunch of variable values. |
* Unset a bunch of variable values. |
*/ |
*/ |
int |
int |
unset(arglist) |
unset(v) |
char **arglist; |
void *v; |
{ |
{ |
|
char **arglist = v; |
register struct var *vp, *vp2; |
register struct var *vp, *vp2; |
int errs, h; |
int errs, h; |
char **ap; |
char **ap; |
|
|
* Put add users to a group. |
* Put add users to a group. |
*/ |
*/ |
int |
int |
group(argv) |
group(v) |
char **argv; |
void *v; |
{ |
{ |
|
char **argv = v; |
register struct grouphead *gh; |
register struct grouphead *gh; |
register struct group *gp; |
register struct group *gp; |
register int h; |
register int h; |
|
|
char **list; |
char **list; |
{ |
{ |
register char **ap; |
register char **ap; |
int diction(); |
|
|
|
for (ap = list; *ap != NOSTR; ap++) |
for (ap = list; *ap != NOSTR; ap++) |
; |
; |
|
|
* Do a dictionary order comparison of the arguments from |
* Do a dictionary order comparison of the arguments from |
* qsort. |
* qsort. |
*/ |
*/ |
int |
static int |
diction(a, b) |
diction(a, b) |
const void *a, *b; |
const void *a, *b; |
{ |
{ |
|
|
|
|
/*ARGSUSED*/ |
/*ARGSUSED*/ |
int |
int |
null(e) |
null(v) |
int e; |
void *v; |
{ |
{ |
return 0; |
return 0; |
} |
} |
|
|
* the current file. |
* the current file. |
*/ |
*/ |
int |
int |
file(argv) |
file(v) |
register char **argv; |
void *v; |
{ |
{ |
|
char **argv = v; |
|
|
if (argv[0] == NOSTR) { |
if (argv[0] == NOSTR) { |
newfileinfo(); |
newfileinfo(); |
|
|
* Expand file names like echo |
* Expand file names like echo |
*/ |
*/ |
int |
int |
echo(argv) |
echo(v) |
char **argv; |
void *v; |
{ |
{ |
|
char **argv = v; |
register char **ap; |
register char **ap; |
register char *cp; |
register char *cp; |
|
|
|
|
} |
} |
|
|
int |
int |
Respond(msgvec) |
Respond(v) |
int *msgvec; |
void *v; |
{ |
{ |
|
int *msgvec = v; |
if (value("Replyall") == NOSTR) |
if (value("Replyall") == NOSTR) |
return (_Respond(msgvec)); |
return (_Respond(msgvec)); |
else |
else |
|
|
* .mailrc and do some things if sending, others if receiving. |
* .mailrc and do some things if sending, others if receiving. |
*/ |
*/ |
int |
int |
ifcmd(argv) |
ifcmd(v) |
char **argv; |
void *v; |
{ |
{ |
|
char **argv = v; |
register char *cp; |
register char *cp; |
|
|
if (cond != CANY) { |
if (cond != CANY) { |
|
|
* flip over the conditional flag. |
* flip over the conditional flag. |
*/ |
*/ |
int |
int |
elsecmd() |
elsecmd(v) |
|
void *v; |
{ |
{ |
|
|
switch (cond) { |
switch (cond) { |
|
|
* End of if statement. Just set cond back to anything. |
* End of if statement. Just set cond back to anything. |
*/ |
*/ |
int |
int |
endifcmd() |
endifcmd(v) |
|
void *v; |
{ |
{ |
|
|
if (cond == CANY) { |
if (cond == CANY) { |
|
|
* Set the list of alternate names. |
* Set the list of alternate names. |
*/ |
*/ |
int |
int |
alternates(namelist) |
alternates(v) |
char **namelist; |
void *v; |
{ |
{ |
|
char **namelist = v; |
register int c; |
register int c; |
register char **ap, **ap2, *cp; |
register char **ap, **ap2, *cp; |
|
|