I should beware in-sourcing too much ...
void ambigsw(char *, struct swit *);
char **brkstring(char *, char *, char *);
int check_charset(char *, int);
-void closefds(int);
char *concat(char *, ...);
int context_del(char *);
char *context_find(char *);
# source for library functions
SRCS = addrsbr.c ambigsw.c brkstring.c \
- check_charset.c closefds.c concat.c context_del.c \
+ check_charset.c concat.c context_del.c \
context_find.c context_foil.c context_read.c \
context_replace.c context_save.c \
copyip.c cpydata.c cpydgst.c crawl_folders.c \
+++ /dev/null
-/*
-** closefds.c -- close-up fd's
-**
-** This code is Copyright (c) 2002, by the authors of nmh. See the
-** COPYRIGHT file in the root directory of the nmh distribution for
-** complete copyright information.
-*/
-
-#include <h/mh.h>
-
-
-void
-closefds(int i)
-{
- int nbits = OPEN_MAX;
-
- for (; i < nbits; i++)
- close(i);
-}
static void
replfilter(FILE *in, FILE *out, char *filter)
{
- int pid;
+ int pid, n;
char *errstr;
if (filter == NULL)
case OK:
dup2(fileno(in), fileno(stdin));
dup2(fileno(out), fileno(stdout));
- closefds(3);
+ for (n=3; n<OPEN_MAX; n++) {
+ close(n);
+ }
execlp("mhl", "mhl", "-form", filter, NULL);
errstr = strerror(errno);
int msgp = 0, nfiles = 0, distsw = 0, vecp = 1;
int msgnum, status;
int in, out;
+ int n;
char *cp, *maildir = NULL;
char buf[BUFSIZ], **ap, **argp, **arguments;
char *msgs[MAXARGS], *vec[MAXARGS];
}
status = 0;
vec[0] = "spost";
- closefds(3);
+ for (n=3; n<OPEN_MAX; n++) {
+ close(n);
+ }
for (msgnum = 0; msgnum < nfiles; msgnum++) {
switch (sendsbr(vec, vecp, files[msgnum], &st, 1)) {
usr_pipe(int fd, char *cmd, char *pgm, char **vec, int suppress)
{
pid_t child_id;
- int bytes, seconds, status;
+ int bytes, seconds, status, n;
struct stat st;
char *path;
if (fd != 3) {
dup2(fd, 3);
}
- closefds(4);
+ for (n=4; n<OPEN_MAX; n++) {
+ close(n);
+ }
#ifdef TIOCNOTTY
if ((fd = open("/dev/tty", O_RDWR)) != -1) {