Ejemplo n.º 1
0
/* Helper functions */
static void message(FILE *output_fd, const char *prefix, const char *fmt, va_list ap)
{
	va_list tmp;

	/* Log to standard out */
	if (output_fd) {
		va_copy(tmp, ap);
		fprintf(output_fd, "%s: ", prefix);
		vfprintf(output_fd, fmt, tmp);
		fprintf(output_fd, "\n");
	}

	/* Log to debug file */
	if (debug_fd) {
		va_copy(tmp, ap);
		fprintf(debug_fd, "%s: ", prefix);
		vfprintf(debug_fd, fmt, tmp);
		fprintf(debug_fd, "\n");
	}

	/* Log to status bar */
	if (&COMPACT && stdscr) {
		int rev = COMPACT ? A_BOLD : 0;
		va_copy(tmp, ap);
		if (!COMPACT)
			mvhline(LINES-2, 0, ACS_HLINE, COLS);
		move(LINES-1, 0);
		attron(COLOR_PAIR(COLOR_ERROR) | rev);
		vwprintw(stdscr, fmt, tmp);
		attroff(COLOR_PAIR(COLOR_ERROR) | rev);
		if (!COMPACT)
			clrtoeol();
	}
}
Ejemplo n.º 2
0
int con_printf(char *fmt,...)
{
#ifdef LINUX

  va_list marker;
  int     i;
	
  va_start(marker,fmt);
  i = vwprintw(stdscr,fmt,marker);
  va_end(marker);
  
  refresh();
  return i;

#else

  va_list marker;
  char buf[256];

  va_start(marker, fmt);       /* Initialize variable arguments. */
  vsprintf(buf,fmt,marker);
  va_end(marker);              /* Reset variable arguments.      */

  fflush(stdout);              /* Empty the output buffer */

  return _cprintf(buf);

#endif
}
Ejemplo n.º 3
0
void formatprint(WINDOW* win, const char* fmt, ...)
{	
	int maxy, maxx;
	int height, width;
	
	va_list vfmtlist;
	va_start(vfmtlist, fmt);	
	
	if (win == NULL)
		win = stdscr;	
	
	getyx(win, height, width);
	getmaxyx(win, maxy, maxx);	
			
  if (maxy <= height)
  {
  	clear();
  	getyx(win, height, width);
  }
  
  if (width != 0)
		width += 3;
	//mvprintw(row, col, fmt, vfmtlist);
	vwprintw(win, fmt, vfmtlist);
	move(height, width);
	
	
	va_end(vfmtlist);	
	refresh();
}
Ejemplo n.º 4
0
int   con_printf(char *fmt, ...)
{
int     i;
va_list marker;

#if 0
char    buf[256];

va_start(marker,fmt);
i = vsprintf(buf,fmt,marker);
va_end(marker);

if( buf[i-1] == '\n' )
  {
    buf[i-1] = '\r'; 
    buf[i] = '\n'; 
    buf[i+1] = '\0'; 
    i++;
  }

printf(buf);
#else
{
va_start(marker,fmt);
i = vwprintw(stdscr,fmt,marker);
va_end(marker);
}
#endif
refresh();
return i;
}
Ejemplo n.º 5
0
int con_printf_xy(uint xpos, uint ypos, char *fmt,...)
{
#ifdef LINUX

  va_list marker;
  int     i;

  move(ypos-1, xpos-1);     
  refresh();
	
  va_start(marker,fmt);
  i = vwprintw(stdscr,fmt,marker);
  va_end(marker);
  
  refresh();
  return i;

#else

  va_list marker;
  char buf[256];

  gotoxy(xpos, ypos);            /* Set the cursor position */
 
  va_start(marker, fmt);         /* Initialize variable arguments. */
  vsprintf(buf,fmt,marker); 
  va_end(marker);                /* Reset variable arguments.      */

  fflush(stdout);                /* Empty the output buffer */

  return _cprintf(buf); 

#endif
}
Ejemplo n.º 6
0
void msg(int level, const char *format, ...)
{
	va_list ap;
	int attrs;

	if (level > loglevel)
		return;

	switch (level) {
	case MSG_DEBUG:
		attrs = COLOR_PAIR(3);
		break;
	case MSG_ERROR:
		attrs = COLOR_PAIR(2);
		break;
	default:
		attrs = COLOR_PAIR(1);
		break;
	}

	va_start(ap, format);
	attron(attrs);
	vwprintw(stdscr, format, ap);
	attroff(attrs);
	va_end(ap);
}
Ejemplo n.º 7
0
void printcon(WCON *c, const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	vwprintw(c->win, fmt, args);
	va_end(args);
}
Ejemplo n.º 8
0
static void report(const char *msg, ...)
{
    static bool empty = TRUE;
    struct view *view = display[current_view];
    enum line_type type;
    if (!empty || *msg) {
        va_list args;

        va_start(args, msg);

        werase(status_win);
        wmove(status_win, 0, 0);
        if (*msg) {
            vwprintw(status_win, msg, args);
            empty = false;
        } else{
            empty = TRUE;
        }
        wrefresh(status_win);

        va_end(args);
    }
    update_title_win(view);
    
    if (view->lines) {
        wmove(view->win, view->lineno - view->offset, view->width - 1);
        wrefresh(view->win);
    } 
}
Ejemplo n.º 9
0
Archivo: xxx.c Proyecto: yaomoon/GT2440
static void report(const char *msg, ...)
{
    static bool empty = TRUE;
    struct view *view = display[current_view];
    if (!empty || *msg) {
        va_list args;

        va_start(args, msg);

        werase(status_win);
        wmove(status_win, 0, 0);
        if (*msg) {
            vwprintw(status_win, msg, args);
            empty = false;
        } else{
            empty = TRUE;
        }
        wrefresh(status_win);

        va_end(args);
    }
#ifdef yaomoon
fprintf(moon_log,"927: report\n");
#endif
    update_title_win(view);
    
    if (view->lines) {
        wmove(view->win, view->lineno - view->offset, view->width - 1);
        wrefresh(view->win);
    } 
#ifdef yaomoon
while(1);
#endif
}
Ejemplo n.º 10
0
void dcpu_msg(char *fmt, ...) {
  va_list args;
  va_start(args, fmt);
  vwprintw(term.dbgwin, fmt, args);
  wrefresh(term.dbgwin);
  va_end(args);
}
Ejemplo n.º 11
0
/*
  display a message in the status bar.
 */
void statusprintf(char *fmt, ...)
{
	
	saveyx();

	werase(status_win);
	wmove(status_win, 0, 0);

	va_list ap;
	va_start(ap, fmt);
	vwprintw(status_win, fmt, ap);
	va_end(ap);

	/* We have to clear the screen to the end of line because for some unexpected
	   reason, curses doesn't want to do it
	*/

	int y, x;
	getyx(stdscr, y, x);
	while(x <= COLS) {
		waddch(status_win, ' ');
		x++;
	}

	wrefresh(status_win);
	restoreyx();

}
Ejemplo n.º 12
0
void log(const char* fmt, ...) {
    va_list vl;
    va_start(vl, fmt);
    vwprintw(wmain, fmt, vl);
    update_panels();
    doupdate();
    va_end(vl);
}
Ejemplo n.º 13
0
void status(const char* fmt, ...) {
    va_list vl;

    va_start(vl, fmt);
    wmove(wstatus, 0, 0);
    vwprintw(wstatus, fmt, vl);
    wprintw(wstatus, "\n");
    va_end(vl);

    va_start(vl, fmt);
    vwprintw(wmain, fmt, vl);
    wprintw(wmain, "\n");
    va_end(vl);

    update_panels();
    doupdate();
}
Ejemplo n.º 14
0
int t_wprint_ascii(WINDOW *win, char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	int status = vwprintw(win, fmt, args);
	va_end(args);
	return status;
}
Ejemplo n.º 15
0
/*VARARGS1*/
int
printw(char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	return (vwprintw(stdscr, fmt, ap));
}
Ejemplo n.º 16
0
void ztf_dialog_vcat(zt_dialog *dw, char *format, ...) {
    WINDOW *dwin = (WINDOW *)((BorderedWindow *)dw->fw_ptr)->content;
    
    va_list arg_ptr;
    
    va_start(arg_ptr, format);
        
    vwprintw(dwin, format, arg_ptr);
}
Ejemplo n.º 17
0
int t_mv_wprint_ascii(WINDOW *win, int x, int y, char *fmt, ...)
{
	t_wmove(win, x, y);
	va_list args;
	va_start(args, fmt);
	int status = vwprintw(win, fmt, args);
	va_end(args);
	return status;
}
Ejemplo n.º 18
0
int
mvwprintw(WINDOW *win, int y, int x, ...)
{
	char	*fmt;
	va_list ap;

	va_start(ap, x);
	fmt = va_arg(ap, char *);
	return (wmove(win, y, x) == OK ? vwprintw(win, fmt, ap) : ERR);
}
Ejemplo n.º 19
0
/*VARARGS*/
int
wprintw(WINDOW *win, ...)
{
	va_list ap;
	char * fmt;

	va_start(ap, win);
	fmt = va_arg(ap, char *);
	return (vwprintw(win, fmt, ap));
}
Ejemplo n.º 20
0
int info_printf(const char *format, ...)
{
    va_list ap;
    va_start(ap, format);
    int ret = vwprintw(info_win, format, ap);
    wrefresh(info_win);
    va_end(ap);

    return ret;
}
Ejemplo n.º 21
0
// int overlay (const WINDOW*,WINDOW *) {}
// int overwrite (const WINDOW*,WINDOW *) {}
// int pair_content (short,short*,short*) {}
// int pechochar (WINDOW *, const chtype) {}
// int pnoutrefresh (WINDOW*,int,int,int,int,int,int) {}
// int prefresh (WINDOW *,int,int,int,int,int,int) {}
int printw(const char *fmt, ...)
{
	va_list argp;
	int code;

	va_start(argp, fmt);
	code = vwprintw(stdscr, fmt, argp);
	va_end(argp);

	return code;
}
Ejemplo n.º 22
0
int cprintf(const char* fmt, ...) {
    va_list v;
    
    init_screen();
    va_start(v, fmt);
    vwprintw(_working_window, fmt, v);
    va_end(v);
    wrefresh(_working_window);
    
    return strlen(fmt);
}
Ejemplo n.º 23
0
void
gg_vwprintw(WINDOW *w, const char *format, va_list ap)
{
#if HAVE_VWPRINTW
  vwprintw(w, format, ap);
#else
  char msg[128];
  gg_vsnprintf(msg, 128, format, ap);
  wprintw(w, "%s", msg);
#endif
}
Ejemplo n.º 24
0
static void print_msg(const char *fmt, ...)
{
    va_list ap;
    va_start(ap, fmt);

    werase(msg_area);
    wmove(msg_area, 0, 0);
    vwprintw(msg_area, fmt, ap);

    va_end(ap);
}
Ejemplo n.º 25
0
Archivo: ui.c Proyecto: jhawcroft/brain
void brsh_printf(char const *in_output, ...)
{
    va_list arg_list;
    va_start(arg_list, in_output);
    int y, x;
    getyx(stdscr, y, x);
    vwprintw(win_output, in_output, arg_list);
    va_end(arg_list);
    wrefresh(win_output);
    set_current_field(frm_input, fld_input);
    move(y, x);
}
Ejemplo n.º 26
0
/* Prints a message to log window
 * The message is styled as a "system" message */
void ncurs_log_sysmsg(const char *fmt, ...)
{
	scrollok(log_win, 1);
	wprintw(log_win, "-!- ");
	va_list argp;
	va_start(argp, fmt);
	vwprintw(log_win, fmt, argp);
	va_end(argp);
	waddch(log_win, '\n');
	wrefresh(log_win);
	scrollok(log_win, 0);
}
Ejemplo n.º 27
0
static void
console_log (const char *format, ...)
{
	va_list argptr;
	va_start(argptr, format);

	move(termheight - 1, 5);
	vwprintw(stdscr, format, argptr);

	va_end(argptr);
	refresh();
}
Ejemplo n.º 28
0
int wprintw(WINDOW *win, const char *fmt, ...)
{
	va_list args;
	int retval;

	PDC_LOG(("wprintw() - called\n"));

	va_start(args, fmt);
	retval = vwprintw(win, fmt, args);
	va_end(args);

	return retval;
}
Ejemplo n.º 29
0
int printw(const char *fmt, ...)
{
	va_list args;
	int retval;

	PDC_LOG(("printw() - called\n"));

	va_start(args, fmt);
	retval = vwprintw(stdscr, fmt, args);
	va_end(args);

	return retval;
}
Ejemplo n.º 30
0
void printstr(WINDOW* win, const char *fmt, ...)
{
	va_list vfmtlist;
	va_start(vfmtlist, fmt);
	
	if (win == NULL)
		win = stdscr;
		
	vwprintw(stdscr, fmt, vfmtlist);
	refresh();
	
	va_end(vfmtlist);	
}