msg.c (8828) | msg.c (8837) |
---|---|
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.25 1995/05/29 00:50:04 jkh Exp $ | 7 * $Id: msg.c,v 1.26 1995/05/29 01:43:18 jkh 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 --- 28 unchanged lines hidden (view full) --- 44#include "sysinstall.h" 45#include <stdarg.h> 46#include <sys/ioctl.h> 47#include <machine/console.h> 48 49#define VTY_STATLINE 24 50#define TTY_STATLINE 23 51 | 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 --- 28 unchanged lines hidden (view full) --- 44#include "sysinstall.h" 45#include <stdarg.h> 46#include <sys/ioctl.h> 47#include <machine/console.h> 48 49#define VTY_STATLINE 24 50#define TTY_STATLINE 23 51 |
52Boolean 53isDebug(void) 54{ 55 char *cp; 56 57 cp = getenv("debug"); 58 if (cp && !strcmp(cp, "yes")) 59 return TRUE; 60 return FALSE; 61} 62 |
|
52/* Whack up an informational message on the status line, in stand-out */ 53void 54msgYap(char *fmt, ...) 55{ 56 va_list args; 57 char *errstr; 58 int attrs; 59 --- 40 unchanged lines hidden (view full) --- 100 } 101 line[80] = '\0'; 102 attrset(A_REVERSE); 103 mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line); 104 attrset(attrs); 105 move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79); 106 refresh(); 107 if (OnVTY) { | 63/* Whack up an informational message on the status line, in stand-out */ 64void 65msgYap(char *fmt, ...) 66{ 67 va_list args; 68 char *errstr; 69 int attrs; 70 --- 40 unchanged lines hidden (view full) --- 111 } 112 line[80] = '\0'; 113 attrset(A_REVERSE); 114 mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line); 115 attrset(attrs); 116 move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79); 117 refresh(); 118 if (OnVTY) { |
108 msgDebug("Information: `%s'\n", errstr); | 119 if (isDebug()) 120 msgDebug("Information: `%s'\n", errstr); |
109 msgInfo(NULL); 110 } 111 free(errstr); 112} 113 114/* Whack up a warning on the status line */ 115void 116msgWarn(char *fmt, ...) --- 8 unchanged lines hidden (view full) --- 125 vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); 126 va_end(args); 127 attrs = getattrs(stdscr); 128 beep(); 129 attrset(A_REVERSE); 130 mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); 131 attrset(attrs); 132 refresh(); | 121 msgInfo(NULL); 122 } 123 free(errstr); 124} 125 126/* Whack up a warning on the status line */ 127void 128msgWarn(char *fmt, ...) --- 8 unchanged lines hidden (view full) --- 137 vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); 138 va_end(args); 139 attrs = getattrs(stdscr); 140 beep(); 141 attrset(A_REVERSE); 142 mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); 143 attrset(attrs); 144 refresh(); |
133 if (OnVTY) | 145 if (OnVTY && isDebug()) |
134 msgDebug("Warning message `%s'\n", errstr); 135 free(errstr); 136} 137 138/* Whack up an error on the status line */ 139void 140msgError(char *fmt, ...) 141{ --- 7 unchanged lines hidden (view full) --- 149 vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); 150 va_end(args); 151 beep(); 152 attrs = getattrs(stdscr); 153 attrset(A_REVERSE); 154 mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); 155 attrset(attrs); 156 refresh(); | 146 msgDebug("Warning message `%s'\n", errstr); 147 free(errstr); 148} 149 150/* Whack up an error on the status line */ 151void 152msgError(char *fmt, ...) 153{ --- 7 unchanged lines hidden (view full) --- 161 vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); 162 va_end(args); 163 beep(); 164 attrs = getattrs(stdscr); 165 attrset(A_REVERSE); 166 mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); 167 attrset(attrs); 168 refresh(); |
157 if (OnVTY) | 169 if (OnVTY && isDebug()) |
158 msgDebug("Error message `%s'\n", errstr); 159 free(errstr); 160} 161 162/* Whack up a fatal error on the status line */ 163void 164msgFatal(char *fmt, ...) 165{ --- 60 unchanged lines hidden (view full) --- 226 char *errstr; 227 228 errstr = (char *)safe_malloc(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); | 170 msgDebug("Error message `%s'\n", errstr); 171 free(errstr); 172} 173 174/* Whack up a fatal error on the status line */ 175void 176msgFatal(char *fmt, ...) 177{ --- 60 unchanged lines hidden (view full) --- 238 char *errstr; 239 240 errstr = (char *)safe_malloc(FILENAME_MAX); 241 va_start(args, fmt); 242 vsnprintf(errstr, FILENAME_MAX, fmt, args); 243 va_end(args); 244 use_helpline(NULL); 245 use_helpfile(NULL); |
234 msgDebug("Notify: %s\n", errstr); | 246 if (isDebug()) 247 msgDebug("Notify: %s\n", errstr); |
235 dialog_clear(); 236 dialog_msgbox("Information Dialog", errstr, -1, -1, 0); 237 free(errstr); 238} 239 240/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */ 241int 242msgYesNo(char *fmt, ...) --- 6 unchanged lines hidden (view full) --- 249 errstr = (char *)safe_malloc(FILENAME_MAX); 250 va_start(args, fmt); 251 vsnprintf(errstr, FILENAME_MAX, fmt, args); 252 va_end(args); 253 use_helpline(NULL); 254 use_helpfile(NULL); 255 w = dupwin(newscr); 256 if (OnVTY) { | 248 dialog_clear(); 249 dialog_msgbox("Information Dialog", errstr, -1, -1, 0); 250 free(errstr); 251} 252 253/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */ 254int 255msgYesNo(char *fmt, ...) --- 6 unchanged lines hidden (view full) --- 262 errstr = (char *)safe_malloc(FILENAME_MAX); 263 va_start(args, fmt); 264 vsnprintf(errstr, FILENAME_MAX, fmt, args); 265 va_end(args); 266 use_helpline(NULL); 267 use_helpfile(NULL); 268 w = dupwin(newscr); 269 if (OnVTY) { |
270 msgDebug("Switching back to VTY 0\n"); |
|
257 ioctl(0, VT_RELDISP, 1); /* Switch back */ | 271 ioctl(0, VT_RELDISP, 1); /* Switch back */ |
258 msgDebug("User decision requested (type ALT-F1)\n"); | |
259 msgInfo(NULL); 260 } 261 ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); 262 touchwin(w); 263 wrefresh(w); 264 delwin(w); 265 free(errstr); 266 return ret; --- 77 unchanged lines hidden --- | 272 msgInfo(NULL); 273 } 274 ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); 275 touchwin(w); 276 wrefresh(w); 277 delwin(w); 278 free(errstr); 279 return ret; --- 77 unchanged lines hidden --- |