Changeset 4376
- Timestamp:
- 09/20/06 17:59:33 (2 years ago)
- Files:
-
- wire/trunk/wire/commands.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wire/trunk/wire/commands.c
r4375 r4376 130 130 { "comment", 131 131 true, "<path> <comment>", 132 true, 1, 1, WR_COMPLETER_FILENAME,132 true, 1, -1, WR_COMPLETER_FILENAME, 133 133 wr_cmd_comment }, 134 134 { "connect", … … 202 202 { "mkdir", 203 203 true, "<path>", 204 true, 1, 0, WR_COMPLETER_FILENAME,204 true, 1, -1, WR_COMPLETER_FILENAME, 205 205 wr_cmd_mkdir }, 206 206 { "move", … … 620 620 static void wr_cmd_comment(wi_array_t *arguments) { 621 621 wi_string_t *path, *comment; 622 623 path = wr_files_full_path(WI_ARRAY(arguments, 0)); 624 comment = wi_array_count(arguments) == 1 ? WI_STR("") : WI_ARRAY(arguments, 1); 625 626 wr_send_command(WI_STR("COMMENT %#@%c%#@"), 627 path, WR_FIELD_SEPARATOR, 628 comment); 622 uint32_t i, count; 623 624 count = wi_array_count(arguments); 625 626 if(count == 1) { 627 path = wr_files_full_path(WI_ARRAY(arguments, 0)); 628 comment = WI_STR(""); 629 630 wr_send_command(WI_STR("COMMENT %#@%c%#@"), 631 path, WR_FIELD_SEPARATOR, 632 comment); 633 } else { 634 comment = wi_array_last_data(arguments); 635 636 for(i = 0; i < count - 1; i++) { 637 path = wr_files_full_path(WI_ARRAY(arguments, i)); 638 639 wr_send_command(WI_STR("COMMENT %#@%c%#@"), 640 path, WR_FIELD_SEPARATOR, 641 comment); 642 } 643 } 629 644 } 630 645 … … 920 935 921 936 static void wr_cmd_mkdir(wi_array_t *arguments) { 922 wi_string_t *path; 923 924 path = wr_files_full_path(WI_ARRAY(arguments, 0)); 925 926 wr_send_command(WI_STR("FOLDER %#@"), path); 937 uint32_t i, count; 938 939 count = wi_array_count(arguments); 940 941 for(i = 0; i < count; i++) 942 wr_send_command(WI_STR("FOLDER %#@"), wr_files_full_path(WI_ARRAY(arguments, i))); 927 943 } 928 944 … … 973 989 974 990 static void wr_cmd_mv(wi_array_t *arguments) { 975 wi_string_t *from, *to; 976 977 from = wr_files_full_path(WI_ARRAY(arguments, 0)); 978 to = wr_files_full_path(WI_ARRAY(arguments, 1)); 979 980 wr_send_command(WI_STR("MOVE %#@%c%#@"), 981 from, WR_FIELD_SEPARATOR, 982 to); 991 wi_string_t *frompath, *topath; 992 uint32_t i, count; 993 994 count = wi_array_count(arguments); 995 996 if(count == 2) { 997 frompath = wr_files_full_path(WI_ARRAY(arguments, 0)); 998 topath = wr_files_full_path(WI_ARRAY(arguments, 1)); 999 1000 wr_send_command(WI_STR("MOVE %#@%c%#@"), 1001 frompath, WR_FIELD_SEPARATOR, 1002 topath); 1003 } else { 1004 topath = wr_files_full_path(wi_array_last_data(arguments)); 1005 1006 for(i = 0; i < count - 1; i++) { 1007 frompath = wr_files_full_path(WI_ARRAY(arguments, i)); 1008 1009 wr_send_command(WI_STR("MOVE %#@%c%#@/%#@"), 1010 frompath, WR_FIELD_SEPARATOR, 1011 topath, wi_string_last_path_component(frompath)); 1012 } 1013 } 983 1014 } 984 1015 … … 1205 1236 1206 1237 static void wr_cmd_rm(wi_array_t *arguments) { 1207 wi_string_t *path; 1208 1209 path = wr_files_full_path(WI_ARRAY(arguments, 0)); 1210 1211 wr_send_command(WI_STR("DELETE %#@"), path); 1238 uint32_t i, count; 1239 1240 count = wi_array_count(arguments); 1241 1242 for(i = 0; i < count; i++) 1243 wr_send_command(WI_STR("DELETE %#@"), wr_files_full_path(WI_ARRAY(arguments, i))); 1212 1244 } 1213 1245 … … 1353 1385 1354 1386 for(i = 0; i < count; i++) 1355 wr_send_command(WI_STR("STAT % @"), wr_files_full_path(WI_ARRAY(arguments, i)));1387 wr_send_command(WI_STR("STAT %#@"), wr_files_full_path(WI_ARRAY(arguments, i))); 1356 1388 } 1357 1389 … … 1457 1489 wi_string_t *path, *string; 1458 1490 wr_file_type_t type; 1459 1460 path = wr_files_full_path(WI_ARRAY(arguments, 0)); 1461 string = WI_ARRAY(arguments, 1);1491 uint32_t i, count; 1492 1493 string = wi_array_last_data(arguments); 1462 1494 1463 1495 if(wi_is_equal(string, WI_STR("folder"))) … … 1472 1504 return; 1473 1505 } 1474 1475 wr_send_command(WI_STR("TYPE %#@%c%u"), 1476 path, WR_FIELD_SEPARATOR, 1477 type); 1506 1507 count = wi_array_count(arguments); 1508 1509 for(i = 0; i < count - 1; i++) { 1510 path = wr_files_full_path(WI_ARRAY(arguments, i)); 1511 1512 wr_send_command(WI_STR("TYPE %#@%c%u"), 1513 path, WR_FIELD_SEPARATOR, 1514 type); 1515 } 1478 1516 } 1479 1517
