Changeset 8e1657c


Ignore:
Timestamp:
Mar 29, 2009, 3:19:34 PM (12 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
2b23a36a
Parents:
04a061f
Message:
new owl_function_error
if a multiline error, make it an admin msg
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r04a061f r8e1657c  
    34523452{
    34533453  va_list ap;
    3454   char buff[2048], buff2[2048];
     3454  char *buff, *buff2;
     3455  char *nl;
    34553456  char *date;
    34563457  time_t now;
     
    34623463  va_start(ap, fmt);
    34633464
    3464   vsnprintf(buff, 2048, fmt, ap);
    3465   sprintf(buff2, "%s %s", date, buff);
     3465  buff = g_strdup_vprintf(fmt, ap);
     3466  buff2 = owl_sprintf("%s %s", date, buff);
    34663467  owl_function_debugmsg("ERROR: %s", buff);
    3467   if (owl_global_get_curs_msgwin(&g)) {
    3468     werase(owl_global_get_curs_msgwin(&g));
    3469     waddstr(owl_global_get_curs_msgwin(&g), buff); 
    3470     wnoutrefresh(owl_global_get_curs_msgwin(&g));
    3471     owl_global_set_needrefresh(&g);
     3468  nl = strchr(buff, '\n');
     3469  if(nl && *(nl + 1)) {
     3470    /* Multiline error */
     3471    owl_function_adminmsg("ERROR", buff);
     3472  } else {
     3473    owl_function_makemsg("[Error] %s", buff);
    34723474  }
    34733475  owl_errqueue_append_err(owl_global_get_errqueue(&g), buff2);
    34743476  va_end(ap);
    34753477  owl_free(date);
     3478  owl_free(buff);
     3479  owl_free(buff2);
    34763480}
    34773481
Note: See TracChangeset for help on using the changeset viewer.