xref: /minix/external/bsd/nvi/dist/motif_l/m_prompt.c (revision 0a6a1f1d)
1 /*-
2  * Copyright (c) 1996
3  *	Rob Zimmermann.  All rights reserved.
4  * Copyright (c) 1996
5  *	Keith Bostic.  All rights reserved.
6  *
7  * See the LICENSE file for redistribution information.
8  */
9 
10 #include "config.h"
11 
12 #include <sys/cdefs.h>
13 #if 0
14 #ifndef lint
15 static const char sccsid[] = "Id: m_prompt.c,v 8.8 2003/11/05 17:10:00 skimo Exp  (Berkeley) Date: 2003/11/05 17:10:00 ";
16 #endif /* not lint */
17 #else
18 __RCSID("$NetBSD: m_prompt.c,v 1.2 2014/01/26 21:43:45 christos Exp $");
19 #endif
20 
21 #include <sys/types.h>
22 #include <sys/queue.h>
23 
24 #include <X11/X.h>
25 #include <X11/Intrinsic.h>
26 #include <Xm/MessageB.h>
27 
28 #include <bitstring.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 
33 #undef LOCK_SUCCESS
34 #include "../common/common.h"
35 #include "../ipc/ip.h"
36 #include "m_motif.h"
37 
38 
vi_fatal_message(Widget parent,String str)39 void	vi_fatal_message(Widget parent, String str)
40 {
41     Widget	db = XmCreateErrorDialog( parent, "Fatal", NULL, 0 );
42     XmString	msg = XmStringCreateSimple( str );
43 
44     XtVaSetValues( XtParent(db),
45 		   XmNtitle,		"Fatal",
46 		   0
47 		   );
48     XtVaSetValues( db,
49 		   XmNmessageString,	msg,
50 		   0
51 		   );
52     XtAddCallback( XtParent(db), XmNpopdownCallback, __vi_cancel_cb, 0 );
53 
54     XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_CANCEL_BUTTON ) );
55     XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_HELP_BUTTON ) );
56 
57     __vi_modal_dialog( db );
58 
59     exit(0);
60 }
61 
62 
vi_info_message(Widget parent,String str)63 void	vi_info_message(Widget parent, String str)
64 {
65     static	Widget	db = NULL;
66     XmString	msg = XmStringCreateSimple( str );
67 
68     if ( db == NULL )
69 	db = XmCreateInformationDialog( parent, "Information", NULL, 0 );
70 
71     XtVaSetValues( XtParent(db),
72 		   XmNtitle,		"Information",
73 		   0
74 		   );
75     XtVaSetValues( db,
76 		   XmNmessageString,	msg,
77 		   0
78 		   );
79     XtAddCallback( XtParent(db), XmNpopdownCallback, __vi_cancel_cb, 0 );
80 
81     XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_CANCEL_BUTTON ) );
82     XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_HELP_BUTTON ) );
83 
84     __vi_modal_dialog( db );
85 }
86