3 * POSIX/UNIX functions not provided by Win32 platform
4 * and declared in <unistd.h> header file
12 #include <sys/socket.h> /* This does: #include <windows.h> */
14 /* Please order functions by name if possible */
19 getpass (const char *prompt)
21 static char pwd_buf[128];
24 fputs (prompt, stderr);
26 for (i = 0; i < sizeof (pwd_buf) - 1; ++i)
28 pwd_buf[i] = _getch ();
29 if (pwd_buf[i] == '\r')
39 /* This is just a call to GetCurrentProcessID */
43 return (pid_t) GetCurrentProcessId();
48 unsigned int sleep (unsigned seconds)
57 * Sleep at least some number of microseconds
59 int usleep (useconds_t microseconds)
63 const useconds_t one_second = 1000000;
64 struct timeval tv_delay;
66 tv_delay.tv_sec = microseconds / one_second;
67 tv_delay.tv_usec = microseconds % one_second;
68 return select (0, NULL, NULL, NULL, &tv_delay);