source: global.c @ 54666e0

barnowl_perlaimdebianowlrelease-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 54666e0 was 176d3443, checked in by James M. Kretchmar <kretch@mit.edu>, 16 years ago
Deal gracefully with being resized as small as 1x1 [BZ 3]
  • Property mode set to 100644
File size: 18.3 KB
Line 
1#include <stdio.h>
2#include <unistd.h>
3#include <stdlib.h>
4#include <string.h>
5#include <netdb.h>
6#include <termios.h>
7#include <sys/ioctl.h>
8#include <time.h>
9#include "owl.h"
10
11static const char fileIdent[] = "$Id$";
12
13#ifndef MAXHOSTNAMELEN
14#define MAXHOSTNAMELEN 256
15#endif
16
17void owl_global_init(owl_global *g) {
18  struct hostent *hent;
19  char hostname[MAXHOSTNAMELEN];
20
21  g->malloced=0;
22  g->freed=0;
23
24  gethostname(hostname, MAXHOSTNAMELEN);
25  hent=gethostbyname(hostname);
26  if (!hent) {
27    g->thishost=owl_strdup("localhost");
28  } else {
29    g->thishost=owl_strdup(hent->h_name);
30  }
31
32  owl_context_init(&g->ctx);
33  owl_context_set_startup(&g->ctx);
34  g->curmsg=0;
35  g->topmsg=0;
36  g->needrefresh=1;
37  g->startupargs=NULL;
38
39  owl_variable_dict_setup(&(g->vars));
40  owl_cmddict_setup(&(g->cmds));
41
42  g->lines=LINES;
43  g->cols=COLS;
44
45  g->rightshift=0;
46
47  owl_editwin_init(&(g->tw), NULL, owl_global_get_typwin_lines(g), g->cols, OWL_EDITWIN_STYLE_ONELINE, NULL);
48
49  owl_keyhandler_init(&g->kh);
50  owl_keys_setup_keymaps(&g->kh);
51
52  owl_list_create(&(g->muxevents));
53  owl_list_create(&(g->filterlist));
54  owl_list_create(&(g->puntlist));
55  owl_list_create(&(g->messagequeue));
56  owl_dict_create(&(g->styledict));
57  g->curmsg_vert_offset=0;
58  g->resizepending=0;
59  g->typwinactive=0;
60  g->direction=OWL_DIRECTION_DOWNWARDS;
61  g->zaway=0;
62  if (has_colors()) {
63    g->hascolors=1;
64  }
65  g->colorpairs=COLOR_PAIRS;
66  g->debug=OWL_DEBUG;
67  g->searchactive=0;
68  g->searchstring=NULL;
69  g->starttime=time(NULL); /* assumes we call init only a start time */
70  g->buffercommand=NULL;
71  g->newmsgproc_pid=0;
72 
73  owl_global_set_config_format(g, 0);
74  owl_global_set_userclue(g, OWL_USERCLUE_NONE);
75  owl_global_set_no_have_config(g);
76  owl_history_init(&(g->msghist));
77  owl_history_init(&(g->cmdhist));
78  owl_history_set_norepeats(&(g->cmdhist));
79  g->nextmsgid=0;
80
81  owl_filterelement_create_true(&(g->fe_true));
82  owl_filterelement_create_false(&(g->fe_false));
83  owl_filterelement_create_null(&(g->fe_null));
84
85  _owl_global_setup_windows(g);
86
87  /* Fill in some variables which don't have constant defaults */
88  /* TODO: come back later and check passwd file first */
89  g->homedir=owl_strdup(getenv("HOME"));
90
91  owl_messagelist_create(&(g->msglist));
92  owl_mainwin_init(&(g->mw));
93  owl_popwin_init(&(g->pw));
94
95  g->aim_screenname=NULL;
96  g->aim_loggedin=0;
97  owl_timer_create_countdown(&(g->aim_noop_timer), 30);
98  owl_timer_create_countdown(&(g->aim_ignorelogin_timer), 0);
99  owl_timer_create_countdown(&(g->aim_buddyinfo_timer), 60);
100  owl_buddylist_init(&(g->buddylist));
101   
102  g->response=NULL;
103  g->havezephyr=0;
104  g->haveaim=0;
105  owl_global_set_no_doaimevents(g);
106
107  owl_errqueue_init(&(g->errqueue));
108  g->got_err_signal=0;
109
110  owl_zbuddylist_create(&(g->zbuddies));
111  owl_timer_create_countdown(&(g->zephyr_buddycheck_timer), 60*3);
112}
113
114void _owl_global_setup_windows(owl_global *g) {
115  int cols, typwin_lines;
116
117  cols=g->cols;
118  typwin_lines=owl_global_get_typwin_lines(g);
119
120  /* set the new window sizes */
121  g->recwinlines=g->lines-(typwin_lines+2);
122  if (g->recwinlines<0) {
123    /* gotta deal with this */
124    g->recwinlines=0;
125  }
126
127  owl_function_debugmsg("_owl_global_setup_windows: about to call newwin(%i, %i, 0, 0)\n", g->recwinlines, cols);
128
129  /* create the new windows */
130  g->recwin=newwin(g->recwinlines, cols, 0, 0);
131  if (g->recwin==NULL) {
132    owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n", g->recwinlines, cols);
133    endwin();
134    exit(50);
135  }
136     
137  g->sepwin=newwin(1, cols, g->recwinlines, 0);
138  g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
139  g->typwin=newwin(typwin_lines, cols, g->recwinlines+2, 0);
140
141  owl_editwin_set_curswin(&(g->tw), g->typwin, typwin_lines, g->cols);
142
143  idlok(g->typwin, FALSE);
144  idlok(g->recwin, FALSE);
145  idlok(g->sepwin, FALSE);
146  idlok(g->msgwin, FALSE);
147
148  nodelay(g->typwin, 1);
149  keypad(g->typwin, TRUE);
150  wmove(g->typwin, 0, 0);
151
152  meta(g->typwin, TRUE);
153}
154
155owl_context *owl_global_get_context(owl_global *g) {
156  return(&g->ctx);
157}
158                         
159int owl_global_get_lines(owl_global *g) {
160  return(g->lines);
161}
162
163int owl_global_get_cols(owl_global *g) {
164  return(g->cols);
165}
166
167int owl_global_get_recwin_lines(owl_global *g) {
168  return(g->recwinlines);
169}
170
171/* curmsg */
172
173int owl_global_get_curmsg(owl_global *g) {
174  return(g->curmsg);
175}
176
177void owl_global_set_curmsg(owl_global *g, int i) {
178  g->curmsg=i;
179  /* we will reset the vertical offset from here */
180  /* we might want to move this out to the functions later */
181  owl_global_set_curmsg_vert_offset(g, 0);
182}
183
184/* topmsg */
185
186int owl_global_get_topmsg(owl_global *g) {
187  return(g->topmsg);
188}
189
190void owl_global_set_topmsg(owl_global *g, int i) {
191  g->topmsg=i;
192}
193
194/* windows */
195
196owl_mainwin *owl_global_get_mainwin(owl_global *g) {
197  return(&(g->mw));
198}
199
200owl_popwin *owl_global_get_popwin(owl_global *g) {
201  return(&(g->pw));
202}
203
204/* msglist */
205
206owl_messagelist *owl_global_get_msglist(owl_global *g) {
207  return(&(g->msglist));
208}
209
210/* keyhandler */
211
212owl_keyhandler *owl_global_get_keyhandler(owl_global *g) {
213  return(&(g->kh));
214}
215
216/* curses windows */
217
218WINDOW *owl_global_get_curs_recwin(owl_global *g) {
219  return(g->recwin);
220}
221
222WINDOW *owl_global_get_curs_sepwin(owl_global *g) {
223  return(g->sepwin);
224}
225
226WINDOW *owl_global_get_curs_msgwin(owl_global *g) {
227  return(g->msgwin);
228}
229
230WINDOW *owl_global_get_curs_typwin(owl_global *g) {
231  return(g->typwin);
232}
233
234/* typwin */
235
236owl_editwin *owl_global_get_typwin(owl_global *g) {
237  return(&(g->tw));
238}
239
240/* buffercommand */
241
242void owl_global_set_buffercommand(owl_global *g, char *command) {
243  if (g->buffercommand) owl_free(g->buffercommand);
244  g->buffercommand=owl_strdup(command);
245}
246
247char *owl_global_get_buffercommand(owl_global *g) {
248  if (g->buffercommand) return(g->buffercommand);
249  return("");
250}
251
252/* refresh */
253
254int owl_global_is_needrefresh(owl_global *g) {
255  if (g->needrefresh==1) return(1);
256  return(0);
257}
258
259void owl_global_set_needrefresh(owl_global *g) {
260  g->needrefresh=1;
261}
262
263void owl_global_set_noneedrefresh(owl_global *g) {
264  g->needrefresh=0;
265}
266
267/* variable dictionary */
268
269owl_vardict *owl_global_get_vardict(owl_global *g) {
270  return &(g->vars);
271}
272
273/* command dictionary */
274
275owl_cmddict *owl_global_get_cmddict(owl_global *g) {
276  return &(g->cmds);
277}
278
279/* rightshift */
280
281void owl_global_set_rightshift(owl_global *g, int i) {
282  g->rightshift=i;
283}
284
285int owl_global_get_rightshift(owl_global *g) {
286  return(g->rightshift);
287}
288
289/* typwin */
290
291int owl_global_is_typwin_active(owl_global *g) {
292  if (g->typwinactive==1) return(1);
293  return(0);
294}
295
296void owl_global_set_typwin_active(owl_global *g) {
297  g->typwinactive=1;
298}
299
300void owl_global_set_typwin_inactive(owl_global *g) {
301  g->typwinactive=0;
302}
303
304/* resize */
305
306void owl_global_set_resize_pending(owl_global *g) {
307  g->resizepending=1;
308}
309
310char *owl_global_get_homedir(owl_global *g) {
311  if (g->homedir) return(g->homedir);
312  return("/");
313}
314
315int owl_global_get_direction(owl_global *g) {
316  return(g->direction);
317}
318
319void owl_global_set_direction_downwards(owl_global *g) {
320  g->direction=OWL_DIRECTION_DOWNWARDS;
321}
322
323void owl_global_set_direction_upwards(owl_global *g) {
324  g->direction=OWL_DIRECTION_UPWARDS;
325}
326
327/* perl stuff */
328
329void owl_global_set_perlinterp(owl_global *g, void *p) {
330  g->perl=p;
331}
332
333void *owl_global_get_perlinterp(owl_global *g) {
334  return(g->perl);
335}
336
337int owl_global_is_config_format(owl_global *g) {
338  if (g->config_format) return(1);
339  return(0);
340}
341
342void owl_global_set_config_format(owl_global *g, int state) {
343  if (state==1) {
344    g->config_format=1;
345  } else {
346    g->config_format=0;
347  }
348}
349
350void owl_global_set_have_config(owl_global *g) {
351  g->haveconfig=1;
352}
353
354void owl_global_set_no_have_config(owl_global *g) {
355  g->haveconfig=0;
356}
357
358int owl_global_have_config(owl_global *g) {
359  if (g->haveconfig) return(1);
360  return(0);
361}
362
363void owl_global_resize(owl_global *g, int x, int y) {
364  /* resize the screen.  If x or y is 0 use the terminal size */
365  struct winsize size;
366   
367  if (!g->resizepending) return;
368
369  /* delete the current windows */
370  delwin(g->recwin);
371  delwin(g->sepwin);
372  delwin(g->msgwin);
373  delwin(g->typwin);
374  if (!isendwin()) {
375    endwin();
376  }
377
378  refresh();
379
380  /* get the new size */
381  ioctl(STDIN_FILENO, TIOCGWINSZ, &size);
382  if (x==0) {
383    g->lines=size.ws_row;
384  } else {
385    g->lines=x;
386  }
387
388  if (y==0) {
389    g->cols=size.ws_col;
390  } else {
391    g->cols=y;
392  }
393
394  resizeterm(size.ws_row, size.ws_col);
395
396  /* re-initialize the windows */
397  _owl_global_setup_windows(g);
398
399  /* in case any styles rely on the current width */
400  owl_messagelist_invalidate_formats(owl_global_get_msglist(g));
401
402  /* refresh stuff */
403  g->needrefresh=1;
404  owl_mainwin_redisplay(&(g->mw));
405  sepbar(NULL);
406
407  if (owl_global_is_typwin_active(g)) {
408    owl_editwin_redisplay(&(g->tw), 0);
409  }     
410  /* TODO: this should handle other forms of popwins */
411  if (owl_popwin_is_active(owl_global_get_popwin(g)) 
412      && owl_global_get_viewwin(g)) {
413    owl_popwin_refresh(owl_global_get_popwin(g));
414    owl_viewwin_redisplay(owl_global_get_viewwin(g), 0);
415  }
416
417  owl_function_debugmsg("New size is %i lines, %i cols.", size.ws_row, size.ws_col);
418  owl_function_makemsg("");
419  g->resizepending=0;
420}
421
422/* debug */
423
424int owl_global_is_debug_fast(owl_global *g) {
425  if (g->debug) return(1);
426  return(0);
427}
428
429/* starttime */
430
431time_t owl_global_get_starttime(owl_global *g) {
432  return(g->starttime);
433}
434
435time_t owl_global_get_runtime(owl_global *g) {
436  return(time(NULL)-g->starttime);
437}
438
439void owl_global_get_runtime_string(owl_global *g, char *buff) {
440  time_t diff;
441
442  diff=time(NULL)-owl_global_get_starttime(g);
443
444  /* print something nicer later */   
445  sprintf(buff, "%i seconds", (int) diff);
446}
447
448char *owl_global_get_hostname(owl_global *g) {
449  if (g->thishost) return(g->thishost);
450  return("");
451}
452
453/* userclue */
454
455void owl_global_set_userclue(owl_global *g, int clue) {
456  g->userclue=clue;
457}
458
459void owl_global_add_userclue(owl_global *g, int clue) {
460  g->userclue|=clue;
461}
462
463int owl_global_get_userclue(owl_global *g) {
464  return(g->userclue);
465}
466
467int owl_global_is_userclue(owl_global *g, int clue) {
468  if (g->userclue & clue) return(1);
469  return(0);
470}
471
472/* viewwin */
473
474owl_viewwin *owl_global_get_viewwin(owl_global *g) {
475  return(&(g->vw));
476}
477
478
479/* vert offset */
480
481int owl_global_get_curmsg_vert_offset(owl_global *g) {
482  return(g->curmsg_vert_offset);
483}
484
485void owl_global_set_curmsg_vert_offset(owl_global *g, int i) {
486  g->curmsg_vert_offset=i;
487}
488
489/* startup args */
490
491void owl_global_set_startupargs(owl_global *g, int argc, char **argv) {
492  int i, len;
493
494  if (g->startupargs) owl_free(g->startupargs);
495 
496  len=0;
497  for (i=0; i<argc; i++) {
498    len+=strlen(argv[i])+5;
499  }
500  g->startupargs=malloc(len+5);
501
502  strcpy(g->startupargs, "");
503  for (i=0; i<argc; i++) {
504    sprintf(g->startupargs, "%s%s ", g->startupargs, argv[i]);
505  }
506  g->startupargs[strlen(g->startupargs)-1]='\0';
507}
508
509char *owl_global_get_startupargs(owl_global *g) {
510  if (g->startupargs) return(g->startupargs);
511  return("");
512}
513
514/* history */
515
516owl_history *owl_global_get_msg_history(owl_global *g) {
517  return(&(g->msghist));
518}
519
520owl_history *owl_global_get_cmd_history(owl_global *g) {
521  return(&(g->cmdhist));
522}
523
524/* muxevents */
525
526owl_muxevents *owl_global_get_muxevents(owl_global *g) {
527  return(&(g->muxevents));
528}
529
530/* filterlist */
531
532owl_list *owl_global_get_filterlist(owl_global *g) {
533  return(&(g->filterlist));
534}
535
536owl_filter *owl_global_get_filter(owl_global *g, char *name) {
537  int i, j;
538  owl_filter *f;
539
540  j=owl_list_get_size(&(g->filterlist));
541  for (i=0; i<j; i++) {
542    f=owl_list_get_element(&(g->filterlist), i);
543    if (!strcmp(name, owl_filter_get_name(f))) {
544      return(f);
545    }
546  }
547  return(NULL);
548}
549
550void owl_global_add_filter(owl_global *g, owl_filter *f) {
551  owl_list_append_element(&(g->filterlist), f);
552}
553
554void owl_global_remove_filter(owl_global *g, char *name) {
555  int i, j;
556  owl_filter *f;
557
558  j=owl_list_get_size(&(g->filterlist));
559  for (i=0; i<j; i++) {
560    f=owl_list_get_element(&(g->filterlist), i);
561    if (!strcmp(name, owl_filter_get_name(f))) {
562      owl_filter_free(f);
563      owl_list_remove_element(&(g->filterlist), i);
564      break;
565    }
566  }
567}
568
569/* nextmsgid */
570
571int owl_global_get_nextmsgid(owl_global *g) {
572  return(g->nextmsgid++);
573}
574
575/* current view */
576
577owl_view *owl_global_get_current_view(owl_global *g) {
578  return(&(g->current_view));
579}
580
581owl_filterelement *owl_global_get_filterelement_true(owl_global *g) {
582  return(&(g->fe_true));
583}
584
585owl_filterelement *owl_global_get_filterelement_false(owl_global *g) {
586  return(&(g->fe_false));
587}
588
589owl_filterelement *owl_global_get_filterelement_null(owl_global *g) {
590  return(&(g->fe_null));
591}
592
593/* has colors */
594
595int owl_global_get_hascolors(owl_global *g) {
596  if (g->hascolors) return(1);
597  return(0);
598}
599
600/* color pairs */
601
602int owl_global_get_colorpairs(owl_global *g) {
603  return(g->colorpairs);
604}
605
606/* puntlist */
607
608owl_list *owl_global_get_puntlist(owl_global *g) {
609  return(&(g->puntlist));
610}
611
612int owl_global_message_is_puntable(owl_global *g, owl_message *m) {
613  owl_list *pl;
614  int i, j;
615
616  pl=owl_global_get_puntlist(g);
617  j=owl_list_get_size(pl);
618  for (i=0; i<j; i++) {
619    if (owl_filter_message_match(owl_list_get_element(pl, i), m)) return(1);
620  }
621  return(0);
622}
623
624int owl_global_should_followlast(owl_global *g) {
625  owl_view *v;
626 
627  if (!owl_global_is__followlast(g)) return(0);
628 
629  v=owl_global_get_current_view(g);
630 
631  if (owl_global_get_curmsg(g)==owl_view_get_size(v)-1) return(1);
632  return(0);
633}
634
635int owl_global_is_search_active(owl_global *g) {
636  if (g->searchactive) return(1);
637  return(0);
638}
639
640void owl_global_set_search_active(owl_global *g, char *string) {
641  g->searchactive=1;
642  if (g->searchstring != NULL) owl_free(g->searchstring);
643  g->searchstring=owl_strdup(string);
644}
645
646void owl_global_set_search_inactive(owl_global *g) {
647  g->searchactive=0;
648}
649
650char *owl_global_get_search_string(owl_global *g) {
651  if (g->searchstring==NULL) return("");
652  return(g->searchstring);
653}
654
655void owl_global_set_newmsgproc_pid(owl_global *g, int i) {
656  g->newmsgproc_pid=i;
657}
658
659int owl_global_get_newmsgproc_pid(owl_global *g) {
660  return(g->newmsgproc_pid);
661}
662
663void owl_global_add_to_malloced(owl_global *g, int i) {
664  g->malloced+=i;
665}
666
667void owl_global_add_to_freed(owl_global *g, int i) {
668  g->freed+=1;
669}
670
671int owl_global_get_malloced(owl_global *g) {
672  return(g->malloced);
673}
674
675int owl_global_get_freed(owl_global *g) {
676  return(g->freed);
677}
678
679int owl_global_get_meminuse(owl_global *g) {
680  return(g->malloced-g->freed);
681}
682
683/* AIM stuff */
684
685int owl_global_is_aimloggedin(owl_global *g)
686{
687  if (g->aim_loggedin) return(1);
688  return(0);
689}
690
691char *owl_global_get_aim_screenname(owl_global *g)
692{
693  if (owl_global_is_aimloggedin(g)) {
694    return (g->aim_screenname);
695  }
696  return("");
697}
698
699void owl_global_set_aimloggedin(owl_global *g, char *screenname)
700{
701  g->aim_loggedin=1;
702  if (g->aim_screenname) owl_free(g->aim_screenname);
703  g->aim_screenname=owl_strdup(screenname);
704}
705
706void owl_global_set_aimnologgedin(owl_global *g)
707{
708  g->aim_loggedin=0;
709}
710
711int owl_global_is_doaimevents(owl_global *g)
712{
713  if (g->aim_doprocessing) return(1);
714  return(0);
715}
716
717void owl_global_set_doaimevents(owl_global *g)
718{
719  g->aim_doprocessing=1;
720}
721
722void owl_global_set_no_doaimevents(owl_global *g)
723{
724  g->aim_doprocessing=0;
725}
726
727aim_session_t *owl_global_get_aimsess(owl_global *g)
728{
729  return(&(g->aimsess));
730}
731
732aim_conn_t *owl_global_get_bosconn(owl_global *g)
733{
734  return(&(g->bosconn));
735}
736
737void owl_global_set_bossconn(owl_global *g, aim_conn_t *conn)
738{
739  g->bosconn=*conn;
740}
741
742int owl_global_is_aimnop_time(owl_global *g)
743{
744  if (owl_timer_is_expired(&(g->aim_noop_timer))) return(1);
745  return(0);
746}
747
748void owl_global_aimnop_sent(owl_global *g)
749{
750  owl_timer_reset(&(g->aim_noop_timer));
751}
752
753owl_timer *owl_global_get_aim_login_timer(owl_global *g)
754{
755  return(&(g->aim_ignorelogin_timer));
756}
757
758/* message queue */
759
760void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m)
761{
762  owl_list_append_element(&(g->messagequeue), m);
763}
764
765/* pop off the first message and return it.  Return NULL if the queue
766 * is empty.  The caller should free the message after using it, if
767 * necessary.
768 */
769owl_message *owl_global_messageuque_popmsg(owl_global *g)
770{
771  owl_message *out;
772
773  if (owl_list_get_size(&(g->messagequeue))==0) return(NULL);
774  out=owl_list_get_element(&(g->messagequeue), 0);
775  owl_list_remove_element(&(g->messagequeue), 0);
776  return(out);
777}
778
779int owl_global_messagequeue_pending(owl_global *g)
780{
781  if (owl_list_get_size(&(g->messagequeue))==0) return(0);
782  return(1);
783}
784
785owl_buddylist *owl_global_get_buddylist(owl_global *g)
786{
787  return(&(g->buddylist));
788}
789 
790/* style */
791
792/* Return the style with name 'name'.  If it does not exist return
793 * NULL */
794owl_style *owl_global_get_style_by_name(owl_global *g, char *name)
795{
796  return owl_dict_find_element(&(g->styledict), name);
797}
798
799/* creates a list and fills it in with keys.  duplicates the keys,
800 * so they will need to be freed by the caller. */
801int owl_global_get_style_names(owl_global *g, owl_list *l) {
802  return owl_dict_get_keys(&(g->styledict), l);
803}
804
805void owl_global_add_style(owl_global *g, owl_style *s)
806{
807  owl_dict_insert_element(&(g->styledict), owl_style_get_name(s), 
808                          s, (void(*)(void*))owl_style_free);
809}
810
811char *owl_global_get_response(owl_global *g)
812{
813  if (g->response==NULL) return("");
814  return(g->response);
815}
816
817void owl_global_set_response(owl_global *g, char *resp)
818{
819  if (g->response) owl_free(g->response);
820  g->response=owl_strdup(resp);
821}
822
823
824void owl_global_set_haveaim(owl_global *g)
825{
826  g->haveaim=1;
827}
828
829int owl_global_is_haveaim(owl_global *g)
830{
831  if (g->haveaim) return(1);
832  return(0);
833}
834
835void owl_global_set_havezephyr(owl_global *g)
836{
837  g->havezephyr=1;
838}
839
840int owl_global_is_havezephyr(owl_global *g)
841{
842  if (g->havezephyr) return(1);
843  return(0);
844}
845
846owl_timer *owl_global_get_aim_buddyinfo_timer(owl_global *g)
847{
848  return(&(g->aim_buddyinfo_timer));
849}
850
851owl_errqueue *owl_global_get_errqueue(owl_global *g)
852{
853  return(&(g->errqueue));
854}
855
856void owl_global_set_errsignal(owl_global *g, int signum, siginfo_t *siginfo)
857{
858  g->got_err_signal = signum;
859  if (siginfo) {
860    g->err_signal_info = *siginfo;
861  } else {
862    memset(&(g->err_signal_info), 0, sizeof(siginfo_t));
863  }
864}
865
866int owl_global_get_errsignal_and_clear(owl_global *g, siginfo_t *siginfo)
867{
868  int signum;
869  if (siginfo && g->got_err_signal) {
870    *siginfo = g->err_signal_info;
871  } 
872  signum = g->got_err_signal;
873  g->got_err_signal = 0;
874  return signum;
875}
876
877owl_timer *owl_global_get_zephyr_buddycheck_timer(owl_global *g)
878{
879  return(&(g->zephyr_buddycheck_timer));
880}
881
882owl_zbuddylist *owl_global_get_zephyr_buddylist(owl_global *g)
883{
884  return(&(g->zbuddies));
885}
886
887struct termios *owl_global_get_startup_tio(owl_global *g)
888{
889  return(&(g->startup_tio));
890}
Note: See TracBrowser for help on using the repository browser.