Changeset 988 for vendor/current/examples/libsmbclient/testbrowse.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/examples/libsmbclient/testbrowse.c
r414 r988 10 10 #include "get_auth_data_fn.h" 11 11 12 static void13 no_auth_data_fn(const char * pServer,14 const char * pShare,15 char * pWorkgroup,16 int maxLenWorkgroup,17 char * pUsername,18 int maxLenUsername,19 char * pPassword,20 int maxLenPassword);21 22 12 static void browse(char * path, 23 13 int scan, … … 36 26 int maxLenPassword); 37 27 38 int 39 main(int argc, char * argv[]) 28 int main(int argc, const char *argv[]) 40 29 { 41 30 int debug = 0; … … 45 34 int scan = 0; 46 35 int iterations = -1; 47 int again;48 36 int opt; 49 37 char * p; 50 char * q;51 38 char buf[1024]; 52 39 poptContext pc; … … 86 73 setbuf(stdout, NULL); 87 74 88 pc = poptGetContext("opendir", argc, (const char **)argv, long_options, 0);75 pc = poptGetContext("opendir", argc, argv, long_options, 0); 89 76 90 77 poptSetOtherOptionHelp(pc, ""); … … 113 100 smbc_setFunctionAuthDataWithContext(context, 114 101 get_auth_data_with_context_fn); 115 smbc_setOptionUserData(context, "hello world");102 smbc_setOptionUserData(context, strdup("hello world")); 116 103 } else { 117 104 smbc_setFunctionAuthData(context, get_auth_data_fn); … … 139 126 if (scan) 140 127 { 141 for (; 142 iterations == -1 || iterations > 0; 143 iterations = (iterations == -1 ? iterations : --iterations)) 144 { 128 for (; iterations != 0;) { 129 if (iterations > 0) { 130 iterations--; 131 } 132 145 133 snprintf(buf, sizeof(buf), "smb://"); 146 134 browse(buf, scan, 0); … … 149 137 else 150 138 { 151 for (; 152 iterations == -1 || iterations > 0; 153 iterations = (iterations == -1 ? iterations : --iterations)) 154 { 139 for (; iterations != 0;) { 140 if (iterations > 0) { 141 iterations--; 142 } 143 155 144 fputs("url: ", stdout); 156 145 p = fgets(buf, sizeof(buf), stdin); … … 171 160 exit(0); 172 161 } 173 174 175 static void176 no_auth_data_fn(const char * pServer,177 const char * pShare,178 char * pWorkgroup,179 int maxLenWorkgroup,180 char * pUsername,181 int maxLenUsername,182 char * pPassword,183 int maxLenPassword)184 {185 return;186 }187 188 162 189 163 static void … … 214 188 char buf[1024]; 215 189 int dir; 216 struct stat st at;190 struct stat st; 217 191 struct smbc_dirent * dirent; 218 192 … … 269 243 strcat(p, "/"); 270 244 strcat(p+1, dirent->name); 271 if (smbc_stat(path, &st at) < 0)245 if (smbc_stat(path, &st) < 0) 272 246 { 273 247 printf(" unknown size (reason %d: %s)", … … 276 250 else 277 251 { 278 printf(" size %lu", (unsigned long) st at.st_size);252 printf(" size %lu", (unsigned long) st.st_size); 279 253 } 280 254 *p = '\0';
Note:
See TracChangeset
for help on using the changeset viewer.