source: global.c @ 575877f

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