date and time created 83/08/05 13:35:19 by sam
[unix-history] / usr / src / old / berknet / sub.c
index 2708cdd..0ab8fb4 100644 (file)
@@ -1,4 +1,4 @@
-static char sccsid[] = "@(#)sub.c      4.4     (Berkeley)      %G%";
+static char sccsid[] = "@(#)sub.c      4.5     (Berkeley)      %G%";
 
 /*
        sub.c
 
 /*
        sub.c
@@ -90,43 +90,41 @@ promptlogin(mchto)
        char buf[BUFSIZ], mch;
        FILE *wf;
        int c;
        char buf[BUFSIZ], mch;
        FILE *wf;
        int c;
-       if(status.mpasswd[0] == 0 || status.login[0] == 0 || status.force){
+       if(status.login[0]==0 || status.force){
+               buf[0] = 0;
                wf = fopen("/dev/tty","r");
                if(wf != NULL){
                wf = fopen("/dev/tty","r");
                if(wf != NULL){
-                       if(status.login[0]==0 || status.force){
-                               fprintf(stderr,"Name (%s:%s): ",longname(mchto),
-                                       status.localname);
-                               if(fgets(buf, BUFSIZ, wf) != buf){
-                                       perror("fgets");
-                                       exit(EX_OSERR);
-                                       }
-                               c = strlen(buf);
-                               buf[c > 0 ? c-1 : 0] = 0;
-                               if(c > 10){
-                                       err("Login name too long.\n");
-                                       exit(EX_USAGE);
-                                       }
-                               if(FMemberSCh(buf,' ')){
-                                       err("Login names don't have blanks in them.\n");
-                                       exit(EX_USAGE);
-                                       }
-                               if(buf[0] == 0)strcpy(buf,status.localname);
-                               mch = MchSFromAddr(status.login,buf);
-                               if(mch != local && mch != mchto){
-                                       err(
-                               "Must specify login name on %s machine\n",
-                                               longname(mchto));
-                                       exit(EX_USAGE);
+                       fprintf(stderr,"Name (%s:%s): ",longname(mchto),
+                               status.localname);
+                       if(fgets(buf, BUFSIZ, wf) != buf){
+                               perror("fgets");
+                               exit(EX_OSERR);
                                }
                                }
-                       }
-                       if(strcmp(status.login,"network") != 0
-                               && (status.mpasswd[0]== 0 || status.force)){
-                               sprintf(buf,"Password (%s:%s):",
-                                       longname(mchto), status.login);
-                               strcpy(status.mpasswd,getpass(buf));
+                       c = strlen(buf);
+                       buf[c > 0 ? c-1 : 0] = 0;
+                       if(c > 10){
+                               err("Login name too long.\n");
+                               exit(EX_USAGE);
+                               }
+                       if(FMemberSCh(buf,' ')){
+                               err("Login names don't have blanks in them.\n");
+                               exit(EX_USAGE);
                                }
                        fclose(wf);
                        }
                                }
                        fclose(wf);
                        }
+               if(buf[0] == 0)strcpy(buf,status.localname);
+               mch = MchSFromAddr(status.login,buf);
+               if(mch != local && mch != mchto){
+                       err("Must specify login name on %s machine\n",
+                               longname(mchto));
+                       exit(EX_USAGE);
+                       }
+               }
+       if(strcmp(status.login,"network") != 0
+               && (status.mpasswd[0]== 0 || status.force)){
+               sprintf(buf,"Password (%s:%s):",
+                       longname(mchto), status.login);
+               strcpy(status.mpasswd,getpass(buf));
                }
        if(status.login[0] == 0) strcpy(status.login,status.localname);
        if(status.mpasswd[0] == 0)strcpy(status.mpasswd,"\"\"");
                }
        if(status.login[0] == 0) strcpy(status.login,status.localname);
        if(status.mpasswd[0] == 0)strcpy(status.mpasswd,"\"\"");
@@ -174,11 +172,11 @@ int cautious, hopcnt;
                        /* by convention, MAILFWD1 may forward this mail
                           and response messages shouldn't be forwarded */
                        if(!cautious && !FMemberSCh(toaddress,'/')){
                        /* by convention, MAILFWD1 may forward this mail
                           and response messages shouldn't be forwarded */
                        if(!cautious && !FMemberSCh(toaddress,'/')){
-# ifdef DELIVERM
-                               mexecl("/etc/delivermail",
-                                       "delivermail", "-ee", "-r", fromaddress,
+# ifdef SENDMAIL
+                               mexecl("/usr/lib/sendmail",
+                                       "sendmail", "-oee", "-r", fromaddress,
                                        "-h",shopcnt, toaddress, 0);
                                        "-h",shopcnt, toaddress, 0);
-# endif
+# endif SENDMAIL
                                mexecl(MAILFWD1, "mail","-r",fromaddress,
                                        "-h",shopcnt,toaddress,0);
                        }
                                mexecl(MAILFWD1, "mail","-r",fromaddress,
                                        "-h",shopcnt,toaddress,0);
                        }
@@ -186,9 +184,9 @@ int cautious, hopcnt;
                                "-h", shopcnt,toaddress,0);
                } else {
                        if(!cautious && !FMemberSCh(toaddress,'/')){
                                "-h", shopcnt,toaddress,0);
                } else {
                        if(!cautious && !FMemberSCh(toaddress,'/')){
-# ifdef DELIVERM
-                               mexecl("/etc/delivermail",
-                                       "delivermail", "-ee", "-h", shopcnt,
+# ifdef SENDMAIL
+                               mexecl("/usr/lib/sendmail",
+                                       "sendmail", "-ee", "-h", shopcnt,
                                        toaddress, 0);
 # endif
                                mexecl(MAILFWD1, "mail","-h", shopcnt,
                                        toaddress, 0);
 # endif
                                mexecl(MAILFWD1, "mail","-h", shopcnt,