- Timestamp:
- 08/07/08 20:49:09 (4 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
apps/obexftp.c (modified) (23 diffs)
-
obexftp/client.c (modified) (2 diffs)
-
obexftp/obexftp.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/apps/obexftp.c
r222 r223 75 75 76 76 case OBEXFTP_EV_ERR: 77 // OBEX_EV_REQDONE: obex_rsp=43 (SE user reject) 77 78 fprintf(stderr, "failed: %s\n", msg); 78 79 break; … … 261 262 fprintf(stderr, "Error opening obexftp-client\n"); 262 263 exit(1); 263 //return FALSE;264 //return -1; 264 265 } 265 266 if (!use_conn) { … … 282 283 #endif 283 284 if (ret >= 0) 284 return TRUE;285 return ret; 285 286 switch (errno) { 286 287 … … 291 292 case ECONNREFUSED: 292 293 perror("The user may have rejected the transfer"); 293 return FALSE;294 return -errno; 294 295 295 296 case EHOSTDOWN: … … 311 312 obexftp_close(cli); 312 313 cli = NULL; 313 return FALSE;314 return ret; 314 315 } 315 316 … … 318 319 { 319 320 if (cli != NULL) { 320 return TRUE;321 return 0; 321 322 } 322 323 … … 326 327 // we should free() the find_bt result at some point 327 328 } 328 if ( !cli_connect_uuid(use_uuid, use_uuid_len))329 if (cli_connect_uuid(use_uuid, use_uuid_len) < 0) 329 330 exit(1); 330 331 331 return TRUE;332 return 0; 332 333 } 333 334 … … 347 348 int rsp[10]; 348 349 349 if ( !cli_connect_uuid(uuid, uuid_len)) {350 if (cli_connect_uuid(uuid, uuid_len) < 0) { 350 351 printf("couldn't connect.\n"); 351 352 return; … … 437 438 int main(int argc, char *argv[]) 438 439 { 439 int verbose =0;440 int verbose = 0; 440 441 int most_recent_cmd = 0; 441 442 char *output_file = NULL; 442 443 char *move_src = NULL; 444 int ret = 0; 443 445 444 446 /* preset mode of operation depending on our name */ … … 614 616 optind++; 615 617 } 616 if (cli_connect ()) {618 if (cli_connect() >= 0) { 617 619 /* List folder */ 618 620 stat_entry_t *ent; … … 636 638 optind++; 637 639 } 638 if (cli_connect ()) {640 if (cli_connect() >= 0) { 639 641 /* List folder */ 640 (void)obexftp_list(cli, NULL, optarg);642 ret = obexftp_list(cli, NULL, optarg); 641 643 } 642 644 most_recent_cmd = c; … … 644 646 645 647 case 'c': 646 if (cli_connect ()) {648 if (cli_connect() >= 0) { 647 649 /* Change dir */ 648 (void)obexftp_setpath(cli, optarg, 0);650 ret = obexftp_setpath(cli, optarg, 0); 649 651 } 650 652 most_recent_cmd = c; … … 652 654 653 655 case 'C': 654 if (cli_connect ()) {656 if (cli_connect() >= 0) { 655 657 /* Change or Make dir */ 656 (void)obexftp_setpath(cli, optarg, 1);658 ret = obexftp_setpath(cli, optarg, 1); 657 659 } 658 660 most_recent_cmd = c; … … 665 667 case 'g': 666 668 case 'G': 667 if (cli_connect ()) {669 if (cli_connect() >= 0) { 668 670 char *p; /* basename or output_file */ 669 671 if ((p = strrchr(optarg, '/')) != NULL) p++; … … 672 674 /* Get file */ 673 675 if (obexftp_get(cli, p, optarg) && c == 'G') 674 (void)obexftp_del(cli, optarg);676 ret = obexftp_del(cli, optarg); 675 677 output_file = NULL; 676 678 } … … 679 681 680 682 case 'p': 681 if (cli_connect ()) {683 if (cli_connect() >= 0) { 682 684 char *p; /* basename or output_file */ 683 685 if ((p = strrchr(optarg, '/')) != NULL) p++; … … 685 687 if (output_file) p = output_file; 686 688 /* Send file */ 687 (void)obexftp_put_file(cli, optarg, p);689 ret = obexftp_put_file(cli, optarg, p); 688 690 output_file = NULL; 689 691 } … … 692 694 693 695 case 'k': 694 if (cli_connect ()) {696 if (cli_connect() >= 0) { 695 697 /* Delete file */ 696 (void)obexftp_del(cli, optarg);698 ret = obexftp_del(cli, optarg); 697 699 } 698 700 most_recent_cmd = c; … … 700 702 701 703 case 'X': 702 if (cli_connect ()) {704 if (cli_connect() >= 0) { 703 705 /* Get capabilities */ 704 (void)obexftp_get_capability(cli, optarg, 0);706 ret = obexftp_get_capability(cli, optarg, 0); 705 707 } 706 708 most_recent_cmd = 'h'; // not really … … 716 718 717 719 case 'x': 718 if (cli_connect ()) {720 if (cli_connect() >= 0) { 719 721 /* for S65 */ 720 722 (void) obexftp_disconnect (cli); … … 734 736 break; 735 737 } 736 if (cli_connect ()) {738 if (cli_connect() >= 0) { 737 739 /* Rename a file */ 738 (void)obexftp_rename(cli, move_src, optarg);740 ret = obexftp_rename(cli, move_src, optarg); 739 741 } 740 742 move_src = NULL; … … 797 799 argv[0]); 798 800 } 801 if (ret < 0) 802 printf("The operation failed with return code %d\n", -ret); 799 803 } 800 804 … … 811 815 cli_disconnect (); 812 816 813 exit ( 0);814 815 } 817 exit (-ret); 818 819 } -
trunk/obexftp/client.c
r219 r223 395 395 cli->finished = TRUE; 396 396 cli->success = FALSE; 397 DEBUG(2, "%s() OBEX_EV_LINKERR\n", __func__); 397 398 break; 398 399 … … 434 435 return 1; 435 436 else 436 return - 1;437 return - cli->obex_rsp; 437 438 } 438 439 -
trunk/obexftp/obexftp.h
r194 r223 33 33 /** ObexFTP message callback events */ 34 34 enum { 35 OBEXFTP_EV_ERRMSG, 35 OBEXFTP_EV_ERRMSG, /* not used / internal error */ 36 36 37 37 OBEXFTP_EV_OK,
