msg.c (12661) | msg.c (15242) |
---|---|
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 * $Id: msg.c,v 1.29.2.8 1995/10/22 21:38:17 jkh Exp $ | 7 * $Id: msg.c,v 1.30 1995/12/07 10:34:09 peter Exp $ |
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 16 * notice, this list of conditions and the following disclaimer, 17 * verbatim and that no modifications are made prior to this 18 * point in the file. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. | 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 16 * notice, this list of conditions and the following disclaimer, 17 * verbatim and that no modifications are made prior to this 18 * point in the file. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. |
22 * 3. All advertising materials mentioning features or use of this software 23 * must display the following acknowledgement: 24 * This product includes software developed by Jordan Hubbard 25 * for the FreeBSD Project. 26 * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to 27 * endorse or promote products derived from this software without specific 28 * prior written permission. | |
29 * 30 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND 31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE 34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 36 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) --- 172 unchanged lines hidden (view full) --- 209 WINDOW *w; 210 211 errstr = (char *)safe_malloc(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); | 22 * 23 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) --- 172 unchanged lines hidden (view full) --- 202 WINDOW *w; 203 204 errstr = (char *)safe_malloc(FILENAME_MAX); 205 va_start(args, fmt); 206 vsnprintf(errstr, FILENAME_MAX, fmt, args); 207 va_end(args); 208 use_helpline(NULL); 209 use_helpfile(NULL); |
217 w = dupwin(newscr); | 210 w = savescr(); |
218 if (OnVTY) { 219 msgDebug("Switching back to VTY1\n"); 220 ioctl(0, VT_ACTIVATE, 1); 221 msgInfo(NULL); 222 } 223 dialog_notify(errstr); | 211 if (OnVTY) { 212 msgDebug("Switching back to VTY1\n"); 213 ioctl(0, VT_ACTIVATE, 1); 214 msgInfo(NULL); 215 } 216 dialog_notify(errstr); |
224 touchwin(w); 225 wrefresh(w); 226 delwin(w); | 217 restorescr(w); |
227 free(errstr); 228} 229 230/* Put up a message in a popup information box */ 231void 232msgNotify(char *fmt, ...) 233{ 234 va_list args; --- 22 unchanged lines hidden (view full) --- 257 WINDOW *w; 258 259 errstr = (char *)safe_malloc(FILENAME_MAX); 260 va_start(args, fmt); 261 vsnprintf(errstr, FILENAME_MAX, fmt, args); 262 va_end(args); 263 use_helpline(NULL); 264 use_helpfile(NULL); | 218 free(errstr); 219} 220 221/* Put up a message in a popup information box */ 222void 223msgNotify(char *fmt, ...) 224{ 225 va_list args; --- 22 unchanged lines hidden (view full) --- 248 WINDOW *w; 249 250 errstr = (char *)safe_malloc(FILENAME_MAX); 251 va_start(args, fmt); 252 vsnprintf(errstr, FILENAME_MAX, fmt, args); 253 va_end(args); 254 use_helpline(NULL); 255 use_helpfile(NULL); |
265 w = dupwin(newscr); | 256 w = savescr(); |
266 if (OnVTY) { 267 msgDebug("Switching back to VTY1\n"); 268 ioctl(0, VT_ACTIVATE, 1); /* Switch back */ 269 msgInfo(NULL); 270 } 271 ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); | 257 if (OnVTY) { 258 msgDebug("Switching back to VTY1\n"); 259 ioctl(0, VT_ACTIVATE, 1); /* Switch back */ 260 msgInfo(NULL); 261 } 262 ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); |
272 touchwin(w); 273 wrefresh(w); 274 delwin(w); | 263 restorescr(w); |
275 free(errstr); 276 return ret; 277} 278 279/* Put up a message in an input box and return the value */ 280char * 281msgGetInput(char *buf, char *fmt, ...) 282{ --- 8 unchanged lines hidden (view full) --- 291 vsnprintf(errstr, FILENAME_MAX, fmt, args); 292 va_end(args); 293 use_helpline(NULL); 294 use_helpfile(NULL); 295 if (buf) 296 strcpy(input_buffer, buf); 297 else 298 input_buffer[0] = '\0'; | 264 free(errstr); 265 return ret; 266} 267 268/* Put up a message in an input box and return the value */ 269char * 270msgGetInput(char *buf, char *fmt, ...) 271{ --- 8 unchanged lines hidden (view full) --- 280 vsnprintf(errstr, FILENAME_MAX, fmt, args); 281 va_end(args); 282 use_helpline(NULL); 283 use_helpfile(NULL); 284 if (buf) 285 strcpy(input_buffer, buf); 286 else 287 input_buffer[0] = '\0'; |
299 w = dupwin(newscr); | 288 w = savescr(); |
300 if (OnVTY) { 301 msgDebug("Switching back to VTY1\n"); 302 ioctl(0, VT_ACTIVATE, 1); /* Switch back */ 303 msgInfo(NULL); 304 } 305 rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer); | 289 if (OnVTY) { 290 msgDebug("Switching back to VTY1\n"); 291 ioctl(0, VT_ACTIVATE, 1); /* Switch back */ 292 msgInfo(NULL); 293 } 294 rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer); |
306 touchwin(w); 307 wrefresh(w); 308 delwin(w); | 295 restorescr(w); |
309 free(errstr); 310 if (!rval) 311 return input_buffer; 312 else 313 return NULL; 314} 315 316/* Write something to the debugging port */ --- 35 unchanged lines hidden (view full) --- 352 msgInfo("Command output is on VTY2 - type ALT-F2 to see it"); 353} 354 355/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */ 356int 357msgSimpleConfirm(char *str) 358{ 359 msgConfirm(str); | 296 free(errstr); 297 if (!rval) 298 return input_buffer; 299 else 300 return NULL; 301} 302 303/* Write something to the debugging port */ --- 35 unchanged lines hidden (view full) --- 339 msgInfo("Command output is on VTY2 - type ALT-F2 to see it"); 340} 341 342/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */ 343int 344msgSimpleConfirm(char *str) 345{ 346 msgConfirm(str); |
360 return RET_SUCCESS; | 347 return DITEM_SUCCESS; |
361} 362 363int 364msgSimpleNotify(char *str) 365{ 366 msgNotify(str); | 348} 349 350int 351msgSimpleNotify(char *str) 352{ 353 msgNotify(str); |
367 return RET_SUCCESS; | 354 return DITEM_SUCCESS; |
368} | 355} |