Diff
Not logged in

Differences From:

File src/user.c part of check-in [6607844a01] - Added options to the "timeline" CLI command. Additional help comments. by drh on 2007-08-18 11:42:24. [view]

To:

File src/user.c part of check-in [83c876b447] - Win32 port: compiles, all tests pass but many functions fail due to path separators. Incomplete. Path fixes to come next by anonymous on 2007-09-21 21:53:28. Also file src/user.c part of check-in [3c5482959c] - Merge in the w32 changes. by drh on 2007-09-22 19:43:55. [view]

@@ -45,8 +45,48 @@
     if( z[i]<' ' ) z[i] = ' ';
   }
   blob_append(pBlob, z, -1);
 }
+
+#ifdef __MINGW32__
+/*
+** getpass for Windows
+*/
+static char *getpass(const char *prompt){
+  static char pwd[64];
+  size_t i;
+
+  fputs(prompt,stderr);
+  fflush(stderr);
+  for(i=0; i<sizeof(pwd)-1; ++i){
+    pwd[i] = _getch();
+    if(pwd[i]=='\r' || pwd[i]=='\n'){
+      break;
+    }
+    /* BS or DEL */
+    else if(i>0 && (pwd[i]==8 || pwd[i]==127)){
+      i -= 2;
+      continue;
+    }
+    /* CTRL-C */
+    else if(pwd[i]==3) {
+      i=0;
+      break;
+    }
+    /* ESC */
+    else if(pwd[i]==27){
+      i=0;
+      break;
+    }
+    else{
+      fputc('*',stderr);
+    }
+  }
+  pwd[i]='\0';
+  fputs("\n", stderr);
+  return pwd;
+}
+#endif
 
 /*
 ** Do a single prompt for a passphrase.  Store the results in the blob.
 */