dav/main.c

changeset 271
7b1ca53f3897
parent 270
0edfb4c0e7f8
child 297
3cbe57eeaed1
equal deleted inserted replaced
270:0edfb4c0e7f8 271:7b1ca53f3897
788 return ret; 788 return ret;
789 } 789 }
790 790
791 int put_entry(Repository *repo, CmdArgs *a, DavSession *sn, char *path, char *file, DavBool root) { 791 int put_entry(Repository *repo, CmdArgs *a, DavSession *sn, char *path, char *file, DavBool root) {
792 int recursive = cmd_getoption(a, "recursive") ? 1 : 0; 792 int recursive = cmd_getoption(a, "recursive") ? 1 : 0;
793 if(recursive && !root) {
794 printf("put: %s\n", file);
795 }
796 struct stat s; 793 struct stat s;
797 if(stat(file, &s)) { 794 if(stat(file, &s)) {
798 perror("stat"); 795 perror("stat");
799 fprintf(stderr, "cannot stat file %s\n", file); 796 fprintf(stderr, "cannot stat file %s\n", file);
800 return -1; 797 return -1;
807 stderr, 804 stderr,
808 "%s is a directory.\nUse the -R option to upload directories.", 805 "%s is a directory.\nUse the -R option to upload directories.",
809 file); 806 file);
810 return 1; 807 return 1;
811 } 808 }
809
810 if(!root) {
811 printf("mkcol: %s\n", file);
812 }
813
812 DIR *dir = opendir(file); 814 DIR *dir = opendir(file);
813 if(!dir) { 815 if(!dir) {
814 // error 816 // error
815 } 817 }
816 struct dirent *entry; 818 struct dirent *entry;
844 } 846 }
845 } 847 }
846 dav_resource_free(res); 848 dav_resource_free(res);
847 } 849 }
848 } else if(S_ISREG(s.st_mode)) { 850 } else if(S_ISREG(s.st_mode)) {
851 if(recursive) {
852 printf("put: %s\n", file);
853 }
854
849 /* 855 /*
850 * use stdin if the input file is - 856 * use stdin if the input file is -
851 */ 857 */
852 FILE *in = fopen(file, "rb"); 858 FILE *in = fopen(file, "rb");
853 if(!in) { 859 if(!in) {

mercurial