5 #include <libsmbclient.h>
8 get_auth_data_fn(const char * pServer,
20 printf("Entered get_auth_data_fn\n");
22 fprintf(stdout, "Need password for //%s/%s\n", pServer, pShare);
24 fprintf(stdout, "Username: [%s] ", pUsername);
25 fgets(temp, sizeof(temp), stdin);
27 if (temp[strlen(temp) - 1] == '\n') /* A new line? */
29 temp[strlen(temp) - 1] = '\0';
34 strncpy(pUsername, temp, maxLenUsername - 1);
37 strcpy(temp, getpass("Password: "));
39 if (temp[strlen(temp) - 1] == '\n') /* A new line? */
41 temp[strlen(temp) - 1] = '\0';
46 strncpy(pPassword, temp, maxLenPassword - 1);
49 fprintf(stdout, "Workgroup: ");
50 fgets(temp, sizeof(temp), stdin);
52 if (temp[strlen(temp) - 1] == '\n') /* A new line? */
54 temp[strlen(temp) - 1] = '\0';
59 strncpy(pWorkgroup, temp, maxLenWorkgroup - 1);
67 int main(int argc, char * argv[])
70 char * pSmbPath = NULL;
71 char * pLocalPath = NULL;
76 pSmbPath = "smb://RANDOM/Public/small";
77 pLocalPath = "/random/home/samba/small";
92 "%s [ smb://path/to/file [ /nfs/or/local/path/to/file ] ]\n",
97 smbc_init(get_auth_data_fn, 0);
99 int ret = smbc_stat(pSmbPath, &st);
101 printf("SAMBA\nret=%d,\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n", ret,
102 st.st_mtime, ctime(&st.st_mtime),
103 st.st_ctime, ctime(&st.st_ctime),
104 st.st_atime, ctime(&st.st_atime));
106 if (pLocalPath != NULL)
108 ret = stat(pLocalPath, &st);
110 printf("LOCAL\nret=%d,\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n", ret,
111 st.st_mtime, ctime(&st.st_mtime),
112 st.st_ctime, ctime(&st.st_ctime),
113 st.st_atime, ctime(&st.st_atime));