mail.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include <time.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>

Include dependency graph for mail.c:

Go to the source code of this file.

Data Structures

struct  letter

Defines

#define D(Q)
#define SHELL   "/bin/sh"
#define DROPNAME   "/usr/spool/mail/%s"
#define LOCKNAME   "/usr/spool/mail/%s.lock"
#define LOCKWAIT   5
#define LOCKTRIES   4
#define MBOX   "mbox"
#define HELPFILE   "/usr/lib/mail.help"
#define PROMPT   "? "
#define PATHLEN   80
#define MAXRCPT   100
#define LINELEN   512
#define MAILERARGS
#define UNREAD   1
#define DELETED   2
#define READ   3

Functions

 _PROTOTYPE (int main,(int argc, char **argv))
 _PROTOTYPE (int deliver,(int count, char *vec[]))
 _PROTOTYPE (FILE *makerewindable,(void))
 _PROTOTYPE (int copy,(FILE *fromfp, FILE *tofp))
 _PROTOTYPE (void readbox,(void))
 _PROTOTYPE (void onint,(int dummy))
 _PROTOTYPE (void savelet,(struct letter *let, char *savefile))
 _PROTOTYPE (void printlet,(struct letter *let, FILE *tofp))
 _PROTOTYPE (void doshell,(char *command))
 _PROTOTYPE (char *basename,(char *name))
 _PROTOTYPE (char *whoami,(void))
 _PROTOTYPE (int filesize,(char *name))
int main (int argc, argv)
int deliver (int count, vec)
FILEmakerewindable ()
int copy (FILE *fromfp, FILE *tofp)
void readbox ()
void printall ()
void interact ()
void onint (int dummy)
void savelet (struct letter *let, char *savefile)
void updatebox ()
void printlet (struct letter *let, FILE *tofp)
void doshell (char *command)
void usage ()
char * basename (char *name)
char * whoami ()
void dohelp ()
int filesize (name)

Variables

letterfirstlet
letterlastlet
int usemailer = 1
int printmode = 0
int quitmode = 0
int reversemode = 0
int usedrop = 1
int verbose = 0
int needupdate = 0
int msgstatus = 0
int distlist = 0
char mailbox [PATHLEN]
char tempname [PATHLEN] = "/tmp/mailXXXXXX"
char * subject = NULL
FILEboxfp = NULL
jmp_buf printjump
unsigned oldmask
int optind
char * optarg


Define Documentation

#define D  ) 
 

Definition at line 24 of file mail.c.

Referenced by adjust(), alloc_segments(), con_loadfont(), cons_write(), copy_fdsets(), cp_b2u(), cp_u2b(), deliver(), dev_ioctl(), do_brk(), do_dev_name(), do_diagnostics(), do_exec(), do_fork(), do_get_kmess(), do_initialize(), do_int86(), do_ioctl(), do_newmap(), do_rdlink(), do_rdwt(), do_read(), do_select(), do_sigreturn(), do_sigsend(), do_slink(), do_slot_name(), do_trace(), do_vcopy(), do_vdevio(), do_video(), do_vm_map(), do_write(), dp_getblock(), dp_nic2user(), dp_pio16_nic2user(), dp_pio16_user2nic(), dp_user2nic(), dsp_ioctl(), dump_core(), dump_stack(), fxp_do_conf(), fxp_init_buf(), fxp_init_hw(), fxp_readv(), fxp_writev(), get_userdata(), gettime(), handle_req(), handle_status(), in_transfer(), init_buffer(), init_params(), kbd_loadmap(), lookup(), m_ioctl(), m_transfer(), main(), map_addr(), memmap_dmp(), new_mem(), patch_mem_chunks(), pm_exit(), proctab_dmp(), pstat(), put_userdata(), r_transfer(), read_core(), read_info(), read_segmap(), read_write(), readbox(), ResetGame(), rl_init_buf(), rl_readv(), rl_writev(), rw_chunk(), scr_init(), setmap(), setup_dma(), sig_proc(), subread(), subwrite(), sys_call(), umap_local(), update(), updatebox(), vir2phys(), vm_map_default(), w_init(), and w_transfer().

#define DELETED   2
 

Definition at line 46 of file mail.c.

#define DROPNAME   "/usr/spool/mail/%s"
 

Definition at line 29 of file mail.c.

Referenced by deliver(), and main().

#define HELPFILE   "/usr/lib/mail.help"
 

Definition at line 36 of file mail.c.

Referenced by dohelp().

#define LINELEN   512
 

Definition at line 40 of file mail.c.

#define LOCKNAME   "/usr/spool/mail/%s.lock"
 

Definition at line 30 of file mail.c.

Referenced by deliver(), and updatebox().

#define LOCKTRIES   4
 

Definition at line 32 of file mail.c.

Referenced by deliver().

#define LOCKWAIT   5
 

Definition at line 31 of file mail.c.

Referenced by deliver().

#define MAILERARGS
 

Definition at line 43 of file mail.c.

#define MAXRCPT   100
 

Definition at line 39 of file mail.c.

Referenced by deliver().

#define MBOX   "mbox"
 

Definition at line 34 of file mail.c.

#define PATHLEN   80
 

Definition at line 38 of file mail.c.

#define PROMPT   "? "
 

Definition at line 37 of file mail.c.

Referenced by interact().

#define READ   3
 

Definition at line 47 of file mail.c.

#define SHELL   "/bin/sh"
 

Definition at line 27 of file mail.c.

#define UNREAD   1
 

Definition at line 45 of file mail.c.

Referenced by readbox().


Function Documentation

_PROTOTYPE int  filesize,
(char *name
 

_PROTOTYPE char *  whoami,
(void) 
 

_PROTOTYPE char *  basename,
(char *name
 

_PROTOTYPE void  doshell,
(char *command
 

_PROTOTYPE void  printlet,
(struct letter *let, FILE *tofp) 
 

_PROTOTYPE void  savelet,
(struct letter *let, char *savefile) 
 

_PROTOTYPE void  onint,
(int dummy) 
 

_PROTOTYPE void  readbox,
(void) 
 

_PROTOTYPE int  copy,
(FILE *fromfp, FILE *tofp) 
 

_PROTOTYPE FILE makerewindable,
(void) 
 

_PROTOTYPE int  deliver,
(int count, char *vec[]) 
 

_PROTOTYPE int  main,
(int argc, char **argv) 
 

char* basename char *  name  ) 
 

Definition at line 734 of file mail.c.

References NULL, p, and rindex().

int copy FILE fromfp,
FILE tofp
 

Definition at line 390 of file mail.c.

References c, done, EOF, ferror, fputs(), getc, p, and putc.

int deliver int  count,
vec 
 

Definition at line 164 of file mail.c.

References boxfp, chown, copy, creat, ctime(), D, distlist, DROPNAME, ENOENT, errno, errs, execv, fclose(), fdopen(), fopen(), fprintf(), getpwnam(), getpwuid(), getuid, i, int(), isatty, j, L, link, LOCKNAME, LOCKTRIES, LOCKWAIT, lseek, mailbox, makerewindable(), MAXRCPT, now, NULL, PATHLEN, perror(), printf, passwd::pw_gid, passwd::pw_name, passwd::pw_uid, rewind(), S_IFMT, S_IFREG, setuid, SIG_IGN, SIGHUP, SIGINT, signal(), SIGQUIT, sleep, sprintf(), stat::st_mode, stat::st_uid, stat, stb, stderr, stdin, strcpy(), subject, time, time_t, unlink, usemailer, and verbose.

Referenced by main().

void dohelp  ) 
 

Definition at line 755 of file mail.c.

References fgets(), fopen(), fp, fprintf(), fputs(), HELPFILE, NULL, and stdout.

Referenced by interact().

void doshell char *  command  ) 
 

Definition at line 702 of file mail.c.

References execl, exit(), fork, fprintf(), getenv(), getgid, getuid, NULL, oldmask, perror(), pid, setgid, setuid, SHELL, shell, stderr, umask, and wait.

Referenced by interact().

int filesize name   ) 
 

Definition at line 767 of file mail.c.

References buf, L, and stat.

Referenced by DOrretr(), DOrstor(), doSIZE(), main(), and writeit().

void interact  ) 
 

Definition at line 515 of file mail.c.

References DELETED, dohelp(), doshell(), exit(), fflush(), fgets(), firstlet, fprintf(), fputs(), lastlet, linebuf, needprint, needupdate, letter::next, next, NULL, letter::prev, printf, printjump, printlet(), PROMPT, putchar, quitmode, READ, reversemode, savelet(), setjmp, SIG_IGN, SIGINT, signal(), letter::status, stderr, stdin, stdout, and strtok().

int main int  argc,
argv 
 

Definition at line 94 of file mail.c.

References basename, c, D, deliver(), distlist, DROPNAME, EOF, exit(), filesize(), getopt(), getuid, interact, mailbox, mktemp(), msgstatus, needupdate, oldmask, optarg, optind, PATHLEN, printall(), printf, printmode, quitmode, readbox(), reversemode, setuid, sprintf(), strncpy(), subject, tempname, umask, updatebox(), usage, usedrop, usemailer, verbose, and whoami().

FILE* makerewindable  ) 
 

Definition at line 346 of file mail.c.

References c, done, EOF, fclose(), ferror, fopen(), fprintf(), freopen(), getc, NULL, putc, stderr, stdin, tempname, and unlink.

Referenced by deliver().

void onint int  dummy  ) 
 

Definition at line 595 of file mail.c.

References printjump.

void printall  ) 
 

Definition at line 499 of file mail.c.

References firstlet, lastlet, NULL, printf, printlet(), reversemode, and stdout.

Referenced by main().

void printlet struct letter let,
FILE tofp
 

Definition at line 686 of file mail.c.

References boxfp, c, EOF, fseek(), getc, NULL, and putc.

Referenced by interact(), printall(), and savelet().

void readbox  ) 
 

Definition at line 458 of file mail.c.

References access, boxfp, D, ENOENT, errno, exit(), fgets(), firstlet, fopen(), fprintf(), L, lastlet, linebuf, letter::location, mailbox, malloc(), letter::next, NULL, perror(), letter::prev, printf, letter::status, stderr, strlen(), strncmp(), UNREAD, and usedrop.

Referenced by main().

void savelet struct letter let,
char *  savefile
 

Definition at line 601 of file mail.c.

References exit(), fclose(), ferror, fopen(), fork, fprintf(), getgid, getuid, NULL, perror(), pid, printlet(), setgid, setuid, stderr, and wait.

Referenced by interact().

void updatebox  ) 
 

Definition at line 631 of file mail.c.

References c, D, DELETED, firstlet, fopen(), LOCKNAME, letter::next, NULL, PATHLEN, perror(), printf, sprintf(), letter::status, tempname, and whoami().

Referenced by main().

void usage void   ) 
 

Definition at line 728 of file mail.c.

References fprintf(), and stderr.

char* whoami  ) 
 

Definition at line 745 of file mail.c.

References getpwuid(), getuid, NULL, and passwd::pw_name.


Variable Documentation

FILE* boxfp = NULL
 

Definition at line 69 of file mail.c.

Referenced by deliver(), printlet(), and readbox().

int distlist = 0
 

Definition at line 65 of file mail.c.

Referenced by deliver(), and main().

struct letter* firstlet
 

Definition at line 55 of file mail.c.

Referenced by interact(), printall(), readbox(), and updatebox().

struct letter * lastlet
 

Definition at line 55 of file mail.c.

Referenced by interact(), printall(), and readbox().

char mailbox[PATHLEN]
 

Definition at line 66 of file mail.c.

Referenced by deliver(), main(), and readbox().

int msgstatus = 0
 

Definition at line 64 of file mail.c.

Referenced by main().

int needupdate = 0
 

Definition at line 63 of file mail.c.

Referenced by interact(), and main().

unsigned oldmask
 

Definition at line 71 of file mail.c.

Referenced by doshell(), main(), and test22a().

char* optarg
 

Definition at line 59 of file options.c.

int optind
 

Definition at line 29 of file getopt.c.

jmp_buf printjump
 

Definition at line 70 of file mail.c.

Referenced by interact(), and onint().

int printmode = 0
 

Definition at line 58 of file mail.c.

Referenced by main().

int quitmode = 0
 

Definition at line 59 of file mail.c.

Referenced by interact(), and main().

int reversemode = 0
 

Definition at line 60 of file mail.c.

Referenced by interact(), main(), and printall().

char* subject = NULL
 

Definition at line 68 of file mail.c.

Referenced by deliver(), main(), and run_job().

char tempname[PATHLEN] = "/tmp/mailXXXXXX"
 

Definition at line 67 of file mail.c.

Referenced by herein(), main(), makerewindable(), readhere(), and updatebox().

int usedrop = 1
 

Definition at line 61 of file mail.c.

Referenced by main(), and readbox().

int usemailer = 1
 

Definition at line 57 of file mail.c.

Referenced by deliver(), and main().

int verbose = 0
 

Definition at line 62 of file mail.c.


Generated on Fri Apr 14 22:58:42 2006 for minix by  doxygen 1.4.6