Ignore:
Timestamp:
2009-04-27T17:37:46+12:00 (15 years ago)
Author:
davidb
Message:

Initial support for Windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/common-src/src/getpw/getpw.cpp

    r18493 r19275  
    3030#include "gsdlconf.h"
    3131
    32 // use the standard namespace
    33 #if !defined (GSDL_NAMESPACE_BROKEN)
    34 #if defined(GSDL_USE_OBJECTSPACE)
    35 using namespace ospace::std;
    36 #else
    37 using namespace std;
    38 #endif
    39 #endif
    40 
    4132
    4233// include crypt
     
    6657#endif
    6758
     59// use the standard namespace
     60#if !defined (GSDL_NAMESPACE_BROKEN)
     61#if defined(GSDL_USE_OBJECTSPACE)
     62using namespace ospace::std;
     63#else
     64using namespace std;
     65#endif
     66#endif
     67
     68
    6869#include <string.h>
    69 #include <pwd.h>
     70//#include <pwd.h>
     71
    7072
    7173int main (int argc, char *argv[]) {
    7274
    7375  int password_ok = 0;
    74   char c[10];
     76  char c[129];
    7577  int i;
    7678 
    7779  for (i=0; i<3; i++)  {
     80#if defined(__WIN32__)
     81    cout << "Enter password  (will appear on screen): ";
     82    char a[129];
     83    cin.getline(a, 128);
     84#else
    7885    char *a = getpass("Enter password:");
     86#endif
     87
    7988    int len = strlen (a);
    8089    if (len < 3 || len > 128) {
     
    8594    strcpy (c, a);
    8695
     96#if defined(__WIN32__)
     97    cout << "Re-enter password: ";
     98    char b[129];
     99    cin.getline(b, 128);
     100#else
    87101    char *b = getpass("Re-enter password:"); 
     102#endif
    88103
    89104    if ((strcmp (c, b)) == 0) {
Note: See TracChangeset for help on using the changeset viewer.