On Oct 23, 2015, at 4:04 PM, Warren Young wrote:
> 
> I’ve made the suggested changes to the program, here:
> 
>  http://pastebin.com/uZdDZPgi

By the way, if you look at scream_and_die() and wonder why I’ve badly 
overcomplicated it, it’s because a previous version presented a printf-like 
interface to its callers.  In stages, the callers stopped using it that way, 
and the function itself evolved to where it couldn’t do printf-like things 
anyway.

This simpler replacement suffices now:

void scream_and_die(const char* complaint)
{
    LPTSTR syserr = 0;
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
            FORMAT_MESSAGE_ALLOCATE_BUFFER, 0, GetLastError(),
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
            (LPTSTR)&syserr, 0, 0);
    fprintf(stderr, "%s: %s (0x%x)\n", complaint, syserr, GetLastError());
    exit(1);
}


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to