Exemple #1
0
void LocalErrMsg(sys_error code, char *buff)
{
    char        *s;
    char        *d;
    ULONG       msg_len;
    char        ch;

    if (DosGetMessage(NULL, 0, buff, 50, code, "OSO001.MSG",
                      &msg_len) != 0 ) {
        GetDOSErrMsg( code, buff );
        return;
    }
    buff[msg_len] = '\0';
    s = d = buff;
    if (s[0] == 'S' && s[1] == 'Y' && s[2] == 'S') {
        /* Got the SYSxxxx: at the front. Take it off. */
        s += 3;
        for ( ; ; ) {
            ch = *s++;
            if (ch == ':')
                break;
            if (ch < '0' || ch > '9') {
                s = buff;
                break;
            }
        }
    }
    while (*s == ' ')
        ++s;
    for( ; ; ) {
        ch = *s++;
        if (ch == '\0')
            break;
        if (ch == '\n')
            ch = ' ';
        if (ch != '\r')
            *d++ = ch;
    }
    while (d > buff && d[-1] == ' ')
        --d;
    *d = '\0';
}
void LocalErrMsg( sys_error code, char *buff )
{
    GetDOSErrMsg( code, buff );
}