This commit was generated by cvs2svn to compensate for changes in r5670,
[chise/xemacs-chise.git.1] / netinstall / 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 static char *cvsid = "\n%%% $Id: msg.cc,v 1.1.2.1 2000/12/11 22:01:36 andyp Exp $\n";
20
21 #include "win32.h"
22 #include <stdio.h>
23 #include <stdarg.h>
24 #include "dialog.h"
25 #include "log.h"
26
27 void
28 msg (char *fmt, ...)
29 {
30   char buf[1000];
31   va_list args;
32   va_start (args, fmt);
33   vsprintf (buf, fmt, args);
34   OutputDebugString (buf);
35 }
36
37 static int
38 mbox (char *name, int type, int id, va_list args)
39 {
40   char buf[1000], fmt[1000];
41
42   if (LoadString (hinstance, id, fmt, sizeof (fmt)) <= 0)
43     ExitProcess (0);
44
45   vsprintf (buf, fmt, args);
46   log (0, "mbox %s: %s", name, buf);
47   return MessageBox (0, buf, "XEmacs Setup", type | MB_TOPMOST);
48 }
49
50 void
51 note (int id, ...)
52 {
53   va_list args;
54   va_start (args, id);
55   mbox ("note", 0, id, args);
56 }
57
58 void
59 fatal (int id, ...)
60 {
61   va_list args;
62   va_start (args, id);
63   mbox ("fatal", 0, id, args);
64   exit_setup (1);
65 }
66
67 int
68 yesno (int id, ...)
69 {
70   va_list args;
71   va_start (args, id);
72   return mbox ("yesno", MB_YESNO, id, args);
73 }