/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- main
1 #include <sys/types.h>
2 #include <dirent.h>
3 #include <errno.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include <libsmbclient.h>
7
8 int
9 main(int argc, char * argv[])
/* [<][>][^][v][top][bottom][index][help] */
10 {
11 char * p;
12 char buf[1024];
13 DIR * dir;
14 struct dirent * dirent;
15
16 setbuf(stdout, NULL);
17
18 for (fputs("path: ", stdout), p = fgets(buf, sizeof(buf), stdin);
19 p != NULL && *p != '\n' && *p != '\0';
20 fputs("path: ", stdout), p = fgets(buf, sizeof(buf), stdin))
21 {
22 if ((p = strchr(buf, '\n')) != NULL)
23 {
24 *p = '\0';
25 }
26
27 printf("Opening (%s)...\n", buf);
28
29 if ((dir = opendir(buf)) == NULL)
30 {
31 printf("Could not open directory [%s]: \n",
32 buf, strerror(errno));
33 continue;
34 }
35
36 while ((dirent = readdir(dir)) != NULL)
37 {
38 printf("%-30s", dirent->d_name);
39 printf("%-30s", dirent->d_name + strlen(dirent->d_name) + 1);
40 printf("\n");
41 }
42
43 closedir(dir);
44 }
45
46 exit(0);
47 }