Changeset 49 for trunk/src


Ignore:
Timestamp:
Apr 5, 2003, 5:22:30 AM (22 years ago)
Author:
bird
Message:

Made it compile.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kShell/kShell.c

    r44 r49  
    308308void            kshellWordsDestroy(PKSHELLWORDS pWords);
    309309
    310 int             kshellSyntaxError(const char *pszCmd, const char *pszMessage);
    311 int             kshellError(const char *pszCmd, const char *pszMessage);
     310int             kshellSyntaxError(const char *pszCmd, const char *pszMessage, ...);
     311int             kshellError(const char *pszCmd, const char *pszMessage, ...);
    312312
    313313int             kshellCmd_copy(const char *pszCmd, PKSHELLWORDS pWords);
     
    649649 * @param   pszMessage  Message text.
    650650 */
    651 int             kshellSyntaxError(const char *pszCmd, const char *pszMessage)
    652 {
     651int             kshellSyntaxError(const char *pszCmd, const char *pszMessage, ...)
     652{
     653    va_list args;
    653654    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);
    655660    return KSHELL_ERROR_SYNTAX_ERROR;
    656661}
     
    663668 * @param   pszMessage  Message text.
    664669 */
    665 int             kshellError(const char *pszCmd, const char *pszMessage)
    666 {
     670int             kshellError(const char *pszCmd, const char *pszMessage, ...)
     671{
     672    va_list args;
    667673    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);
    669680    return -1;
    670681}
     
    700711    KBOOL   fDstDir = -1;
    701712    int     iSrc;
     713    int     rc;
    702714
    703715    /*
     
    723735     * Copy sources to destination.
    724736     */
    725     for (iSrc = 1; iSrc < iDst && !rc; iSrc++)
     737    for (iSrc = 1, rc = 0; iSrc < iDst && !rc; iSrc++)
    726738    {
    727739        if (pWords->aWords[iSrc].fFlags & KSWORD_FLAGS_PATTERN)
     
    746758                pszDst[pWords->aWords[iDst].cchWord] = KSHELL_SLASH;
    747759                kMemCpy(pszDst + pWords->aWords[iDst].cchWord + 1,
    748                         pWords->aWords[iSrc].pszWord
     760                        pWords->aWords[iSrc].pszWord,
    749761                        pWords->aWords[iSrc].cchWord + 1);
    750762            }
     
    755767             * Do the copy.
    756768             */
     769            #if 0 /* @todo implement this */
    757770            rc = kFileCopy(pWords->aWords[iSrc].pszWord, pszDst);
     771            #endif
    758772            if (rc)
    759773            {
    760774                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);
    763776            }
    764777
Note: See TracChangeset for help on using the changeset viewer.