Changeset 610 for trunk/user
- Timestamp:
- Dec 27, 2018, 7:38:58 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/ksh/ksh.c
r608 r610 55 55 56 56 #define MAIN_DEBUG 0 57 58 #define CMD_CAT_DEBUG 0 59 #define CMD_CP_DEBUG 0 57 60 #define CMD_LOAD_DEBUG 0 58 #define CMD_CAT_DEBUG 059 61 60 62 ////////////////////////////////////////////////////////////////////////////////////////// … … 209 211 path = argv[1]; 210 212 211 printf(" error: not implemented yet\n" ); 213 // call the relevant syscall 214 if( chdir( path ) ) 215 { 216 printf(" error: cannot found <%s> directory\n", path ); 217 } 212 218 } 213 219 … … 250 256 } 251 257 258 #if CMD_CP_DEBUG 259 long long unsigned cycle; 260 get_cycle( &cycle ); 261 printf("\n[%s] open file <%s> done / cycle %d\n", 262 __FUNCTION__ , srcpath , (int)cycle ); 263 #endif 264 252 265 // get file stats 253 266 if ( stat( srcpath , &st ) ) … … 258 271 } 259 272 273 #if CMD_CP_DEBUG 274 get_cycle( &cycle ); 275 printf("\n[%s] stats file <%s> done / cycle %d\n", 276 __FUNCTION__ , srcpath , (int)cycle ); 277 #endif 278 260 279 if ( S_ISDIR(st.st_mode) ) 261 280 { … … 277 296 } 278 297 298 #if CMD_CP_DEBUG 299 get_cycle( &cycle ); 300 printf("\n[%s] open file <%s> done / cycle %d\n", 301 __FUNCTION__ , dstpath , (int)cycle ); 302 #endif 303 279 304 if ( stat( dstpath , &st ) ) 280 305 { … … 282 307 goto exit; 283 308 } 309 310 #if CMD_CP_DEBUG 311 get_cycle( &cycle ); 312 printf("\n[%s] stats file <%s> done / cycle %d\n", 313 __FUNCTION__ , dstpath , (int)cycle ); 314 #endif 284 315 285 316 if ( S_ISDIR(st.st_mode ) ) … … 302 333 } 303 334 335 #if CMD_CP_DEBUG 336 get_cycle( &cycle ); 337 printf("\n[%s] %d bytes read from <%s> / cycle %d\n", 338 __FUNCTION__ , len, srcpath , (int)cycle ); 339 #endif 340 304 341 // write to the destination 305 342 if ( write( dst_fd , buf , len ) != len ) … … 308 345 goto exit; 309 346 } 347 348 #if CMD_CP_DEBUG 349 get_cycle( &cycle ); 350 printf("\n[%s] %d bytes writen to <%s> / cycle %d\n", 351 __FUNCTION__ , len, dstpath , (int)cycle ); 352 #endif 310 353 311 354 bytes += len; … … 733 776 pathname = argv[1]; 734 777 735 printf(" error: not implemented yet\n");778 mkdir( pathname , 0x777 ); 736 779 } 737 780 … … 744 787 static void cmd_mv( int argc , char **argv ) 745 788 { 746 747 if (argc < 3) 748 { 749 printf(" usage : mv src_pathname dst_pathname\n"); 789 char * old_path; 790 char * new_path; 791 792 if (argc != 3) 793 { 794 printf(" usage: mv old_pathname new_pathname\n"); 750 795 } 751 796 else 752 797 { 753 printf(" error: not implemented yet\n"); 754 } 755 798 old_path = argv[1]; 799 new_path = argv[2]; 800 801 // call the relevant syscall 802 if( rename( old_path , new_path ) ) 803 { 804 printf(" error: unable to rename <%s> to <%s>\n", old_path, new_path ); 805 } 806 } 807 756 808 // release semaphore to get next command 757 809 sem_post( &semaphore ); … … 996 1048 997 1049 998 / * To lauch one application without interactive mode1050 // To lauch one command without interactive mode 999 1051 1000 1052 if( sem_wait( &semaphore ) ) … … 1005 1057 else 1006 1058 { 1007 printf("\n[ksh] for fft\n");1059 printf("\n[ksh] cp /home/Makefile /home/bloup\n"); 1008 1060 } 1009 1061 1010 strcpy( buf , " load /bin/user/fft.elf" );1062 strcpy( buf , "cp /home/Makefile /home/bloup" ); 1011 1063 parse( buf ); 1012 1064 1013 */1065 // 1014 1066 1015 1067 enum fsm_states
Note: See TracChangeset
for help on using the changeset viewer.