Exemplo n.º 1
0
Socket *new_error_socket_fmt(Plug *plug, const char *fmt, ...)
{
    va_list ap;
    char *msg;

    va_start(ap, fmt);
    msg = dupvprintf(fmt, ap);
    va_end(ap);

    return new_error_socket_internal(msg, plug);
}
Exemplo n.º 2
0
void nonfatal(const char *fmt, ...)
{
    va_list ap;
    char* str;

    va_start(ap, fmt);
    str = dupvprintf(fmt, ap);
    va_end(ap);
    fzprintf(sftpError, "Error: %s", str);
    sfree(str);
}
Exemplo n.º 3
0
void nonfatal(const 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(GetParentHwnd(), stuff, morestuff,
        MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
    sfree(stuff);
}
Exemplo n.º 4
0
/*
 * Print a non-fatal message box and do not exit.
 */
void nonfatal(char *fmt, ...)
{
    va_list ap;
    char *stuff;

    va_start(ap, fmt);
    stuff = dupvprintf(fmt, ap);
    va_end(ap);
    MessageBox(NULL, stuff, "PuTTYgen Error",
	       MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
    sfree(stuff);
}
Exemplo n.º 5
0
// Affichage d'un message dans l'event log
void debug_logevent( const char *fmt, ... ) {
	va_list ap;
	char *buf;

	if( debug_flag ) {
		va_start(ap, fmt);
		buf = dupvprintf(fmt, ap) ;
		va_end(ap);
		logevent(NULL,buf);
		free(buf);
		}
	}
Exemplo n.º 6
0
/*
 * Convenience wrapper on logwrite() which printf-formats the
 * string.
 */
static void logprintf(struct LogContext *ctx, const char *fmt, ...)
{
    va_list ap;
    char *data;

    va_start(ap, fmt);
    data = dupvprintf(fmt, ap);
    va_end(ap);

    logwrite(ctx, data, strlen(data));
    sfree(data);
}
Exemplo n.º 7
0
void mboxprintf(char *fmt, ...)
{
    va_list ap;
    char *stuff;

    va_start(ap, fmt);
    stuff = dupvprintf(fmt, ap);
    va_end(ap);
    MessageBox(GetParentHwnd(), stuff, "TortoisePlink",
               MB_ICONERROR | MB_OK);
    sfree(stuff);
}
Exemplo n.º 8
0
/*
 * Print a modal (Really Bad) message box and perform a fatal exit.
 */
void modalfatalbox(const char *fmt, ...)
{
    va_list ap;
    char *stuff;

    va_start(ap, fmt);
    stuff = dupvprintf(fmt, ap);
    va_end(ap);
    MessageBox(NULL, stuff, "PuTTYgen Fatal Error",
	       MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
    sfree(stuff);
    exit(1);
}
Exemplo n.º 9
0
/*
 * Print a modal (Really Bad) message box and perform a fatal exit.
 */
void modalfatalbox(const char *fmt, ...)
{
    va_list ap;
    char *buf;

    va_start(ap, fmt);
    buf = dupvprintf(fmt, ap);
    va_end(ap);
    MessageBox(hwnd, buf, "Pageant Fatal Error",
	       MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
    sfree(buf);
    exit(1);
}
Exemplo n.º 10
0
void fatalbox(char *fmt, ...)
{
    va_list ap;
    char *stuff, morestuff[100];

    va_start(ap, fmt);
    stuff = dupvprintf(fmt, ap);
    va_end(ap);
    sprintf(morestuff, "%.70s Fatal Error", appname);
    MessageBox(GetParentHwnd(), stuff, morestuff, MB_ICONERROR | MB_OK);
    sfree(stuff);
    cleanup_exit(1);
}
Exemplo n.º 11
0
void cmdline_error(char *p, ...)
{
	va_list ap;
	char *stuff, morestuff[100];

	va_start(ap, p);
	stuff = dupvprintf(p, ap);
	va_end(ap);
	sprintf(morestuff, "%.70s Command Line Error", appname);
	MessageBox(GetParentHwnd(), stuff, morestuff, MB_ICONERROR | MB_OK);
	sfree(stuff);
    exit(1);
}
Exemplo n.º 12
0
void modalfatalbox(const char *fmt, ...)
{
    va_list ap;
    char* str;

    va_start(ap, fmt);
    str = dupvprintf(fmt, ap);
    va_end(ap);
    fzprintf(sftpError, "Fatal error: %s", str);
    sfree(str);

    cleanup_exit(1);
}
Exemplo n.º 13
0
int fzprintf(sftpEventTypes type, const char* fmt, ...)
{
    va_list ap;
    char* str, *p, *s;
    va_start(ap, fmt);
    str = dupvprintf(fmt, ap);
    if (!*str)
    {
	sfree(str);
	va_end(ap);

	fprintf(stdout, "%c\n", (int)type + '0');
	fflush(stdout);

	return 0;
    }
    p = str;
    s = str;
    while (1)
    {
	if (*p == '\r' || *p == '\n')
	{
	    if (p != s)
	    {
		*p = 0;
		fprintf(stdout, "%c%s\n", (int)type + '0', s);
		s = p + 1;
	    }
	    else
		s++;
	}
	else if (!*p)
	{
	    if (p != s)
	    {
		*p = 0;
		fprintf(stdout, "%c%s\n", (int)type + '0', s);
		s = p + 1;
	    }
	    break;
	}
	p++;
    }
    sfree(str);

    va_end(ap);

    fflush(stdout);

    return 0;
}
Exemplo n.º 14
0
void connection_fatal(void *frontend, char *p, ...)
{
	va_list ap;
	char *stuff, morestuff[100];

	va_start(ap, p);
	stuff = dupvprintf(p, ap);
	va_end(ap);
	sprintf(morestuff, "%.70s Fatal Error", appname);
	MessageBox(GetParentHwnd(), stuff, morestuff,
		MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
	sfree(stuff);
	cleanup_exit(1);
}
Exemplo n.º 15
0
void connection_fatal(void *frontend, char *p, ...)
{
    struct gui_data *inst = (struct gui_data *)frontend;
    va_list ap;
    char *msg;
    va_start(ap, p);
    msg = dupvprintf(p, ap);
    va_end(ap);
    inst->exited = TRUE;
    QMessageBox::critical(qPutty,"Fatal error",msg);
    sfree(msg);
    if (conf_get_int(inst->conf, CONF_close_on_exit) == FORCE_ON)
        cleanup_exit(1);
}
Exemplo n.º 16
0
void fatalbox(char *p, ...)
{
	va_list ap;
	char *stuff, morestuff[100];

	va_start(ap, p);
	stuff = dupvprintf(p, ap);
	va_end(ap);
	sprintf(morestuff, "%.70s Fatal Error", appname);
	MessageBox(GetParentHwnd(), stuff, morestuff, MB_ICONERROR | MB_OK);
	sfree(stuff);
    if (logctx) {
        log_free(logctx);
        logctx = NULL;
    }
	cleanup_exit(1);
}
Exemplo n.º 17
0
int fzprintf_raw(sftpEventTypes type, const char* fmt, ...)
{
    va_list ap;
    char* str ;
    va_start(ap, fmt);
    str = dupvprintf(fmt, ap);

    fputc((char)type + '0', stdout);
    fputs(str, stdout);
    fflush(stdout);

    sfree(str);

    va_end(ap);

    return 0;
}
Exemplo n.º 18
0
int fzprintf_raw_untrusted(sftpEventTypes type, const char* fmt, ...)
{
    va_list ap;
    char* str, *p, *s;
    va_start(ap, fmt);
    str = dupvprintf(fmt, ap);
    p = str;
    s = str;
    while (*p) {
	if (*p == '\r') {
	    p++;
	}
	else if (*p == '\n') {
	    if (s != str) {
		*s++ = ' ';
	    }
	    p++;
	}
	else if (*p) {
	    *s++ = *p++;
	}
    }
    *s = 0;

    if (type != sftpUnknown) {
	fputc((int)type + '0', stdout);
    }
    fputs(str, stdout);
    fputc('\n', stdout);
    fflush(stdout);

    sfree(str);

    va_end(ap);

    return 0;
}