Deleted Added
full compact
msg.c (50479) msg.c (54587)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
7 * $FreeBSD: head/usr.sbin/sade/msg.c 50479 1999-08-28 01:35:59Z peter $
7 * $FreeBSD: head/usr.sbin/sade/msg.c 54587 1999-12-14 04:25:29Z jkh $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 163 unchanged lines hidden (view full) ---

179}
180
181/* Put up a message in a popup confirmation box */
182void
183msgConfirm(char *fmt, ...)
184{
185 va_list args;
186 char *errstr;
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 163 unchanged lines hidden (view full) ---

179}
180
181/* Put up a message in a popup confirmation box */
182void
183msgConfirm(char *fmt, ...)
184{
185 va_list args;
186 char *errstr;
187 WINDOW *w = savescr();
187
188 errstr = (char *)alloca(FILENAME_MAX);
189 va_start(args, fmt);
190 vsnprintf(errstr, FILENAME_MAX, fmt, args);
191 va_end(args);
192 use_helpline(NULL);
193 use_helpfile(NULL);
194 if (OnVTY) {
195 ioctl(0, VT_ACTIVATE, 1);
196 msgInfo(NULL);
197 }
198 dialog_notify(errstr);
188
189 errstr = (char *)alloca(FILENAME_MAX);
190 va_start(args, fmt);
191 vsnprintf(errstr, FILENAME_MAX, fmt, args);
192 va_end(args);
193 use_helpline(NULL);
194 use_helpfile(NULL);
195 if (OnVTY) {
196 ioctl(0, VT_ACTIVATE, 1);
197 msgInfo(NULL);
198 }
199 dialog_notify(errstr);
200 restorescr(w);
199}
200
201/* Put up a message in a popup information box */
202void
203msgNotify(char *fmt, ...)
204{
205 va_list args;
206 char *errstr;
201}
202
203/* Put up a message in a popup information box */
204void
205msgNotify(char *fmt, ...)
206{
207 va_list args;
208 char *errstr;
209 WINDOW *w = savescr();
207
208 errstr = (char *)alloca(FILENAME_MAX);
209 va_start(args, fmt);
210 vsnprintf(errstr, FILENAME_MAX, fmt, args);
211 va_end(args);
212 use_helpline(NULL);
213 use_helpfile(NULL);
214 if (isDebug())
215 msgDebug("Notify: %s\n", errstr);
210
211 errstr = (char *)alloca(FILENAME_MAX);
212 va_start(args, fmt);
213 vsnprintf(errstr, FILENAME_MAX, fmt, args);
214 va_end(args);
215 use_helpline(NULL);
216 use_helpfile(NULL);
217 if (isDebug())
218 msgDebug("Notify: %s\n", errstr);
216 dialog_clear_norefresh();
217 dialog_msgbox(NULL, errstr, -1, -1, 0);
219 dialog_msgbox(NULL, errstr, -1, -1, 0);
220 sleep(1);
221 restorescr(w);
218}
219
220/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
221int
222msgYesNo(char *fmt, ...)
223{
224 va_list args;
225 char *errstr;
226 int ret;
222}
223
224/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
225int
226msgYesNo(char *fmt, ...)
227{
228 va_list args;
229 char *errstr;
230 int ret;
227
231 WINDOW *w = savescr();
232
228 errstr = (char *)alloca(FILENAME_MAX);
229 va_start(args, fmt);
230 vsnprintf(errstr, FILENAME_MAX, fmt, args);
231 va_end(args);
232 use_helpline(NULL);
233 use_helpfile(NULL);
234 if (OnVTY) {
235 ioctl(0, VT_ACTIVATE, 1); /* Switch back */
236 msgInfo(NULL);
237 }
238 ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1);
233 errstr = (char *)alloca(FILENAME_MAX);
234 va_start(args, fmt);
235 vsnprintf(errstr, FILENAME_MAX, fmt, args);
236 va_end(args);
237 use_helpline(NULL);
238 use_helpfile(NULL);
239 if (OnVTY) {
240 ioctl(0, VT_ACTIVATE, 1); /* Switch back */
241 msgInfo(NULL);
242 }
243 ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1);
244 restorescr(w);
239 return ret;
240}
241
242/* Put up a message in an input box and return the value */
243char *
244msgGetInput(char *buf, char *fmt, ...)
245{
246 va_list args;
247 char *errstr;
248 static char input_buffer[256];
249 int rval;
245 return ret;
246}
247
248/* Put up a message in an input box and return the value */
249char *
250msgGetInput(char *buf, char *fmt, ...)
251{
252 va_list args;
253 char *errstr;
254 static char input_buffer[256];
255 int rval;
256 WINDOW *w = savescr();
250
251 errstr = (char *)alloca(FILENAME_MAX);
252 va_start(args, fmt);
253 vsnprintf(errstr, FILENAME_MAX, fmt, args);
254 va_end(args);
255 use_helpline(NULL);
256 use_helpfile(NULL);
257 if (buf)
258 SAFE_STRCPY(input_buffer, buf);
259 else
260 input_buffer[0] = '\0';
261 if (OnVTY) {
262 ioctl(0, VT_ACTIVATE, 1); /* Switch back */
263 msgInfo(NULL);
264 }
265 rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
257
258 errstr = (char *)alloca(FILENAME_MAX);
259 va_start(args, fmt);
260 vsnprintf(errstr, FILENAME_MAX, fmt, args);
261 va_end(args);
262 use_helpline(NULL);
263 use_helpfile(NULL);
264 if (buf)
265 SAFE_STRCPY(input_buffer, buf);
266 else
267 input_buffer[0] = '\0';
268 if (OnVTY) {
269 ioctl(0, VT_ACTIVATE, 1); /* Switch back */
270 msgInfo(NULL);
271 }
272 rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
273 restorescr(w);
266 if (!rval)
267 return input_buffer;
268 else
269 return NULL;
270}
271
272/* Write something to the debugging port */
273void

--- 13 unchanged lines hidden (view full) ---

287}
288
289/* Tell the user there's some output to go look at */
290void
291msgWeHaveOutput(char *fmt, ...)
292{
293 va_list args;
294 char *errstr;
274 if (!rval)
275 return input_buffer;
276 else
277 return NULL;
278}
279
280/* Write something to the debugging port */
281void

--- 13 unchanged lines hidden (view full) ---

295}
296
297/* Tell the user there's some output to go look at */
298void
299msgWeHaveOutput(char *fmt, ...)
300{
301 va_list args;
302 char *errstr;
295
303 WINDOW *w = savescr();
304
296 errstr = (char *)alloca(FILENAME_MAX);
297 va_start(args, fmt);
298 vsnprintf(errstr, FILENAME_MAX, fmt, args);
299 va_end(args);
300 use_helpline(NULL);
301 use_helpfile(NULL);
302 msgDebug("Notify: %s\n", errstr);
303 dialog_clear_norefresh();
304 dialog_msgbox(NULL, errstr, -1, -1, 0);
305 errstr = (char *)alloca(FILENAME_MAX);
306 va_start(args, fmt);
307 vsnprintf(errstr, FILENAME_MAX, fmt, args);
308 va_end(args);
309 use_helpline(NULL);
310 use_helpfile(NULL);
311 msgDebug("Notify: %s\n", errstr);
312 dialog_clear_norefresh();
313 dialog_msgbox(NULL, errstr, -1, -1, 0);
314 restorescr(w);
305}
306
307/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */
308int
309msgSimpleConfirm(char *str)
310{
311 msgConfirm(str);
312 return DITEM_SUCCESS;
313}
314
315int
316msgSimpleNotify(char *str)
317{
318 msgNotify(str);
319 return DITEM_SUCCESS;
320}
315}
316
317/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */
318int
319msgSimpleConfirm(char *str)
320{
321 msgConfirm(str);
322 return DITEM_SUCCESS;
323}
324
325int
326msgSimpleNotify(char *str)
327{
328 msgNotify(str);
329 return DITEM_SUCCESS;
330}