Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

get_auth_data_fn.h

Go to the documentation of this file.
00001 static void
00002 get_auth_data_fn(const char * pServer,
00003                  const char * pShare,
00004                  char * pWorkgroup,
00005                  int maxLenWorkgroup,
00006                  char * pUsername,
00007                  int maxLenUsername,
00008                  char * pPassword,
00009                  int maxLenPassword)
00010 {
00011     char temp[128];
00012     
00013     fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
00014     fgets(temp, sizeof(temp), stdin);
00015     
00016     if (temp[strlen(temp) - 1] == '\n') /* A new line? */
00017     {
00018         temp[strlen(temp) - 1] = '\0';
00019     }
00020     
00021     if (temp[0] != '\0')
00022     {
00023         strncpy(pWorkgroup, temp, maxLenWorkgroup - 1);
00024     }
00025     
00026     fprintf(stdout, "Username: [%s] ", pUsername);
00027     fgets(temp, sizeof(temp), stdin);
00028     
00029     if (temp[strlen(temp) - 1] == '\n') /* A new line? */
00030     {
00031         temp[strlen(temp) - 1] = '\0';
00032     }
00033     
00034     if (temp[0] != '\0')
00035     {
00036         strncpy(pUsername, temp, maxLenUsername - 1);
00037     }
00038     
00039     fprintf(stdout, "Password: ");
00040     fgets(temp, sizeof(temp), stdin);
00041     
00042     if (temp[strlen(temp) - 1] == '\n') /* A new line? */
00043     {
00044         temp[strlen(temp) - 1] = '\0';
00045     }
00046     
00047     if (temp[0] != '\0')
00048     {
00049         strncpy(pPassword, temp, maxLenPassword - 1);
00050     }
00051 }

© sourcejam.com 2005-2008