67 |
67 |
68 int main(int argc, char **argv) { |
68 int main(int argc, char **argv) { |
69 xmlGenericErrorFunc fnc = xmlerrorfnc; |
69 xmlGenericErrorFunc fnc = xmlerrorfnc; |
70 initGenericErrorDefaultFunc(&fnc); |
70 initGenericErrorDefaultFunc(&fnc); |
71 ctx = dav_context_new(); |
71 ctx = dav_context_new(); |
|
72 dav_add_namespace(ctx, "apache", "http://apache.org/dav/props/"); |
72 load_config(ctx); |
73 load_config(ctx); |
73 printxmlerror = 0; |
74 printxmlerror = 0; |
74 #ifdef DO_THE_TEST |
75 #ifdef DO_THE_TEST |
75 test(); |
76 test(); |
76 return 0; |
77 return 0; |
133 } else if(!strcasecmp(cmd, "add-repository")) { |
134 } else if(!strcasecmp(cmd, "add-repository")) { |
134 ret = cmd_add_repository(args); |
135 ret = cmd_add_repository(args); |
135 } else if(!strcasecmp(cmd, "list-repositories")) { |
136 } else if(!strcasecmp(cmd, "list-repositories")) { |
136 ret = list_repositories(); |
137 ret = list_repositories(); |
137 } else if(!strcasecmp(cmd, "version") || !strcasecmp(cmd, "-version") || !strcasecmp(cmd, "--version")) { |
138 } else if(!strcasecmp(cmd, "version") || !strcasecmp(cmd, "-version") || !strcasecmp(cmd, "--version")) { |
138 #ifdef DEBUG |
|
139 fprintf(stderr, "dav %s unstable\n", DAV_VERSION); |
|
140 #else |
|
141 fprintf(stderr, "dav %s\n", DAV_VERSION); |
139 fprintf(stderr, "dav %s\n", DAV_VERSION); |
142 #endif |
|
143 } else { |
140 } else { |
144 print_usage(argv[0]); |
141 print_usage(argv[0]); |
145 } |
142 } |
146 |
143 |
147 dav_context_destroy(ctx); |
144 dav_context_destroy(ctx); |
154 } |
151 } |
155 |
152 |
156 void print_usage(char *cmd) { |
153 void print_usage(char *cmd) { |
157 fprintf(stderr, "Usage: %s command [options] arguments...\n\n", cmd); |
154 fprintf(stderr, "Usage: %s command [options] arguments...\n\n", cmd); |
158 fprintf(stderr, "Commands:\n"); |
155 fprintf(stderr, "Commands:\n"); |
159 fprintf(stderr, " list [-altpcR] [-u <date>] <url>\n"); |
156 fprintf(stderr, " list [-altepcR] [-u <date>] <url>\n"); |
160 fprintf( |
157 fprintf( |
161 stderr, |
158 stderr, |
162 " get [-pcR] [-o <file>] [-u <date>] <url>\n"); |
159 " get [-pcR] [-o <file>] [-u <date>] <url>\n"); |
163 fprintf(stderr, " put [-pcR] [-k <key>] [-L <lock>] <url> <file>\n"); |
160 fprintf(stderr, " put [-pcR] [-k <key>] [-L <lock>] <url> <file>\n"); |
164 fprintf(stderr, " mkdir [-pc] [-k <key>] [-L <lock>] <url>\n"); |
161 fprintf(stderr, " mkdir [-pc] [-k <key>] [-L <lock>] <url>\n"); |
190 " -u <date> " |
187 " -u <date> " |
191 "Get resources which are modified since the specified date\n"); |
188 "Get resources which are modified since the specified date\n"); |
192 fprintf(stderr, " -a show all files\n"); |
189 fprintf(stderr, " -a show all files\n"); |
193 fprintf(stderr, " -l print resources in long list format\n"); |
190 fprintf(stderr, " -l print resources in long list format\n"); |
194 fprintf(stderr, " -t print content type\n"); |
191 fprintf(stderr, " -t print content type\n"); |
|
192 fprintf(stderr, " -e show extended flags\n"); |
195 fprintf(stderr, " -O override resources\n"); |
193 fprintf(stderr, " -O override resources\n"); |
196 fprintf(stderr, " -L <lock> specificy lock token\n"); |
194 fprintf(stderr, " -L <lock> specificy lock token\n"); |
197 fprintf(stderr, " -n <uri> specify namespace uri\n"); |
195 fprintf(stderr, " -n <uri> specify namespace uri\n"); |
|
196 fprintf(stderr, " -N disable authentication and key input (all commands)\n"); |
198 fprintf(stderr, " -i disable cert verification (all commands)\n"); |
197 fprintf(stderr, " -i disable cert verification (all commands)\n"); |
199 fprintf(stderr, " -v verbose output (all commands)\n"); |
198 fprintf(stderr, " -v verbose output (all commands)\n"); |
200 fprintf(stderr, "\n"); |
199 fprintf(stderr, "\n"); |
201 fprintf(stderr, "Config commands:\n"); |
200 fprintf(stderr, "Config commands:\n"); |
202 fprintf(stderr, " add-repository\n"); |
201 fprintf(stderr, " add-repository\n"); |
383 break; |
382 break; |
384 } |
383 } |
385 |
384 |
386 // parameters |
385 // parameters |
387 void (*print_func)(DavResource*, CmdArgs *); |
386 void (*print_func)(DavResource*, CmdArgs *); |
388 if(cmd_getoption(a, "list")) { |
387 if(cmd_getoption(a, "list") || cmd_getoption(a, "extended")) { |
389 print_func = ls_print_list_elm; |
388 print_func = ls_print_list_elm; |
390 } else { |
389 } else { |
391 print_func = ls_print_elm; |
390 print_func = ls_print_elm; |
392 } |
391 } |
393 |
392 |
520 DAV_NS, |
518 DAV_NS, |
521 "crypto-key"); |
519 "crypto-key"); |
522 if(keyprop) { |
520 if(keyprop) { |
523 flags[1] = 'c'; |
521 flags[1] = 'c'; |
524 } |
522 } |
525 if(dav_get_property(res, "D:lockdiscovery")) { |
523 |
526 flags[2] = 'l'; |
524 if(cmd_getoption(a, "extended")) { |
|
525 flags[6] = '\0'; |
|
526 if(dav_get_property(res, "D:lockdiscovery")) { |
|
527 flags[2] = 'l'; |
|
528 } |
|
529 char *executable = dav_get_property_ns( |
|
530 res, |
|
531 "http://apache.org/dav/props/", |
|
532 "executable"); |
|
533 if(executable && util_getboolean(executable)) { |
|
534 flags[3] = 'x'; |
|
535 } |
|
536 } else { |
|
537 flags[2] = '\0'; |
527 } |
538 } |
528 |
539 |
529 if(cmd_getoption(a, "type")) { |
540 if(cmd_getoption(a, "type")) { |
530 type_width = 20; |
541 type_width = 20; |
531 } |
542 } |