get_os_handle(const char *name)
{
    ulong hfile;	/* This must be as long as the longest handle. */
                        /* This is correct for Win32, maybe wrong for Win64. */
    int i, ch;

    for (i = 0; (ch = name[i]) != 0; ++i)
        if (!isxdigit(ch))
            return (long)INVALID_HANDLE_VALUE;
    if (sscanf(name, "%lx", &hfile) != 1)
        return (long)INVALID_HANDLE_VALUE;
    return (long)hfile;
}
get_os_handle(const char *name)
{
    ulong hfile;	 
                         
    int i, ch;

    for (i = 0; (ch = name[i]) != 0; ++i)
        if (!isxdigit(ch))
            return (long)INVALID_HANDLE_VALUE;
    if (sscanf(name, "%lx", &hfile) != 1)
        return (long)INVALID_HANDLE_VALUE;
    return (long)hfile;
}