Ignore:
Timestamp:
Dec 8, 2001, 11:14:27 PM (24 years ago)
Author:
umoeller
Message:

Misc changes.

File:
1 edited

Legend:

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

    r121 r122  
    18371837 *@@added V0.9.16 (2001-10-19) [umoeller]
    18381838 *@@changed V0.9.16 (2001-12-02) [umoeller]: added XOPEN_BINARY \r\n support
     1839 *@@changed V0.9.16 (2001-12-06) [umoeller]: added check for pFile != NULL
    18391840 */
    18401841
     
    18441845{
    18451846    APIRET arc = NO_ERROR;
    1846     if (!pcsz)
     1847    if ((!pFile) || (!pcsz))
    18471848        arc = ERROR_INVALID_PARAMETER;
    18481849    else
     
    19301931 *      The internal string buffer is limited to 2000
    19311932 *      characters. Length checking is _not_ performed.
     1933 *
     1934 *@@added V0.9.16 (2001-10-19) [umoeller]
     1935 *@@changed V0.9.16 (2001-12-06) [umoeller]: added check for pFile != NULL
    19321936 */
    19331937
     
    19361940                         ...)
    19371941{
    1938     APIRET arc;
    1939 
    1940     DATETIME dt;
    1941     CHAR szTemp[2000];
    1942     ULONG   ulLength;
    1943 
    1944     DosGetDateTime(&dt);
    1945     if (ulLength = sprintf(szTemp,
    1946                            "%04d-%02d-%02d %02d:%02d:%02d:%02d ",
    1947                            dt.year, dt.month, dt.day,
    1948                            dt.hours, dt.minutes, dt.seconds, dt.hundredths))
    1949     {
    1950         if (!(arc = doshWrite(pFile,
    1951                               szTemp,
    1952                               ulLength)))
     1942    APIRET arc = NO_ERROR;
     1943
     1944    if ((!pFile) || (!pcszFormat))
     1945        arc = ERROR_INVALID_PARAMETER;
     1946    else
     1947    {
     1948        DATETIME dt;
     1949        CHAR szTemp[2000];
     1950        ULONG   ulLength;
     1951
     1952        DosGetDateTime(&dt);
     1953        if (ulLength = sprintf(szTemp,
     1954                               "%04d-%02d-%02d %02d:%02d:%02d:%02d ",
     1955                               dt.year, dt.month, dt.day,
     1956                               dt.hours, dt.minutes, dt.seconds, dt.hundredths))
    19531957        {
    1954             va_list arg_ptr;
    1955             va_start(arg_ptr, pcszFormat);
    1956             ulLength = vsprintf(szTemp, pcszFormat, arg_ptr);
    1957             va_end(arg_ptr);
    1958 
    1959             if (pFile->flOpenMode & XOPEN_BINARY)
    1960                 // if we're in binary mode, we need to add \r too
    1961                 szTemp[ulLength++] = '\r';
    1962             szTemp[ulLength++] = '\n';
    1963 
    1964             arc = doshWrite(pFile,
    1965                             (PCSZ)szTemp,
    1966                             ulLength);
     1958            if (!(arc = doshWrite(pFile,
     1959                                  szTemp,
     1960                                  ulLength)))
     1961            {
     1962                va_list arg_ptr;
     1963                va_start(arg_ptr, pcszFormat);
     1964                ulLength = vsprintf(szTemp, pcszFormat, arg_ptr);
     1965                va_end(arg_ptr);
     1966
     1967                if (pFile->flOpenMode & XOPEN_BINARY)
     1968                    // if we're in binary mode, we need to add \r too
     1969                    szTemp[ulLength++] = '\r';
     1970                szTemp[ulLength++] = '\n';
     1971
     1972                arc = doshWrite(pFile,
     1973                                (PCSZ)szTemp,
     1974                                ulLength);
     1975            }
    19671976        }
    19681977    }
Note: See TracChangeset for help on using the changeset viewer.