annotate rvinterf/etmsync/fsupload.c @ 732:a6f45d948d22

rr_attf.c compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 05 Oct 2014 02:53:52 +0000
parents 91570f916dd3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
297
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * upload-fs implementation
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 */
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <sys/param.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <sys/stat.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <dirent.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <ctype.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <stdio.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include <stdlib.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include <string.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #include <strings.h>
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "etm.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 #include "ffs.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 #include "ffserr.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 #include "tmffs2.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 #include "limits.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 #include "ffslimits.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 #include "localtypes.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 #include "localstruct.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 #include "exitcodes.h"
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 uploadfs_level(srcpath, depth, prefix)
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 char *srcpath, *prefix;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 char ffs_childpath[MAX_FULL_PATHNAME+1], *ffs_childp;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 DIR *rdd;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 struct dirent *dirent;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 char hostpath_child[MAXPATHLEN];
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 struct stat hst;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 int rc;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 strcpy(ffs_childpath, prefix);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 ffs_childp = index(ffs_childpath, '\0');
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 *ffs_childp++ = '/';
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 rdd = opendir(srcpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 if (!rdd) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 perror(srcpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 return(ERROR_UNIX);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 while (dirent = readdir(rdd)) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 if (dirent->d_name[0] == '.')
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 continue;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 if (strlen(dirent->d_name) > MAX_FN_COMPONENT) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 fprintf(stderr,
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 "error: \"%s\" in %s exceeds the FFS component name limit\n",
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 dirent->d_name, srcpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 return(ERROR_USAGE);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 if (strlen(srcpath) + strlen(dirent->d_name) + 2 >
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 sizeof hostpath_child) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 fprintf(stderr,
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 "error: host side pathname buffer overflow\n");
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 return(ERROR_UNIX);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 sprintf(hostpath_child, "%s/%s", srcpath, dirent->d_name);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 if (lstat(hostpath_child, &hst) < 0) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 perror(hostpath_child);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 return(ERROR_UNIX);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 strcpy(ffs_childp, dirent->d_name);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 switch (hst.st_mode & S_IFMT) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 case S_IFREG:
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 printf("uploading %s\n", ffs_childpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 rc = fwrite_from_file(ffs_childpath, hostpath_child);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 if (rc) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 return(rc);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 break;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 case S_IFDIR:
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 if (depth >= MAX_NAME_DEPTH-1) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 fprintf(stderr,
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 "error: directory nesting too deep at %s\n",
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 hostpath_child);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 return(ERROR_USAGE);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 printf("mkdir %s\n", ffs_childpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 rc = do_mkdir_existok(ffs_childpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 if (rc) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 return(rc);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 rc = uploadfs_level(hostpath_child, depth + 1,
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 ffs_childpath);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 if (rc) {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 return(rc);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 break;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 default:
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 fprintf(stderr,
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 "error: %s is neither a regular file nor a directory\n",
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 hostpath_child);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 return(ERROR_USAGE);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 closedir(rdd);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 return(0);
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 }
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 cmd_uploadfs(argc, argv)
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 char **argv;
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 {
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 return uploadfs_level(argv[1], 0, "");
0242d5facf7b fc-fsio: upload-fs implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 }
299
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
113
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
114 cmd_upload_file(argc, argv)
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
115 char **argv;
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
116 {
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
117 if (strlen(argv[2]) >= TMFFS_STRING_SIZE) {
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
118 fprintf(stderr,
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
119 "error: pathname arg exceeds string length limit\n");
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
120 return(ERROR_USAGE);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
121 }
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
122 return fwrite_from_file(argv[2], argv[1]);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
123 }
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
124
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
125 cmd_upload_subtree(argc, argv)
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
126 char **argv;
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
127 {
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
128 int rc, depth;
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
129
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
130 depth = validate_ffs_pathname(argv[2]);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
131 if (depth < 0)
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
132 return(ERROR_USAGE); /* error msg already printed */
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
133 if (depth == 0) {
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
134 fprintf(stderr, "please use upload-fs command instead\n");
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
135 return(ERROR_USAGE);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
136 }
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
137 if (depth >= MAX_NAME_DEPTH) {
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
138 fprintf(stderr, "cannot upload into max-depth directory\n");
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
139 return(ERROR_USAGE);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
140 }
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
141 printf("mkdir %s\n", argv[2]);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
142 rc = do_mkdir_existok(argv[2]);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
143 if (rc)
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
144 return(rc);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
145 return uploadfs_level(argv[1], depth, argv[2]);
91570f916dd3 fc-fsio: upload-file and upload-subtree implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 297
diff changeset
146 }