Ignore:
Timestamp:
Apr 25, 2002, 7:25:16 PM (23 years ago)
Author:
umoeller
Message:

Lots of dialog rework, plus other fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dosh.c

    r154 r159  
    19421942 *
    19431943 *      In the pathological case of a dot in the path
    1944  *      but not in the filename itself, this correctly
    1945  *      returns NULL.
     1944 *      but not in the filename itself (e.g.
     1945 *      "C:\files.new\readme"), this correctly returns
     1946 *      NULL.
    19461947 *
    19471948 *@@added V0.9.6 (2000-10-16) [umoeller]
     
    20082009    CHAR szName[5];
    20092010
    2010     APIRET rc              = NO_ERROR; // return code
     2011    APIRET arc;
    20112012    BYTE   fsqBuffer[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0};
    20122013    ULONG  cbBuffer   = sizeof(fsqBuffer);        // Buffer length)
     
    20172018    szName[2] = '\0';
    20182019
    2019     rc = DosQueryFSAttach(szName,          // logical drive of attached FS
    2020                           0,               // ulOrdinal, ignored for FSAIL_QUERYNAME
    2021                           FSAIL_QUERYNAME, // return data for a Drive or Device
    2022                           pfsqBuffer,      // returned data
    2023                           &cbBuffer);      // returned data length
    2024 
    2025     if (rc == NO_ERROR)
     2020    if (!(arc = DosQueryFSAttach(szName,          // logical drive of attached FS
     2021                                 0,               // ulOrdinal, ignored for FSAIL_QUERYNAME
     2022                                 FSAIL_QUERYNAME, // return data for a Drive or Device
     2023                                 pfsqBuffer,      // returned data
     2024                                 &cbBuffer)))     // returned data length
    20262025    {
    20272026        // The data for the last three fields in the FSQBUFFER2
     
    34343433
    34353434/*
     3435 *@@ doshCanonicalize:
     3436 *      simplifies path specifications to remove '.'
     3437 *      and '..' entries and generates a fully
     3438 *      qualified path name where possible.
     3439 *      File specifications are left unchanged.
     3440 *
     3441 *      This returns:
     3442 *
     3443 *      --  NO_ERROR: the buffers were valid.
     3444 *
     3445 *      --  ERROR_INVALID_PARAMETER: the buffers
     3446 *          were invalid.
     3447 *
     3448 *@@added V0.9.19 (2002-04-22) [pr]
     3449 */
     3450
     3451APIRET doshCanonicalize(PCSZ pcszFileIn,        // in: path to canonicalize
     3452                        PSZ pszFileOut,         // out: canonicalized path if NO_ERROR
     3453                        ULONG cbFileOut)        // in: size of pszFileOut buffer
     3454{
     3455    APIRET ulrc = NO_ERROR;
     3456    CHAR szFileTemp[CCHMAXPATH];
     3457
     3458    if (pcszFileIn && pszFileOut && cbFileOut)
     3459    {
     3460        strncpy(szFileTemp, pcszFileIn, sizeof(szFileTemp) - 1);
     3461        szFileTemp[sizeof(szFileTemp) - 1] = 0;
     3462        if (    strchr(szFileTemp, '\\')
     3463             || strchr(szFileTemp, ':')
     3464           )
     3465        {
     3466            ULONG cbFileTemp = strlen(szFileTemp);
     3467
     3468            if (    (cbFileTemp > 3)
     3469                 && (szFileTemp[cbFileTemp - 1] == '\\')
     3470               )
     3471            {
     3472                szFileTemp[cbFileTemp - 1] = 0;
     3473            }
     3474
     3475            if (DosQueryPathInfo(szFileTemp,
     3476                                 FIL_QUERYFULLNAME,
     3477                                 pszFileOut,
     3478                                 cbFileOut))
     3479            {
     3480                pszFileOut[0] = 0;
     3481            }
     3482        }
     3483        else
     3484        {
     3485            strncpy(pszFileOut, pcszFileIn, cbFileOut - 1);
     3486            pszFileOut[cbFileOut - 1] = 0;
     3487        }
     3488    }
     3489    else
     3490        ulrc = ERROR_INVALID_PARAMETER;
     3491
     3492    return(ulrc);
     3493}
     3494
     3495/*
    34363496 *@@category: Helpers\Control program helpers\Module handling
    34373497 *      helpers for importing functions from a module (DLL).
Note: See TracChangeset for help on using the changeset viewer.