~vcs-imports/samba/main

« back to all changes in this revision

Viewing changes to examples/libsmbclient/get_auth_data_fn.h

  • Committer: jerry
  • Date: 2006-07-14 21:48:39 UTC
  • Revision ID: vcs-imports@canonical.com-20060714214839-586d8c489a8fcead
gutting trunk to move to svn:externals

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
static void
2
 
get_auth_data_fn(const char * pServer,
3
 
                 const char * pShare,
4
 
                 char * pWorkgroup,
5
 
                 int maxLenWorkgroup,
6
 
                 char * pUsername,
7
 
                 int maxLenUsername,
8
 
                 char * pPassword,
9
 
                 int maxLenPassword)
10
 
{
11
 
    char temp[128];
12
 
    
13
 
    fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
14
 
    fgets(temp, sizeof(temp), stdin);
15
 
    
16
 
    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
17
 
    {
18
 
        temp[strlen(temp) - 1] = '\0';
19
 
    }
20
 
    
21
 
    if (temp[0] != '\0')
22
 
    {
23
 
        strncpy(pWorkgroup, temp, maxLenWorkgroup - 1);
24
 
    }
25
 
    
26
 
    fprintf(stdout, "Username: [%s] ", pUsername);
27
 
    fgets(temp, sizeof(temp), stdin);
28
 
    
29
 
    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
30
 
    {
31
 
        temp[strlen(temp) - 1] = '\0';
32
 
    }
33
 
    
34
 
    if (temp[0] != '\0')
35
 
    {
36
 
        strncpy(pUsername, temp, maxLenUsername - 1);
37
 
    }
38
 
    
39
 
    fprintf(stdout, "Password: ");
40
 
    fgets(temp, sizeof(temp), stdin);
41
 
    
42
 
    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
43
 
    {
44
 
        temp[strlen(temp) - 1] = '\0';
45
 
    }
46
 
    
47
 
    if (temp[0] != '\0')
48
 
    {
49
 
        strncpy(pPassword, temp, maxLenPassword - 1);
50
 
    }
51
 
}