home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / cvs-1.8.7-src.tgz / tar.out / fsf / cvs / windows-NT / win32.c < prev   
C/C++ Source or Header  |  1996-09-28  |  970b  |  66 lines

  1. /*
  2.  * win32.c
  3.  * - utility functions for cvs under win32
  4.  *
  5.  */
  6.  
  7. #include <ctype.h>
  8. #include <stdio.h>
  9. #include <conio.h>
  10.  
  11. #define WIN32_LEAN_AND_MEAN
  12. #include <windows.h>
  13.  
  14. #include <config.h>
  15.  
  16. unsigned sleep(unsigned seconds)
  17. {
  18.     Sleep(1000*seconds);
  19.     return 0;
  20. }
  21.  
  22. #if 0
  23. /* This is available from the WinSock library.  */
  24. int gethostname(char* name, int namelen)
  25. {
  26.     DWORD dw = namelen;
  27.     BOOL ret = GetComputerName(name, &dw);
  28.     namelen = dw;
  29.     return (ret) ? 0 : -1;
  30. }
  31. #endif
  32.  
  33. char* win32getlogin()
  34. {
  35.     static char name[256];
  36.     DWORD dw = 256;
  37.     GetUserName(name, &dw);
  38.     return name;
  39. }
  40.  
  41.  
  42. pid_t
  43. getpid ()
  44. {
  45.     return (pid_t) GetCurrentProcessId();
  46. }
  47.  
  48. char *
  49. getpass (const char *prompt)
  50. {
  51.     static char pwd_buf[128];
  52.     size_t i;
  53.  
  54.     fputs (prompt, stderr);
  55.     fflush (stderr);
  56.     for (i = 0; i < sizeof (pwd_buf) - 1; ++i)
  57.     {
  58.     pwd_buf[i] = _getch ();
  59.     if (pwd_buf[i] == '\r')
  60.         break;
  61.     }
  62.     pwd_buf[i] = '\0';
  63.     fputs ("\n", stderr);
  64.     return pwd_buf;
  65. }
  66.