]> cygwin.com Git - cygwin-apps/setup.git/blob - error.c
Remove Makefile
[cygwin-apps/setup.git] / error.c
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Ron Parker <parkerrd@hotmail.com>
13 *
14 */
15
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <windows.h>
19 #include "setup.h"
20
21 void
22 lowmem ()
23 {
24 fputs ("Insufficient memory.\n", stderr);
25 exit (1);
26 }
27
28 void
29 winerror ()
30 {
31 LPVOID msgbuf;
32 int lasterr = GetLastError ();
33
34 /* If !lasterr then assume a standard file error happened and was
35 already displayed. */
36 if (lasterr)
37 {
38 FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
39 | FORMAT_MESSAGE_FROM_SYSTEM
40 | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lasterr,
41 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
42 (LPTSTR) & msgbuf, 0, NULL);
43 if (msgbuf)
44 {
45 fprintf (stderr, "%s\n", (char *) msgbuf);
46 LocalFree (msgbuf);
47 }
48 else
49 fprintf (stderr, "Unexpected error #%d\n", lasterr);
50 }
51 }
This page took 0.04504 seconds and 5 git commands to generate.