]> cygwin.com Git - cygwin-apps/setup.git/blob - msg.cc
* Replace everything with a new GUI version
[cygwin-apps/setup.git] / msg.cc
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 DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16 /* The purpose of this file is to centralize all the message
17 functions. */
18
19 #include "win32.h"
20 #include <stdio.h>
21 #include <stdarg.h>
22 #include "dialog.h"
23
24 void
25 msg(char *fmt, ...)
26 {
27 char buf[1000];
28 va_list args;
29 va_start (args, fmt);
30 vsprintf (buf, fmt, args);
31 OutputDebugString (buf);
32 }
33
34 static int mbox (int type, int id, va_list args)
35 {
36 char buf[1000], fmt[1000];
37
38 if (LoadString (hinstance, id, fmt, sizeof(fmt)) <= 0)
39 ExitProcess (0);
40
41 vsprintf (buf, fmt, args);
42 return MessageBox (0, buf, "Cygwin Setup", type);
43 }
44
45 void
46 note (int id, ...)
47 {
48 va_list args;
49 va_start (args, id);
50 mbox (0, id, args);
51 }
52
53 void
54 fatal (int id, ...)
55 {
56 va_list args;
57 va_start (args, id);
58 mbox (0, id, args);
59 ExitProcess (1);
60 }
61
62 int
63 yesno (int id, ...)
64 {
65 va_list args;
66 va_start (args, id);
67 return mbox (MB_YESNO, id, args);
68 }
This page took 0.03888 seconds and 6 git commands to generate.