예제 #1
0
파일: output.c 프로젝트: BitchX/BitchX1.2
void serversay(int save, int from_server, const char *format, ...)
{
	Window	*old_target_window = target_window;
	char 	servername[200];
	int	len = 0;	
	char	*out = NULL;
	if (get_int_var(OV_VAR))
		target_window = get_window_by_name("OPER_VIEW");
        if (window_display && format)
        {
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);
		strmcpy(servername, convert_output_format(get_string_var(SERVER_PROMPT_VAR), "%s", ov_server(from_server)?ov_server(from_server):empty_string), 79);
		len = strlen(putbuf);
		out = alloca(strlen(servername)+len+5);
		len = strlen(servername);
		strcpy(out, servername); out[len] = ' '; out[len+1] = 0;
		strcat(out, putbuf);
		if (*out)
			put_echo(out);
	}
	target_window = old_target_window;
	if (save && out)
		add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, out);
}
예제 #2
0
파일: output.c 프로젝트: BitchX/BitchX1.2
/* This is an alternative form of put_it which writes three asterisks
 * before actually putting things out.
 */
void say (const char *format, ...)
{
int len = 0;
	if (window_display && format)
	{
		va_list args;
		va_start (args, format);
		if (thing_ansi)
			len = strlen(thing_ansi);
		else
			len = 3;
		vsnprintf(&(putbuf[len+1]), LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);
		strcpy(putbuf, thing_ansi?thing_ansi:three_stars);
		putbuf[len] = ' ';
		if (strip_ansi_in_echo) 
		{
			register char *ptr;
			for (ptr = putbuf + len; *ptr; ptr++)
				if (*ptr < 31 && *ptr > 13)
					if (*ptr != 15 && *ptr != 22)
						*ptr = (*ptr & 127) | 64;
		}
		put_echo(putbuf);
	}
}
예제 #3
0
파일: output.c 프로젝트: Cloudxtreme/epic5
/* 
 * This is an alternative form of put_it which writes three asterisks
 * before actually putting things out.
 */
static void 	vsay (const char *format, va_list args)
{
	if (window_display && format)
	{
		char *str;

		*putbuf = 0;
		if ((str = get_string_var(BANNER_VAR)))
		{
			if (get_int_var(BANNER_EXPAND_VAR))
			{
			    char *foo;

			    foo = expand_alias(str, empty_string);
			    strlcpy(putbuf, foo, sizeof putbuf);
			    new_free(&foo);
			}
			else
			    strlcpy(putbuf, str, sizeof putbuf);

			strlcat(putbuf, " ", sizeof putbuf);
		}

		vsnprintf(putbuf + strlen(putbuf), 
			sizeof(putbuf) - strlen(putbuf) - 1, 
			format, args);

		put_echo(putbuf);
	}
}
예제 #4
0
파일: debug.c 프로젝트: BitchX/BitchX1.1
void	debugyell(const char *format, ...)
{
const char *save_from;
unsigned long save_level;
unsigned long old_alias_debug = alias_debug;
	alias_debug = 0;
	save_display_target(&save_from, &save_level);
	set_display_target(NULL, LOG_DEBUG);
	if (format)
	{
		char debugbuf[BIG_BUFFER_SIZE+1];
		va_list args;
		va_start (args, format);
		*debugbuf = 0;
		vsnprintf(debugbuf, BIG_BUFFER_SIZE, format, args);
		va_end(args);
		in_debug_yell = 1;
		if (*debugbuf && do_hook(DEBUG_LIST, "%s", debugbuf))
			put_echo(debugbuf);
		in_debug_yell = 0;
	}
	alias_debug = old_alias_debug;
	reset_display_target();
	restore_display_target(save_from, save_level);
}
예제 #5
0
파일: output.c 프로젝트: Cloudxtreme/epic5
/*
 * put_it: the primary irc display routine.  This routine can be used to
 * display output to a user window.  Its ok to have newlines or tabs in
 * the output, but you should be careful not to overflow the 10k buffer
 * used to hold the output (use put_echo if you just want to output an
 * unbounded string).
 *
 * Some systems (notorously Ultrix) cannot gracefully convert float
 * variables through "..." into va_list, and attempting to do so will 
 * cause a crash on dereference (in vsnprintf()), so don't do that.  You'll
 * have to snprintf() the floats into strings and then pass the string 
 * in with %s.  Ugh.  This is not a bug on our part.
 */
void	put_it (const char *format, ...)
{
	if (window_display && format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, sizeof putbuf, format, args);
		va_end(args);
		put_echo(putbuf);
	}
}
예제 #6
0
파일: output.c 프로젝트: Cloudxtreme/epic5
void	yell (const char *format, ...)
{
	if (format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, sizeof putbuf, format, args);
		va_end(args);
		if (do_hook(YELL_LIST, "%s", putbuf))
			put_echo(putbuf);
	}
}
예제 #7
0
파일: output.c 프로젝트: BitchX/BitchX1.2
/*
 * Error is exactly like yell, except that if the error occured while
 * you were loading a script, it tells you where it happened.
 */
void 	error (const char *format, ...)
{
	dump_load_stack(0);
	if (format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);
		do_hook(YELL_LIST, "%s", putbuf);
		put_echo(putbuf);
	}
}
예제 #8
0
파일: output.c 프로젝트: BitchX/BitchX1.2
void	BX_yell(const char *format, ...)
{
	if (format)
	{
		va_list args;
		va_start (args, format);
		*putbuf = 0;
		vsnprintf(putbuf, LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);
		if (*putbuf && do_hook(YELL_LIST, "%s", putbuf))
			put_echo(putbuf);
	}
}
예제 #9
0
파일: output.c 프로젝트: BitchX/BitchX1.2
/*
 * put_it: the irc display routine.  Use this routine to display anything to
 * the main irc window.  It handles sending text to the display or stdout as
 * needed, add stuff to the lastlog and log file, etc.  Things NOT to do:
 * Dont send any text that contains \n, very unpredictable.  Tabs will also
 * screw things up.  The calling routing is responsible for not overwriting
 * the 1K buffer allocated.  
 *
 * For Ultrix machines, you can't call put_it() with floating point arguements.
 * It just doesn't work.  - phone, jan 1993.
 */
void BX_put_it(const char *format, ...)
{
	if (window_display && format)
	{
		va_list args;
		memset(putbuf, 0, 200);
		va_start (args, format);
		vsnprintf(putbuf, LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);
		if (*putbuf)
			put_echo(putbuf);
	}
}
예제 #10
0
파일: output.c 프로젝트: Cloudxtreme/epic5
/*
 * Error is exactly like yell, except that if the error occured while
 * you were loading a script, it tells you where it happened.
 */
void 	my_error (const char *format, ...)
{
	dump_load_stack(0);
	if (format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, sizeof putbuf, format, args);
		va_end(args);
		do_hook(YELL_LIST, "%s", putbuf);
		put_echo(putbuf);
	}
}
예제 #11
0
파일: output.c 프로젝트: Cloudxtreme/epic5
void	privileged_yell (const char *format, ...)
{
	if (format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, sizeof putbuf, format, args);
		va_end(args);

		privileged_output++;
		put_echo(putbuf);
		privileged_output--;
	}
}
예제 #12
0
파일: output.c 프로젝트: BitchX/BitchX1.2
void	log_put_it (const char *topic, const char *format, ...)
{
	if (format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);

		in_help = 1;
		set_display_target(NULL, LOG_CURRENT);
		if (window_display)
			put_echo(putbuf);
		reset_display_target();
		in_help = 0;
	}
}
예제 #13
0
파일: output.c 프로젝트: Cloudxtreme/epic5
void	file_put_it (FILE *fp, const char *format, ...)
{
	if (format)
	{
		va_list args;
		va_start (args, format);
		vsnprintf(putbuf, sizeof putbuf, format, args);
		va_end(args);
		if (fp)
		{
			fputs(putbuf, fp);
			fputs("\n", fp);
		}
		else if (window_display)
			put_echo(putbuf);
	}
}
예제 #14
0
파일: output.c 프로젝트: Cloudxtreme/epic5
/*
 * syserr is exactly like say, except that if the error occured while
 * you were loading a script, it tells you where it happened.
 */
static void     vsyserr (int server, const char *format, va_list args)
{
	char *  str;
	int     l, old_from_server = from_server;
	int	i_set_from_server = 0;

        if (!window_display || !format)
		return;

	*putbuf = 0;
	if ((str = get_string_var(BANNER_VAR)))
	{
		if (get_int_var(BANNER_EXPAND_VAR))
		{
		    char *foo;

		    foo = expand_alias(str, empty_string);
		    strlcpy(putbuf, foo, sizeof putbuf);
		    new_free(&foo);
		}
		else
		    strlcpy(putbuf, str, sizeof putbuf);

		strlcat(putbuf, " INFO -- ", sizeof putbuf);
	}

	vsnprintf(putbuf + strlen(putbuf),
		sizeof(putbuf) - strlen(putbuf) - 1,
		format, args);

	if (is_server_valid(server))
	{
		old_from_server = from_server;
		from_server = server;
		i_set_from_server = 1;
	}

	l = message_from(NULL, LEVEL_SYSERR);
	if (do_hook(YELL_LIST, "%s", putbuf))
		put_echo(putbuf);
	pop_message_from(l);

	if (i_set_from_server)
		from_server = old_from_server;
}
예제 #15
0
파일: output.c 프로젝트: BitchX/BitchX1.2
void BX_bitchsay (const char *format, ...)
{
int len;
	if (window_display && format)
	{
		va_list args;
		va_start (args, format);
		sprintf(putbuf, "%s \002%s\002: ", thing_ansi?thing_ansi:three_stars, version);
		len = strlen(putbuf);
		vsnprintf(&(putbuf[len]), LARGE_BIG_BUFFER_SIZE, format, args);
		va_end(args);
		if (strip_ansi_in_echo) 
		{
			register char *ptr;
			for (ptr = putbuf+len; *ptr; ptr++)
				if (*ptr < 31 && *ptr > 13)
					if (*ptr != 15 && *ptr != 22)
						*ptr = (*ptr & 127) | 64;
		}
		put_echo(putbuf);
	}
}