Changeset 49 for trunk/src/kShell/kShell.c
- Timestamp:
- Apr 5, 2003, 5:22:30 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kShell/kShell.c
r44 r49 308 308 void kshellWordsDestroy(PKSHELLWORDS pWords); 309 309 310 int kshellSyntaxError(const char *pszCmd, const char *pszMessage );311 int kshellError(const char *pszCmd, const char *pszMessage );310 int kshellSyntaxError(const char *pszCmd, const char *pszMessage, ...); 311 int kshellError(const char *pszCmd, const char *pszMessage, ...); 312 312 313 313 int kshellCmd_copy(const char *pszCmd, PKSHELLWORDS pWords); … … 649 649 * @param pszMessage Message text. 650 650 */ 651 int kshellSyntaxError(const char *pszCmd, const char *pszMessage) 652 { 651 int kshellSyntaxError(const char *pszCmd, const char *pszMessage, ...) 652 { 653 va_list args; 653 654 fflush(stdout); 654 fprintf(stderr, "Syntax error while executing command '%s': %s\n", pszCmd, pszMessage); 655 fprintf(stderr, "Syntax error in '%s': ", pszCmd); 656 va_start(args, pszMessage); 657 vfprintf(stderr, pszMessage, args); 658 va_end(args); 659 fputs("\n", stderr); 655 660 return KSHELL_ERROR_SYNTAX_ERROR; 656 661 } … … 663 668 * @param pszMessage Message text. 664 669 */ 665 int kshellError(const char *pszCmd, const char *pszMessage) 666 { 670 int kshellError(const char *pszCmd, const char *pszMessage, ...) 671 { 672 va_list args; 667 673 fflush(stdout); 668 fprintf(stderr, "Error while executing command '%s': %s\n", pszCmd, pszMessage); 674 675 fprintf(stderr, "Error while '%s': ", pszCmd); 676 va_start(args, pszMessage); 677 vfprintf(stderr, pszMessage, args); 678 va_end(args); 679 fputs("\n", stderr); 669 680 return -1; 670 681 } … … 700 711 KBOOL fDstDir = -1; 701 712 int iSrc; 713 int rc; 702 714 703 715 /* … … 723 735 * Copy sources to destination. 724 736 */ 725 for (iSrc = 1 ; iSrc < iDst && !rc; iSrc++)737 for (iSrc = 1, rc = 0; iSrc < iDst && !rc; iSrc++) 726 738 { 727 739 if (pWords->aWords[iSrc].fFlags & KSWORD_FLAGS_PATTERN) … … 746 758 pszDst[pWords->aWords[iDst].cchWord] = KSHELL_SLASH; 747 759 kMemCpy(pszDst + pWords->aWords[iDst].cchWord + 1, 748 pWords->aWords[iSrc].pszWord 760 pWords->aWords[iSrc].pszWord, 749 761 pWords->aWords[iSrc].cchWord + 1); 750 762 } … … 755 767 * Do the copy. 756 768 */ 769 #if 0 /* @todo implement this */ 757 770 rc = kFileCopy(pWords->aWords[iSrc].pszWord, pszDst); 771 #endif 758 772 if (rc) 759 773 { 760 774 kshellError("copy", "failed to copy '%s' to '%s' rc=%d.", 761 pWords->aWords[iSrc].pszWord, 762 pDst, rc); 775 pWords->aWords[iSrc].pszWord, pszDst, rc); 763 776 } 764 777
Note:
See TracChangeset
for help on using the changeset viewer.