*** ph.c.orig	Tue Jun 22 00:00:01 1993
--- ph.c	Mon Aug 29 15:39:36 1994
***************
*** 89,96 ****
  #include "termdefs.h"		/*VMS defs for setterm() function */
  
  #else	/* !VMS */
! static char *rcsid = "$Date: 1993/06/22 13:41:41 $$Revision: 6.5 $";
! static char *srcid = "$Source: /usr/local/src/net/qi/ph/RCS/ph.c,v $";
  
  #include <stdio.h>
  #include <signal.h>
--- 89,96 ----
  #include "termdefs.h"		/*VMS defs for setterm() function */
  
  #else	/* !VMS */
! static char *rcsid = "$Date: 1994/08/29 13:39:24 $$Revision: 6.6 $";
! static char *srcid = "$Source: /home/ward/src/ph/RCS/ph.c,v $";
  
  #include <stdio.h>
  #include <signal.h>
***************
*** 217,222 ****
--- 217,223 ----
  char	*strtok();
  #endif /* __STDC__ */
  char	*getpass __P((const char *));
+ char	*getqpass __P((char *));
  char	*mktemp __P((char *));
  
  /*
***************
*** 272,277 ****
--- 273,279 ----
  int	NoPager = 0;		/*-m don't use pager */
  int	NoBeautify = 0;		/*-b don't beautify output */
  int	NoLabels = 0;		/*-l don't use labels */
+ int	Quiet = 0;		/*-q another program is running me, shh */
  int	Confirm = 0;		/*-c confirm Edit */
  char	*DefType = 0;		/*-t prepend this type to queries */
  char	*ReturnFields = NULL;	/*-f give list of fields */
***************
*** 763,774 ****
  	while (1)
  	{
  		(void) signal(SIGPIPE, SIG_IGN);
  #ifdef MACC_ECHO
! 		if (!maccecho)
! 			printf("%s> ", Me);
  #else
! 		printf("%s> ", Me);
  #endif
  		(void) fflush(stdout);	/*prompt */
  		spot = in_line;
  		do
--- 765,778 ----
  	while (1)
  	{
  		(void) signal(SIGPIPE, SIG_IGN);
+ 		if (!Quiet) {
  #ifdef MACC_ECHO
! 		    if (!maccecho)
! 			    printf("%s> ", Me);
  #else
! 		    printf("%s> ", Me);
  #endif
+ 		}
  		(void) fflush(stdout);	/*prompt */
  		spot = in_line;
  		do
***************
*** 783,790 ****
  		}
  		while (spot >= in_line);
  #ifdef MACC_ECHO
! 		if (maccecho)
  			printf("%s> %s", Me, in_line);
  #endif
  
  		if (!(LastCode = DoCommand(in_line))) /*is it a command we know? */
--- 787,796 ----
  		}
  		while (spot >= in_line);
  #ifdef MACC_ECHO
! 		if (!Quiet) {
! 		    if (maccecho)
  			printf("%s> %s", Me, in_line);
+ 		}
  #endif
  
  		if (!(LastCode = DoCommand(in_line))) /*is it a command we know? */
***************
*** 1189,1196 ****
  		else
  #endif
  		{
! 			password = MyPassword ? MyPassword :
  				getpass("Enter nameserver password: ");
  			if (strlen(password) > PH_PW_LEN)
  				*(password + PH_PW_LEN) = '\0';
  			crypt_start(password);
--- 1195,1207 ----
  		else
  #endif
  		{
! 			if (Quiet) {
! 			    password = MyPassword ? MyPassword :
! 				getqpass("Enter nameserver password: ");
! 			} else {
! 			    password = MyPassword ? MyPassword :
  				getpass("Enter nameserver password: ");
+ 			}
  			if (strlen(password) > PH_PW_LEN)
  				*(password + PH_PW_LEN) = '\0';
  			crypt_start(password);
***************
*** 1689,1694 ****
--- 1700,1706 ----
  	char	*in_line;
  {
  	char	password[80];
+ 	char	bpasswd[80];
  	char	*confirm;
  	char	*alias;
  	int	code = LR_ERROR;
***************
*** 1703,1720 ****
  		alias = MyAlias;
  
  	/*get the password */
! 	strcpy(password, getpass("Enter new password: "));
  	if (!*password)
  		return (LR_ERROR);
! 	confirm = getpass("Type it again: ");
! 	if (strlen(password) > PH_PW_LEN)
! 		*(password + PH_PW_LEN) = '\0';
! 	if (strlen(confirm) > PH_PW_LEN)
! 			*(confirm + PH_PW_LEN) = '\0';
! 	if (strcmp(confirm, password))
! 	{
! 		fprintf(stderr, "Sorry--passwords didn't match.\n");
! 		return (code);
  	}
  	VetPassword(confirm);	/*complain if we don't like the password */
  
--- 1715,1740 ----
  		alias = MyAlias;
  
  	/*get the password */
! 	if (Quiet) {
! 	    strcpy(password, getqpass("Enter new password: "));
! 	    strcpy(bpasswd, password);
! 	    confirm = bpasswd;
! 	} else {
! 	    strcpy(password, getpass("Enter new password: "));
! 	}
  	if (!*password)
  		return (LR_ERROR);
! 	if (!Quiet) {
! 	    confirm = getpass("Type it again: ");
! 	    if (strlen(password) > PH_PW_LEN)
! 		    *(password + PH_PW_LEN) = '\0';
! 	    if (strlen(confirm) > PH_PW_LEN)
! 			    *(confirm + PH_PW_LEN) = '\0';
! 	    if (strcmp(confirm, password))
! 	    {
! 		    fprintf(stderr, "Sorry--passwords didn't match.\n");
! 		    return (code);
! 	    }
  	}
  	VetPassword(confirm);	/*complain if we don't like the password */
  
***************
*** 2005,2013 ****
  
  	printf(prompt);
  	(void) fflush(stdout);	/*prompt */
! 	setterm(&echo, &off);
  	gets(line);
! 	setterm(&echo, &on);
  	puts("");
  	return (line);
  }
--- 2025,2037 ----
  
  	printf(prompt);
  	(void) fflush(stdout);	/*prompt */
! 	if (!Quiet) {
! 	    setterm(&echo, &off);
! 	}
  	gets(line);
! 	if (!Quiet) {
! 	    setterm(&echo, &on);
! 	}
  	puts("");
  	return (line);
  }
***************
*** 2015,2020 ****
--- 2039,2056 ----
  #endif
  
  /*
+  * if quiet, we need stdin.. (This is really stupid)
+  */
+ char	*
+ getqpass(prompt)
+ 	char	*prompt;
+ {
+ 	static char line[12];
+ 	gets(line);
+ 	return (line);
+ }
+ 
+ /*
   * use .netrc to login to nameserver, if possible
   */
  void 
***************
*** 2291,2296 ****
--- 2327,2338 ----
  				break;
  			case 'h':
  				JustHelp = 1;
+ 				break;
+ 			case 'q':
+ 				Quiet = 1;
+ 				break;
+ 			case 'Q':
+ 				Quiet = 0;
  				break;
  			case 's':
  				if (argv[0][1])
