1: #include "uucp.h"
   2: #include <pwd.h>
   3: 
   4: 
   5: /*******
   6:  *	sdmail(file, uid)
   7:  *	char *file, *uid;
   8:  *
   9:  *	sdmail  -  this routine will determine the owner
  10:  *	of the file (file), create a message string and
  11:  *	call "mailst" to send the cleanup message.
  12:  *	This is only implemented for local system
  13:  *	mail at this time.
  14:  */
  15: 
  16: sdmail(file, uid)
  17: char *file, *uid;
  18: {
  19:     static struct passwd *pwd;
  20:     struct passwd *getpwuid();
  21:     char mstr[40];
  22: 
  23:     sprintf(mstr, "uuclean deleted file %s\n", file);
  24:     if (pwd->pw_uid == uid) {
  25:         mailst(pwd->pw_name, mstr);
  26:     return(0);
  27:     }
  28: 
  29:     setpwent();
  30:     if ((pwd = getpwuid(uid)) != NULL) {
  31:         mailst(pwd->pw_name, mstr);
  32:     }
  33:     return(0);
  34: }
  35: 
  36: 
  37: /***
  38:  *	mailst(user, str)
  39:  *	char *user, *str;
  40:  *
  41:  *	mailst  -  this routine will fork and execute
  42:  *	a mail command sending string (str) to user (user).
  43:  */
  44: 
  45: mailst(user, str)
  46: char *user, *str;
  47: {
  48:     FILE *fp;
  49:     extern FILE *popen(), *pclose();
  50:     char cmd[100];
  51: 
  52:     sprintf(cmd, "mail %s", user);
  53:     if ((fp = popen(cmd, "w")) == NULL)
  54:         return;
  55:     fprintf(fp, "%s", str);
  56:     pclose(fp);
  57:     return;
  58: }

Defined functions

mailst defined in line 45; used 3 times
sdmail defined in line 16; used 1 times
Last modified: 1979-01-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 582
Valid CSS Valid XHTML 1.0 Strict