mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Add a nonfatal() function everywhere, to be used for reporting things
that the user really ought to know but that are not actually fatal to continued operation of PuTTY or a single network connection. [originally from svn r9932]
This commit is contained in:
parent
1d21346d4c
commit
acf38797eb
10
cmdgen.c
10
cmdgen.c
@ -102,6 +102,16 @@ void modalfatalbox(char *p, ...)
|
||||
cleanup_exit(1);
|
||||
}
|
||||
|
||||
void nonfatal(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fprintf(stderr, "ERROR: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stubs to let everything else link sensibly.
|
||||
*/
|
||||
|
@ -85,6 +85,24 @@ static void commonfatalbox(char *p, va_list ap)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void nonfatal(void *frontend, char *p, ...)
|
||||
{
|
||||
char *errorbuf;
|
||||
NSAlert *alert;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, p);
|
||||
errorbuf = dupvprintf(p, ap);
|
||||
va_end(ap);
|
||||
|
||||
alert = [[[NSAlert alloc] init] autorelease];
|
||||
[alert addButtonWithTitle:@"Error"];
|
||||
[alert setInformativeText:[NSString stringWithCString:errorbuf]];
|
||||
[alert runModal];
|
||||
|
||||
sfree(errorbuf);
|
||||
}
|
||||
|
||||
void fatalbox(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
13
pscp.c
13
pscp.c
@ -129,6 +129,19 @@ void modalfatalbox(char *fmt, ...)
|
||||
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void nonfatal(char *fmt, ...)
|
||||
{
|
||||
char *str, *str2;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
str = dupvprintf(fmt, ap);
|
||||
str2 = dupcat("Error: ", str, "\n", NULL);
|
||||
sfree(str);
|
||||
va_end(ap);
|
||||
tell_str(stderr, str2);
|
||||
sfree(str2);
|
||||
errs++;
|
||||
}
|
||||
void connection_fatal(void *frontend, char *fmt, ...)
|
||||
{
|
||||
char *str, *str2;
|
||||
|
12
psftp.c
12
psftp.c
@ -2477,6 +2477,18 @@ void modalfatalbox(char *fmt, ...)
|
||||
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void nonfatal(char *fmt, ...)
|
||||
{
|
||||
char *str, *str2;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
str = dupvprintf(fmt, ap);
|
||||
str2 = dupcat("Error: ", str, "\n", NULL);
|
||||
sfree(str);
|
||||
va_end(ap);
|
||||
fputs(str2, stderr);
|
||||
sfree(str2);
|
||||
}
|
||||
void connection_fatal(void *frontend, char *fmt, ...)
|
||||
{
|
||||
char *str, *str2;
|
||||
|
1
putty.h
1
putty.h
@ -589,6 +589,7 @@ void get_clip(void *frontend, wchar_t **, int *);
|
||||
void optimised_move(void *frontend, int, int, int);
|
||||
void set_raw_mouse_mode(void *frontend, int);
|
||||
void connection_fatal(void *frontend, char *, ...);
|
||||
void nonfatal(char *, ...);
|
||||
void fatalbox(char *, ...);
|
||||
void modalfatalbox(char *, ...);
|
||||
#ifdef macintosh
|
||||
|
@ -3389,6 +3389,13 @@ void fatal_message_box(void *window, char *msg)
|
||||
"OK", 'o', 1, 1, NULL);
|
||||
}
|
||||
|
||||
void nonfatal_message_box(void *window, char *msg)
|
||||
{
|
||||
messagebox(window, "PuTTY Error", msg,
|
||||
string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"),
|
||||
"OK", 'o', 1, 1, NULL);
|
||||
}
|
||||
|
||||
void fatalbox(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -3401,6 +3408,17 @@ void fatalbox(char *p, ...)
|
||||
cleanup_exit(1);
|
||||
}
|
||||
|
||||
void nonfatal(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *msg;
|
||||
va_start(ap, p);
|
||||
msg = dupvprintf(p, ap);
|
||||
va_end(ap);
|
||||
fatal_message_box(NULL, msg);
|
||||
sfree(msg);
|
||||
}
|
||||
|
||||
static GtkWidget *aboutbox = NULL;
|
||||
|
||||
static void about_close_clicked(GtkButton *button, gpointer data)
|
||||
|
@ -88,6 +88,7 @@ void *get_window(void *frontend); /* void * to avoid depending on gtk.h */
|
||||
int do_config_box(const char *title, Conf *conf,
|
||||
int midsession, int protcfginfo);
|
||||
void fatal_message_box(void *window, char *msg);
|
||||
void nonfatal_message_box(void *window, char *msg);
|
||||
void about_box(void *window);
|
||||
void *eventlogstuff_new(void);
|
||||
void showeventlog(void *estuff, void *parentwin);
|
||||
|
@ -63,6 +63,22 @@ void modalfatalbox(char *p, ...)
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void nonfatal(char *p, ...)
|
||||
{
|
||||
struct termios cf;
|
||||
va_list ap;
|
||||
premsg(&cf);
|
||||
fprintf(stderr, "ERROR: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
postmsg(&cf);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
}
|
||||
void connection_fatal(void *frontend, char *p, ...)
|
||||
{
|
||||
struct termios cf;
|
||||
|
@ -5342,6 +5342,22 @@ void modalfatalbox(char *fmt, ...)
|
||||
cleanup_exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a message box and don't close the connection.
|
||||
*/
|
||||
void nonfatal(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *stuff, morestuff[100];
|
||||
|
||||
va_start(ap, fmt);
|
||||
stuff = dupvprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
sprintf(morestuff, "%.70s Error", appname);
|
||||
MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
|
||||
sfree(stuff);
|
||||
}
|
||||
|
||||
DECL_WINDOWS_FUNCTION(static, BOOL, FlashWindowEx, (PFLASHWINFO));
|
||||
|
||||
static void init_flashwindow(void)
|
||||
|
@ -49,6 +49,19 @@ void modalfatalbox(char *p, ...)
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void nonfatal(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
fprintf(stderr, "ERROR: ");
|
||||
va_start(ap, p);
|
||||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
}
|
||||
void connection_fatal(void *frontend, char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
Loading…
Reference in New Issue
Block a user