diff --git a/appl/popper/Makefile.in b/appl/popper/Makefile.in index 7ce1e6c8b..b8d695018 100644 --- a/appl/popper/Makefile.in +++ b/appl/popper/Makefile.in @@ -34,22 +34,22 @@ OBJECTS = $(POPPER_OBJECTS) $(POP_DEBUG_OBJECTS) POPPER_SOURCES = \ pop_dele.c pop_dropcopy.c pop_dropinfo.c \ - pop_get_command.c pop_get_subcommand.c pop_init.c \ + pop_get_command.c pop_init.c \ pop_last.c pop_list.c pop_log.c \ pop_msg.c pop_parse.c pop_pass.c pop_quit.c \ pop_rset.c pop_send.c pop_stat.c pop_updt.c \ - pop_user.c pop_xtnd.c pop_xmit.c pop_uidl.c pop_xover.c popper.c + pop_user.c pop_uidl.c pop_xover.c popper.c POP_DEBUG_SOURCES = \ pop_debug.c POPPER_OBJECTS = \ pop_dele.o pop_dropcopy.o pop_dropinfo.o \ - pop_get_command.o pop_get_subcommand.o pop_init.o \ + pop_get_command.o pop_init.o \ pop_last.o pop_list.o pop_log.o pop_msg.o \ pop_parse.o pop_pass.o pop_quit.o pop_rset.o \ pop_send.o pop_stat.o pop_updt.o pop_user.o \ - pop_xtnd.o pop_xmit.o pop_uidl.o pop_xover.o popper.o + pop_uidl.o pop_xover.o popper.o POP_DEBUG_OBJECTS = \ pop_debug.o diff --git a/appl/popper/pop_get_command.c b/appl/popper/pop_get_command.c index 5a257cb48..61d7fffb8 100644 --- a/appl/popper/pop_get_command.c +++ b/appl/popper/pop_get_command.c @@ -27,11 +27,13 @@ static state_table states[] = { {trans, "rset", 0, 0, pop_rset, {trans, trans}}, {trans, "top", 2, 2, pop_send, {trans, trans}}, {trans, "last", 0, 0, pop_last, {trans, trans}}, - {trans, "xtnd", 1, 99, pop_xtnd, {trans, trans}}, {trans, "quit", 0, 0, pop_updt, {halt, halt}}, {trans, "help", 0, 0, pop_help, {trans, trans}}, #ifdef UIDL {trans, "uidl", 0, 1, pop_uidl, {trans, trans}}, +#endif +#ifdef XOVER + {trans, "xover", 0, 0, pop_xover, {trans, trans}}, #endif {(state) 0, NULL, 0, 0, NULL, {halt, halt}}, }; diff --git a/appl/popper/pop_get_subcommand.c b/appl/popper/pop_get_subcommand.c deleted file mode 100644 index 78652339b..000000000 --- a/appl/popper/pop_get_subcommand.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include -RCSID("$Id$"); - -/* - * get_subcommand: Extract a POP XTND subcommand from a client input line - */ - -static xtnd_table subcommands[] = { - {"xmit", 0, 0, pop_xmit}, -#ifdef XOVER - {"xover", 0, 0, pop_xover}, -#endif - {NULL} -}; - -xtnd_table * -pop_get_subcommand(POP *p) -{ - xtnd_table * s; - - /* Search for the POP command in the command/state table */ - for (s = subcommands; s->subcommand; s++) { - - if (strcmp(s->subcommand,p->pop_subcommand) == 0) { - - /* Were too few parameters passed to the subcommand? */ - if ((p->parm_count-1) < s->min_parms) { - pop_msg(p,POP_FAILURE, - "Too few arguments for the %s %s command.", - p->pop_command,p->pop_subcommand); - return NULL; - } - - /* Were too many parameters passed to the subcommand? */ - if ((p->parm_count-1) > s->max_parms) { - pop_msg(p,POP_FAILURE, - "Too many arguments for the %s %s command.", - p->pop_command,p->pop_subcommand); - return NULL; - } - - /* Return a pointer to the entry for this subcommand - in the XTND command table */ - return (s); - } - } - /* The client subcommand was not located in the XTND command table */ - pop_msg(p,POP_FAILURE, - "Unknown command: \"%s %s\".",p->pop_command,p->pop_subcommand); - return NULL; -} diff --git a/appl/popper/pop_xmit.c b/appl/popper/pop_xmit.c deleted file mode 100644 index 88c43e13b..000000000 --- a/appl/popper/pop_xmit.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include -RCSID("$Id$"); - -/* - * xmit: POP XTND function to receive a message from - * a client and send it in the mail - */ - -int -pop_xmit (POP *p) -{ - FILE * tmp; /* File descriptor for - temporary file */ - char buffer[MAXLINELEN]; /* Read buffer */ - char temp_xmit[MAXDROPLEN]; /* Name of the temporary - filedrop */ - int stat; - int id, pid; - - /* Create a temporary file into which to copy the user's message */ - if ((tmp = fdopen(mkstemp(temp_xmit), "w+")) == NULL) - return (pop_msg(p, POP_FAILURE, - "Unable to create temporary message file \"%s\": %s", - temp_xmit, - strerror(errno))); -#ifdef DEBUG - if(p->debug) - pop_log(p, POP_DEBUG, - "Creating temporary file for sending a mail message \"%s\"\n", - temp_xmit); -#endif /* DEBUG */ - - /* Tell the client to start sending the message */ - pop_msg(p,POP_SUCCESS,"Start sending the message."); - - /* Receive the message */ -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Receiving mail message"); -#endif /* DEBUG */ - while (fgets(buffer,MAXLINELEN,p->input)){ - /* Look for initial period */ -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Receiving: \"%s\"",buffer); -#endif /* DEBUG */ - if (strcmp(buffer,".\r\n") == 0) break; - fputs (buffer,tmp); - } - fclose (tmp); - -#ifdef DEBUG - if(p->debug)pop_log(p,POP_DEBUG,"Forking for \"%s\"",MAIL_COMMAND); -#endif /* DEBUG */ - /* Send the message */ - switch (pid = fork()) { - case 0: - fclose (p->input); - fclose (p->output); - close(0); - if (open(temp_xmit,O_RDONLY,0) < 0) - _exit(1); - execl (MAIL_COMMAND, "send-mail", "-t", "-oem", (char *)NULL); - _exit(1); - case -1: -#ifdef DEBUG - if (!p->debug) unlink (temp_xmit); -#endif /* DEBUG */ - return (pop_msg(p,POP_FAILURE, - "Unable to execute \"%s\"",MAIL_COMMAND)); - default: - while((id = wait(&stat)) >=0 && id != pid) - ; - if (!p->debug) - unlink (temp_xmit); - if (WEXITSTATUS(stat) != 0) - return pop_msg(p,POP_FAILURE,"Unable to send message"); - return pop_msg (p,POP_SUCCESS,"Message sent successfully"); - } - -} diff --git a/appl/popper/pop_xtnd.c b/appl/popper/pop_xtnd.c deleted file mode 100644 index 3b45d71a0..000000000 --- a/appl/popper/pop_xtnd.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 1989 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include -RCSID("$Id$"); - -/* - * xtnd: Handle extensions to the POP protocol suite - */ - -int -pop_xtnd (POP *p) -{ - xtnd_table * x; - - /* Convert the XTND subcommand to lower case */ - strlwr(p->pop_subcommand); - - /* Search for the subcommand in the XTND command table */ - if ((x = pop_get_subcommand(p)) == NULL) return(POP_FAILURE); - - /* Call the function associated with this subcommand */ - if (x->function) return((*x->function)(p)); - - /* Otherwise assume NOOP */ - return (pop_msg(p,POP_SUCCESS,NULL)); -} diff --git a/appl/popper/popper.h b/appl/popper/popper.h index 30786f7e9..88330fe75 100644 --- a/appl/popper/popper.h +++ b/appl/popper/popper.h @@ -288,8 +288,6 @@ int pop_send(POP *p); int pop_stat(POP *p); int pop_updt(POP *p); int pop_user(POP *p); -int pop_xmit(POP *p); -int pop_xtnd(POP *p); #ifdef UIDL int pop_uidl(POP *p); #endif @@ -299,7 +297,6 @@ int pop_xover(POP *p); int pop_help(POP *p); state_table *pop_get_command(POP *p, char *mp); void pop_lower(char *buf); -xtnd_table *pop_get_subcommand(POP *p); int pop_log(POP *p, int stat, char *format, ...) #ifdef __GNUC__