[1707] in BarnOwl Developers
[PATCH] Cleanup owl_function_debugmsg.
daemon@ATHENA.MIT.EDU (Karl Ramm)
Thu Oct 29 18:20:34 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@lunatique.mit.edu
X-Barracuda-Envelope-From: kcr@1ts.org
From: Karl Ramm <kcr@1ts.org>
To: barnowl-dev@MIT.EDU
Cc: Karl Ramm <kcr@1ts.org>
Date: Mon, 21 Sep 2009 15:35:31 -0400
Nuke two buff[LINE]s in owl_function_debugmsg.
Remove now-unused owl_global_get_runtime_string.
Also nuke trailing whitespace.
---
functions.c | 169 +++++++++++++++++++++++++++++------------------------------
global.c | 37 +++++--------
2 files changed, 97 insertions(+), 109 deletions(-)
diff --git a/functions.c b/functions.c
index 083edba..3623b86 100644
--- a/functions.c
+++ b/functions.c
@@ -15,7 +15,7 @@
char *owl_function_command(const char *cmdbuff)
{
owl_function_debugmsg("executing command: %s", cmdbuff);
- return owl_cmddict_execute(owl_global_get_cmddict(&g),
+ return owl_cmddict_execute(owl_global_get_cmddict(&g),
owl_global_get_context(&g), cmdbuff);
}
@@ -101,7 +101,7 @@ char *owl_function_style_describe(const char *name) {
} else {
desc = "???";
}
- s = owl_sprintf("%-20s - %s%s", name,
+ s = owl_sprintf("%-20s - %s%s", name,
0==owl_style_validate(style)?"":"[INVALID] ",
desc);
return s;
@@ -204,7 +204,7 @@ void owl_function_adminmsg(const char *header, const char *body)
m=owl_malloc(sizeof(owl_message));
owl_message_create_admin(m, header, body);
-
+
/* add it to the global list and current view */
owl_messagelist_append_element(owl_global_get_msglist(&g), m);
owl_view_consider_message(owl_global_get_current_view(&g), m);
@@ -235,7 +235,7 @@ owl_message *owl_function_make_outgoing_zephyr(const char *body, const char *zwr
/* create the message */
m=owl_malloc(sizeof(owl_message));
-
+
owl_message_create_from_zwrite(m, &zw, body);
owl_zwrite_free(&zw);
@@ -253,7 +253,7 @@ owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
/* error if we're not logged into aim */
if (!owl_global_is_aimloggedin(&g)) return(NULL);
-
+
m=owl_malloc(sizeof(owl_message));
owl_message_create_aim(m,
owl_global_get_aim_screenname(&g),
@@ -472,7 +472,7 @@ void owl_function_zcrypt(const char *line, const char *msg)
owl_zwrite_set_message(&z, cryptmsg);
owl_zwrite_set_opcode(&z, "crypt");
mymsg=cryptmsg;
-
+
owl_zwrite_send_message(&z);
owl_function_makemsg("Waiting for ack...");
@@ -510,7 +510,7 @@ void owl_function_aimwrite(const char *line, const char *msg)
/* make a formatted copy of the message */
format_msg=owl_strdup(msg);
owl_text_wordunwrap(format_msg);
-
+
/* send the message */
ret=owl_aim_send_im(to, format_msg);
if (!ret) {
@@ -540,7 +540,7 @@ void owl_function_send_aimawymsg(const char *to, const char *msg)
/* make a formatted copy of the message */
format_msg=owl_strdup(msg);
owl_text_wordunwrap(format_msg);
-
+
/* send the message */
ret=owl_aim_send_awaymsg(to, format_msg);
if (!ret) {
@@ -587,7 +587,7 @@ void owl_function_loopwrite(const char *msg)
}
/* If filter is non-null, looks for the next message matching
- * that filter. If skip_deleted, skips any deleted messages.
+ * that filter. If skip_deleted, skips any deleted messages.
* If last_if_none, will stop at the last message in the view
* if no matching messages are found. */
void owl_function_nextmsg_full(const char *filter, int skip_deleted, int last_if_none)
@@ -731,7 +731,7 @@ void owl_function_deletecur(int move_after)
owl_view_delete_element(v, curmsg);
if (move_after) {
- /* move the poiner in the appropriate direction
+ /* move the poiner in the appropriate direction
* to the next undeleted msg */
if (owl_global_get_direction(&g)==OWL_DIRECTION_UPWARDS) {
owl_function_prevmsg_notdeleted();
@@ -747,7 +747,7 @@ void owl_function_undeletecur(int move_after)
owl_view *v;
v=owl_global_get_current_view(&g);
-
+
if (owl_view_get_size(v) < 1) {
owl_function_error("No current message to undelete");
return;
@@ -802,7 +802,7 @@ void owl_function_expunge()
/* if there are no messages set the direction to down in case we
delete everything upwards */
owl_global_set_direction_downwards(&g);
-
+
owl_function_makemsg("Messages expunged");
owl_mainwin_redisplay(owl_global_get_mainwin(&g));
}
@@ -822,7 +822,7 @@ void owl_function_lastmsg_noredisplay()
v=owl_global_get_current_view(&g);
oldcurmsg=owl_global_get_curmsg(&g);
- curmsg=owl_view_get_size(v)-1;
+ curmsg=owl_view_get_size(v)-1;
if (curmsg<0) curmsg=0;
owl_global_set_curmsg(&g, curmsg);
if (oldcurmsg < curmsg) {
@@ -832,7 +832,7 @@ void owl_function_lastmsg_noredisplay()
* past the end of the messages. */
owl_global_set_topmsg(&g, curmsg+1);
owl_global_set_curmsg(&g, curmsg+1);
- }
+ }
/* owl_mainwin_redisplay(owl_global_get_mainwin(&g)); */
owl_global_set_direction_downwards(&g);
}
@@ -840,7 +840,7 @@ void owl_function_lastmsg_noredisplay()
void owl_function_lastmsg()
{
owl_function_lastmsg_noredisplay();
- owl_mainwin_redisplay(owl_global_get_mainwin(&g));
+ owl_mainwin_redisplay(owl_global_get_mainwin(&g));
}
void owl_function_shift_right()
@@ -1004,7 +1004,7 @@ void owl_function_aaway_off()
void owl_function_quit()
{
char *ret;
-
+
/* zlog out if we need to */
if (owl_global_is_havezephyr(&g) &&
owl_global_is_shutdownlogout(&g)) {
@@ -1022,7 +1022,7 @@ void owl_function_quit()
/* Quit zephyr */
owl_zephyr_shutdown();
-
+
/* Quit AIM */
if (owl_global_is_aimloggedin(&g)) {
owl_aim_logout();
@@ -1078,8 +1078,8 @@ void owl_function_calculate_topmsg(int direction)
owl_global_set_topmsg(&g, topmsg);
}
-/* Returns what the new topmsg should be.
- * Passed the last direction of movement,
+/* Returns what the new topmsg should be.
+ * Passed the last direction of movement,
* the current view,
* the current message number in the view,
* the top message currently being displayed,
@@ -1092,7 +1092,7 @@ int owl_function_calculate_topmsg_top(int direction, const owl_view *v, int curm
int owl_function_calculate_topmsg_neartop(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines)
{
- if (curmsg>0
+ if (curmsg>0
&& (owl_message_get_numlines(owl_view_get_element(v, curmsg-1))
< recwinlines/2)) {
return(curmsg-1);
@@ -1100,7 +1100,7 @@ int owl_function_calculate_topmsg_neartop(int direction, const owl_view *v, int
return(curmsg);
}
}
-
+
int owl_function_calculate_topmsg_center(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines)
{
int i, last, lines;
@@ -1114,12 +1114,12 @@ int owl_function_calculate_topmsg_center(int direction, const owl_view *v, int c
}
return(last);
}
-
+
int owl_function_calculate_topmsg_paged(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page)
{
int i, last, lines, savey;
-
- /* If we're off the top of the screen, scroll up such that the
+
+ /* If we're off the top of the screen, scroll up such that the
* curmsg is near the botton of the screen. */
if (curmsg < topmsg) {
last = curmsg;
@@ -1160,7 +1160,7 @@ int owl_function_calculate_topmsg_normal(int direction, const owl_view *v, int c
int savey, i, foo, y;
if (curmsg<0) return(topmsg);
-
+
/* If we're off the top of the screen then center */
if (curmsg<topmsg) {
topmsg=owl_function_calculate_topmsg_center(direction, v, curmsg, 0, recwinlines);
@@ -1185,7 +1185,7 @@ int owl_function_calculate_topmsg_normal(int direction, const owl_view *v, int c
savey=owl_message_get_numlines(owl_view_get_element(v, curmsg));
direction=OWL_DIRECTION_UPWARDS;
}
-
+
/* If our bottom line is less than 1/4 down the screen then scroll up */
if (direction == OWL_DIRECTION_UPWARDS || direction == OWL_DIRECTION_NONE) {
if (savey < (recwinlines / 4)) {
@@ -1240,22 +1240,19 @@ void owl_function_debugmsg(const char *fmt, ...)
{
FILE *file;
time_t now;
- char buff1[LINE], buff2[LINE];
va_list ap;
va_start(ap, fmt);
if (!owl_global_is_debug_fast(&g)) return;
- file=fopen(owl_global_get_debug_file(&g), "a");
- if (!file) return;
+ file = fopen(owl_global_get_debug_file(&g), "a");
+ if (!file) /* XXX should report this */
+ return;
- now=time(NULL);
- strcpy(buff1, ctime(&now));
- buff1[strlen(buff1)-1]='\0';
+ now = time(NULL);
- owl_global_get_runtime_string(&g, buff2);
-
- fprintf(file, "[%i - %s - %s]: ", (int) getpid(), buff1, buff2);
+ fprintf(file, "[%d - %.24s - %lds]: ",
+ (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g));
vfprintf(file, fmt, ap);
fprintf(file, "\n");
fclose(file);
@@ -1319,7 +1316,7 @@ void owl_function_full_redisplay()
if (owl_popwin_is_active(owl_global_get_popwin(&g))) {
owl_popwin_refresh(owl_global_get_popwin(&g));
}
-
+
sepbar("");
owl_function_makemsg("");
@@ -1419,7 +1416,7 @@ void owl_function_info()
#endif
owl_fmtext_init_null(&fm);
-
+
v=owl_global_get_current_view(&g);
m=owl_view_get_element(v, owl_global_get_curmsg(&g));
if (!m || owl_view_get_size(v)==0) {
@@ -1453,7 +1450,7 @@ void owl_function_info()
if (owl_message_is_type_zephyr(m)) {
owl_fmtext_append_bold(&fm, "\nZephyr Specific Information:\n");
-
+
owl_fmtext_appendf_normal(&fm, " Class : %s\n", owl_message_get_class(m));
owl_fmtext_appendf_normal(&fm, " Instance : %s\n", owl_message_get_instance(m));
owl_fmtext_appendf_normal(&fm, " Opcode : %s\n", owl_message_get_opcode(m));
@@ -1534,7 +1531,7 @@ void owl_function_info()
owl_fmtext_append_bold(&fm, "\nOwl Message Attributes:\n");
owl_message_attributes_tofmtext(m, &attrfm);
owl_fmtext_append_fmtext(&fm, &attrfm);
-
+
owl_function_popless_fmtext(&fm);
owl_fmtext_free(&fm);
owl_fmtext_free(&attrfm);
@@ -1589,15 +1586,15 @@ void owl_function_page_curmsg(int step)
owl_function_makemsg("The entire message is already displayed");
return;
}
-
+
/* Bail if we're not truncated */
if (!owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g))) {
owl_function_makemsg("The entire message is already displayed");
return;
}
}
-
-
+
+
/* don't scroll past the last line */
if (step>0) {
if (offset+step > lines-1) {
@@ -1615,7 +1612,7 @@ void owl_function_page_curmsg(int step)
owl_global_set_curmsg_vert_offset(&g, offset+step);
}
}
-
+
/* redisplay */
owl_mainwin_redisplay(owl_global_get_mainwin(&g));
owl_global_set_needrefresh(&g);
@@ -1659,7 +1656,7 @@ void owl_function_getsubs()
} else {
owl_function_popless_text("Error getting subscriptions");
}
-
+
owl_free(buff);
}
@@ -1693,12 +1690,12 @@ void owl_function_printallvars()
void owl_function_show_variables()
{
owl_list varnames;
- owl_fmtext fm;
+ owl_fmtext fm;
int i, numvarnames;
const char *varname;
owl_fmtext_init_null(&fm);
- owl_fmtext_append_bold(&fm,
+ owl_fmtext_append_bold(&fm,
"Variables: (use 'show variable <name>' for details)\n");
owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames);
numvarnames = owl_list_get_size(&varnames);
@@ -1715,12 +1712,12 @@ void owl_function_show_variables()
void owl_function_show_variable(const char *name)
{
- owl_fmtext fm;
+ owl_fmtext fm;
owl_fmtext_init_null(&fm);
owl_variable_get_help(owl_global_get_vardict(&g), name, &fm);
owl_function_popless_fmtext(&fm);
- owl_fmtext_free(&fm);
+ owl_fmtext_free(&fm);
}
/* note: this applies to global message list, not to view.
@@ -1835,7 +1832,7 @@ void owl_function_status()
#else
owl_fmtext_append_normal(&fm, "no\n");
#endif
-
+
owl_fmtext_append_normal(&fm, "\nAIM Status:\n");
owl_fmtext_append_normal(&fm, " Logged in: ");
@@ -1888,12 +1885,12 @@ void owl_function_reply(int type, int enter)
char *buff=NULL;
const owl_message *m;
const owl_filter *f;
-
+
if (owl_view_get_size(owl_global_get_current_view(&g))==0) {
owl_function_error("No message selected");
} else {
char *cmd;
-
+
m=owl_view_get_element(owl_global_get_current_view(&g), owl_global_get_curmsg(&g));
if (!m) {
owl_function_error("No message selected");
@@ -1964,7 +1961,7 @@ void owl_function_start_command(const char *line)
tw=owl_global_get_typwin(&g);
owl_global_set_typwin_active(&g);
- owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE,
+ owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE,
owl_global_get_cmd_history(&g));
owl_editwin_set_locktext(tw, "command: ");
@@ -2027,7 +2024,7 @@ char *owl_function_exec(int argc, const char *const *argv, const char *buff, int
#if OWL_STDERR_REDIR
redirect = " < /dev/null";
-#endif
+#endif
if (argc<2) {
owl_function_error("Wrong number of arguments to the exec command");
@@ -2050,7 +2047,7 @@ char *owl_function_exec(int argc, const char *const *argv, const char *buff, int
strcat(out, buff2);
}
pclose(p);
-
+
if (type==1) {
owl_function_popless_text(out);
} else if (type==0) {
@@ -2083,7 +2080,7 @@ char *owl_function_perl(int argc, const char *const *argv, const char *buff, int
buff = skiptokens(buff, 1);
perlout = owl_perlconfig_execute(buff);
- if (perlout) {
+ if (perlout) {
if (type==1) {
owl_function_popless_text(perlout);
} else if (type==2) {
@@ -2132,7 +2129,7 @@ void owl_function_change_currentview_filter(const char *filtname)
/* Figure out what to set the current message to.
* - If the view we're leaving has messages in it, go to the closest message
- * to the last message pointed to in that view.
+ * to the last message pointed to in that view.
* - If the view we're leaving is empty, try to restore the position
* from the last time we were in the new view. */
if (curm) {
@@ -2249,7 +2246,7 @@ char *owl_function_create_negative_filter(const char *filtername)
const char *argv[5];
owl_function_debugmsg("owl_function_create_negative_filter");
-
+
if (!strncmp(filtername, "not-", 4)) {
newname=owl_strdup(filtername+4);
} else {
@@ -2346,7 +2343,7 @@ void owl_function_show_zpunts()
* instance is NULL then catch all messgaes in the class. Returns the
* name of the filter, which the caller must free.
*/
-char *owl_function_classinstfilt(const char *c, const char *i)
+char *owl_function_classinstfilt(const char *c, const char *i)
{
owl_filter *f;
char *argbuff, *filtname;
@@ -2376,7 +2373,7 @@ char *owl_function_classinstfilt(const char *c, const char *i)
owl_text_tr(filtname, ' ', '.');
owl_text_tr(filtname, '\'', '.');
owl_text_tr(filtname, '"', '.');
-
+
/* if it already exists then go with it. This lets users override */
if (owl_global_get_filter(&g, filtname)) {
return(filtname);
@@ -2558,7 +2555,7 @@ void owl_function_delete_curview_msgs(int flag)
owl_function_makemsg("%i messages marked for %sdeletion", j, flag?"":"un");
- owl_mainwin_redisplay(owl_global_get_mainwin(&g));
+ owl_mainwin_redisplay(owl_global_get_mainwin(&g));
}
/* Create a filter based on the current message. Returns the name of
@@ -2568,12 +2565,12 @@ void owl_function_delete_curview_msgs(int flag)
* to the zephyr conversation with that user.
* If the curmsg is a zephyr class message, instance foo, recip *,
* return a filter name to the class, inst.
- * If the curmsg is a zephyr class message and type==0 then
+ * If the curmsg is a zephyr class message and type==0 then
* return a filter name for just the class.
- * If the curmsg is a zephyr class message and type==1 then
+ * If the curmsg is a zephyr class message and type==1 then
* return a filter name for the class and instance.
* If the curmsg is a personal AIM message returna filter
- * name to the AIM conversation with that user
+ * name to the AIM conversation with that user
*/
char *owl_function_smartfilter(int type)
{
@@ -2581,7 +2578,7 @@ char *owl_function_smartfilter(int type)
const owl_message *m;
char *zperson, *filtname=NULL;
const char *argv[1];
-
+
v=owl_global_get_current_view(&g);
m=owl_view_get_element(v, owl_global_get_curmsg(&g));
@@ -2647,13 +2644,13 @@ char *owl_function_smartfilter(int type)
void owl_function_smartzpunt(int type)
{
- /* Starts a zpunt command based on the current class,instance pair.
+ /* Starts a zpunt command based on the current class,instance pair.
* If type=0, uses just class. If type=1, uses instance as well. */
const owl_view *v;
const owl_message *m;
const char *cmdprefix, *mclass, *minst;
char *cmd;
-
+
v=owl_global_get_current_view(&g);
m=owl_view_get_element(v, owl_global_get_curmsg(&g));
@@ -2742,7 +2739,7 @@ int owl_function_color_filter(const char *filtname, const char *fgcolor, const c
owl_filter_set_bgcolor(f, owl_util_string_to_color(bgcolor));
}
owl_filter_set_fgcolor(f, owl_util_string_to_color(fgcolor));
-
+
owl_global_set_needrefresh(&g);
owl_mainwin_redisplay(owl_global_get_mainwin(&g));
return(0);
@@ -2751,8 +2748,8 @@ int owl_function_color_filter(const char *filtname, const char *fgcolor, const c
void owl_function_show_colors()
{
owl_fmtext fm;
- int i;
-
+ int i;
+
owl_fmtext_init_null(&fm);
owl_fmtext_append_normal(&fm, "default: ");
owl_fmtext_append_normal_color(&fm, "default\n", OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
@@ -2786,7 +2783,7 @@ void owl_function_show_colors()
owl_free(str1);
owl_free(str2);
}
-
+
owl_function_popless_fmtext(&fm);
owl_fmtext_free(&fm);
}
@@ -2920,10 +2917,10 @@ void owl_function_show_keymaps()
kmname = owl_list_get_element(&l, i);
km = owl_keyhandler_get_keymap(kh, kmname);
owl_fmtext_append_bold(&fm, "\n\n----------------------------------------------------------------------------------------------------\n\n");
- owl_keymap_get_details(km, &fm);
+ owl_keymap_get_details(km, &fm);
}
owl_fmtext_append_normal(&fm, "\n");
-
+
owl_function_popless_fmtext(&fm);
owl_keyhandler_keymap_namelist_free(&l);
owl_fmtext_free(&fm);
@@ -2931,7 +2928,7 @@ void owl_function_show_keymaps()
char *owl_function_keymap_summary(const char *name)
{
- const owl_keymap *km
+ const owl_keymap *km
= owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
if (km) return owl_keymap_summary(km);
else return(NULL);
@@ -2949,7 +2946,7 @@ void owl_function_show_keymap(const char *name)
owl_keymap_get_details(km, &fm);
} else {
owl_fmtext_append_normal(&fm, "No such keymap...\n");
- }
+ }
owl_function_popless_fmtext(&fm);
owl_fmtext_free(&fm);
}
@@ -2960,7 +2957,7 @@ void owl_function_help_for_command(const char *cmdname)
owl_fmtext_init_null(&fm);
owl_cmd_get_help(owl_global_get_cmddict(&g), cmdname, &fm);
- owl_function_popless_fmtext(&fm);
+ owl_function_popless_fmtext(&fm);
owl_fmtext_free(&fm);
}
@@ -3006,7 +3003,7 @@ void owl_function_search_helper(int mode, int direction)
v=owl_global_get_current_view(&g);
viewsize=owl_view_get_size(v);
curmsg=owl_global_get_curmsg(&g);
-
+
if (viewsize==0) {
owl_function_error("No messages present");
return;
@@ -3058,7 +3055,7 @@ void owl_function_search_helper(int mode, int direction)
owl_function_error("No matches found");
}
-/* strips formatting from ztext and returns the unformatted text.
+/* strips formatting from ztext and returns the unformatted text.
* caller is responsible for freeing. */
char *owl_function_ztext_stylestrip(const char *zt)
{
@@ -3190,7 +3187,7 @@ void owl_function_buddylist(int aim, int zephyr, const char *filename)
}
/* Dump messages in the current view to the file 'filename'. */
-void owl_function_dump(const char *filename)
+void owl_function_dump(const char *filename)
{
int i, j, count;
owl_message *m;
@@ -3245,7 +3242,7 @@ void owl_function_do_newmsgproc(void)
owl_function_debugmsg("newmsgproc did not exit");
}
}
-
+
/* if it exited, fork & exec a new one */
if (owl_global_get_newmsgproc_pid(&g)==0) {
pid_t i;
@@ -3267,14 +3264,14 @@ void owl_function_do_newmsgproc(void)
}
parsed=owl_realloc(parsed, sizeof(*parsed) * (myargc+1));
parsed[myargc] = NULL;
-
+
owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc);
-
+
execvp(parsed[0], parsed);
-
-
+
+
/* was there an error exec'ing? */
- owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s",
+ owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s",
owl_global_get_newmsgproc(&g), parsed[0], strerror(errno));
_exit(127);
}
@@ -3456,10 +3453,10 @@ void owl_function_makemsg(const char *fmt, ...)
va_start(ap, fmt);
werase(owl_global_get_curs_msgwin(&g));
-
+
vsnprintf(buff, 2048, fmt, ap);
owl_function_debugmsg("makemsg: %s", buff);
- waddstr(owl_global_get_curs_msgwin(&g), buff);
+ waddstr(owl_global_get_curs_msgwin(&g), buff);
wnoutrefresh(owl_global_get_curs_msgwin(&g));
owl_global_set_needrefresh(&g);
va_end(ap);
diff --git a/global.c b/global.c
index 38f1275..0cea998 100644
--- a/global.c
+++ b/global.c
@@ -68,7 +68,7 @@ void owl_global_init(owl_global *g) {
g->starttime=time(NULL); /* assumes we call init only a start time */
g->lastinputtime=g->starttime;
g->newmsgproc_pid=0;
-
+
owl_global_set_config_format(g, 0);
owl_global_set_userclue(g, OWL_USERCLUE_NONE);
owl_global_set_no_have_config(g);
@@ -144,7 +144,7 @@ void _owl_global_setup_windows(owl_global *g) {
endwin();
exit(50);
}
-
+
g->sepwin=newwin(1, cols, g->recwinlines, 0);
g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
g->typwin=newwin(typwin_lines, cols, g->recwinlines+2, 0);
@@ -166,7 +166,7 @@ void _owl_global_setup_windows(owl_global *g) {
owl_context *owl_global_get_context(owl_global *g) {
return(&g->ctx);
}
-
+
int owl_global_get_lines(const owl_global *g) {
return(g->lines);
}
@@ -426,7 +426,7 @@ int owl_global_have_config(owl_global *g) {
void owl_global_resize(owl_global *g, int x, int y) {
/* resize the screen. If x or y is 0 use the terminal size */
struct winsize size;
-
+
if (!g->resizepending) return;
/* delete the current windows */
@@ -447,7 +447,7 @@ void owl_global_resize(owl_global *g, int x, int y) {
g->lines=size.ws_row;
} else {
g->lines=LINES;
- }
+ }
} else {
g->lines=x;
}
@@ -457,7 +457,7 @@ void owl_global_resize(owl_global *g, int x, int y) {
g->cols=size.ws_col;
} else {
g->cols=COLS;
- }
+ }
} else {
g->cols=y;
}
@@ -484,7 +484,7 @@ void owl_global_resize(owl_global *g, int x, int y) {
owl_function_full_redisplay(&g);
/* TODO: this should handle other forms of popwins */
- if (owl_popwin_is_active(owl_global_get_popwin(g))
+ if (owl_popwin_is_active(owl_global_get_popwin(g))
&& owl_global_get_viewwin(g)) {
owl_popwin_refresh(owl_global_get_popwin(g));
owl_viewwin_redisplay(owl_global_get_viewwin(g), 0);
@@ -524,15 +524,6 @@ time_t owl_global_get_idletime(const owl_global *g) {
return(time(NULL)-g->lastinputtime);
}
-void owl_global_get_runtime_string(const owl_global *g, char *buff) {
- time_t diff;
-
- diff=time(NULL)-owl_global_get_starttime(g);
-
- /* print something nicer later */
- sprintf(buff, "%i seconds", (int) diff);
-}
-
const char *owl_global_get_hostname(const owl_global *g) {
if (g->thishost) return(g->thishost);
return("");
@@ -580,7 +571,7 @@ void owl_global_set_startupargs(owl_global *g, int argc, const char *const *argv
int i, len;
if (g->startupargs) owl_free(g->startupargs);
-
+
len=0;
for (i=0; i<argc; i++) {
len+=strlen(argv[i])+5;
@@ -697,11 +688,11 @@ int owl_global_message_is_puntable(owl_global *g, const owl_message *m) {
int owl_global_should_followlast(owl_global *g) {
const owl_view *v;
-
+
if (!owl_global_is__followlast(g)) return(0);
-
+
v=owl_global_get_current_view(g);
-
+
if (owl_global_get_curmsg(g)==owl_view_get_size(v)-1) return(1);
return(0);
}
@@ -837,7 +828,7 @@ owl_buddylist *owl_global_get_buddylist(owl_global *g)
{
return(&(g->buddylist));
}
-
+
/* style */
/* Return the style with name 'name'. If it does not exist return
@@ -847,7 +838,7 @@ const owl_style *owl_global_get_style_by_name(const owl_global *g, const char *n
return owl_dict_find_element(&(g->styledict), name);
}
-/* creates a list and fills it in with keys. duplicates the keys,
+/* creates a list and fills it in with keys. duplicates the keys,
* so they will need to be freed by the caller. */
int owl_global_get_style_names(const owl_global *g, owl_list *l) {
return owl_dict_get_keys(&(g->styledict), l);
@@ -924,7 +915,7 @@ int owl_global_get_errsignal_and_clear(owl_global *g, siginfo_t *siginfo)
int signum;
if (siginfo && g->got_err_signal) {
*siginfo = g->err_signal_info;
- }
+ }
signum = g->got_err_signal;
g->got_err_signal = 0;
return signum;
--
1.6.3.3