home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / getpass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  1.6 KB  |  64 lines

  1. /* Copyright (C) 1991 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /* CHANGED FOR VMS */
  20.  
  21. /*
  22.  * <getpass.c>
  23.  */
  24.  
  25. #include "HTUtils.h"
  26. /*#include <stdio.h>  included by HTUtils.h -- FM */
  27. #include <descrip.h>
  28. #include <psldef.h>
  29. #include <iodef.h>
  30.  
  31. #include "LYLeaks.h"
  32.  
  33. char *getpass (const char *prompt)
  34. {
  35.   static char *buf;
  36.  
  37.   int result;
  38.   $DESCRIPTOR(devnam,"SYS$INPUT");
  39.   int chan;
  40.   int promptlen;
  41.   struct {
  42.      short result;
  43.      short count;
  44.      int   info;
  45.   } iosb;
  46.  
  47.   promptlen = strlen(prompt);
  48.  
  49.   buf = (char *)malloc(256);
  50.   if (buf == NULL)
  51.      return(NULL);  
  52.  
  53.   result = SYS$ASSIGN(&devnam, &chan, PSL$C_USER, 0, 0);
  54.  
  55.   result = SYS$QIOW(0, chan, IO$_READPROMPT | IO$M_PURGE |IO$M_NOECHO, &iosb, 0, 0,
  56.                     buf, 255, 0, 0, prompt, promptlen);
  57.  
  58.   buf[iosb.count] = '\0';
  59.  
  60.   result = SYS$DASSGN(chan);
  61.  
  62.   return buf;
  63. }
  64.