source: global.c @ 1fd4cd3e

barnowl_perlaimdebianowlrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 1fd4cd3e was c9e72d1, checked in by Erik Nygren <nygren@mit.edu>, 21 years ago
Catch SIGPIPE and print an error rather than crashing. [It's possible that this may have some portability issues under Solaris and we may need to add some configure stuff around SA_SIGINFO...]
  • Property mode set to 100644
File size: 17.8 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->filterlist));
53  owl_list_create(&(g->puntlist));
54  owl_list_create(&(g->messagequeue));
55  owl_dict_create(&(g->styledict));
56  g->curmsg_vert_offset=0;
57  g->resizepending=0;
58  g->typwinactive=0;
59  g->direction=OWL_DIRECTION_DOWNWARDS;
60  g->zaway=0;
61  if (has_colors()) {
62    g->hascolors=1;
63  }
64  g->colorpairs=COLOR_PAIRS;
65  g->debug=OWL_DEBUG;
66  g->searchactive=0;
67  g->searchstring=NULL;
68  g->starttime=time(NULL); /* assumes we call init only a start time */
69  g->buffercommand=NULL;
70  g->newmsgproc_pid=0;
71 
72  owl_global_set_config_format(g, 0);
73  owl_global_set_userclue(g, OWL_USERCLUE_NONE);
74  owl_global_set_no_have_config(g);
75  owl_history_init(&(g->msghist));
76  owl_history_init(&(g->cmdhist));
77  owl_history_set_norepeats(&(g->cmdhist));
78  g->nextmsgid=0;
79
80  owl_filterelement_create_true(&(g->fe_true));
81  owl_filterelement_create_false(&(g->fe_false));
82  owl_filterelement_create_null(&(g->fe_null));
83
84  _owl_global_setup_windows(g);
85
86  /* Fill in some variables which don't have constant defaults */
87  /* TODO: come back later and check passwd file first */
88  g->homedir=owl_strdup(getenv("HOME"));
89
90  owl_messagelist_create(&(g->msglist));
91  owl_mainwin_init(&(g->mw));
92  owl_popwin_init(&(g->pw));
93
94  g->aim_screenname=NULL;
95  g->aim_loggedin=0;
96  owl_timer_create_countdown(&(g->aim_noop_timer), 30);
97  owl_timer_create_countdown(&(g->aim_ignorelogin_timer), 0);
98  owl_timer_create_countdown(&(g->aim_buddyinfo_timer), 60);
99  owl_buddylist_init(&(g->buddylist));
100   
101  g->response=NULL;
102  g->havezephyr=0;
103  g->haveaim=0;
104  owl_global_set_no_doaimevents(g);
105
106  owl_errqueue_init(&(g->errqueue));
107
108  g->got_err_signal=0;
109}
110
111void _owl_global_setup_windows(owl_global *g) {
112  int cols, typwin_lines;
113
114  cols=g->cols;
115  typwin_lines=owl_global_get_typwin_lines(g);
116
117  /* set the new window sizes */
118  g->recwinlines=g->lines-(typwin_lines+2);
119  if (g->recwinlines<1) {
120    /* this will screw things up.  I'm not sure what to do yet,
121       but this is better than nothing */
122    /* g->recwinlines=1; */
123  }
124
125  /* create the new windows */
126  g->recwin=newwin(g->recwinlines, cols, 0, 0);
127  if (g->recwin==NULL) {
128    owl_function_debugmsg("\n\nI just received an error on creating a new receive window\n");
129    owl_function_debugmsg("newwin was called with arguments (%i, %i, 0, 0) and returned NULL\n",
130           g->recwinlines, cols);
131    endwin();
132
133    exit(50);
134  }
135     
136  g->sepwin=newwin(1, cols, g->recwinlines, 0);
137  g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
138  g->typwin=newwin(typwin_lines, cols, g->recwinlines+2, 0);
139
140  owl_editwin_set_curswin(&(g->tw), g->typwin, typwin_lines, g->cols);
141
142  idlok(g->typwin, FALSE);
143  idlok(g->recwin, FALSE);
144  idlok(g->sepwin, FALSE);
145  idlok(g->msgwin, FALSE);
146
147  nodelay(g->typwin, 1);
148  keypad(g->typwin, TRUE);
149  wmove(g->typwin, 0, 0);
150
151  meta(g->typwin, TRUE);
152}
153
154owl_context *owl_global_get_context(owl_global *g) {
155  return(&g->ctx);
156}
157                         
158int owl_global_get_lines(owl_global *g) {
159  return(g->lines);
160}
161
162int owl_global_get_cols(owl_global *g) {
163  return(g->cols);
164}
165
166int owl_global_get_recwin_lines(owl_global *g) {
167  return(g->recwinlines);
168}
169
170/* curmsg */
171
172int owl_global_get_curmsg(owl_global *g) {
173  return(g->curmsg);
174}
175
176void owl_global_set_curmsg(owl_global *g, int i) {
177  g->curmsg=i;
178  /* we will reset the vertical offset from here */
179  /* we might want to move this out to the functions later */
180  owl_global_set_curmsg_vert_offset(g, 0);
181}
182
183/* topmsg */
184
185int owl_global_get_topmsg(owl_global *g) {
186  return(g->topmsg);
187}
188
189void owl_global_set_topmsg(owl_global *g, int i) {
190  g->topmsg=i;
191}
192
193/* windows */
194
195owl_mainwin *owl_global_get_mainwin(owl_global *g) {
196  return(&(g->mw));
197}
198
199owl_popwin *owl_global_get_popwin(owl_global *g) {
200  return(&(g->pw));
201}
202
203/* msglist */
204
205owl_messagelist *owl_global_get_msglist(owl_global *g) {
206  return(&(g->msglist));
207}
208
209/* keyhandler */
210
211owl_keyhandler *owl_global_get_keyhandler(owl_global *g) {
212  return(&(g->kh));
213}
214
215/* curses windows */
216
217WINDOW *owl_global_get_curs_recwin(owl_global *g) {
218  return(g->recwin);
219}
220
221WINDOW *owl_global_get_curs_sepwin(owl_global *g) {
222  return(g->sepwin);
223}
224
225WINDOW *owl_global_get_curs_msgwin(owl_global *g) {
226  return(g->msgwin);
227}
228
229WINDOW *owl_global_get_curs_typwin(owl_global *g) {
230  return(g->typwin);
231}
232
233/* typwin */
234
235owl_editwin *owl_global_get_typwin(owl_global *g) {
236  return(&(g->tw));
237}
238
239/* buffercommand */
240
241void owl_global_set_buffercommand(owl_global *g, char *command) {
242  if (g->buffercommand) owl_free(g->buffercommand);
243  g->buffercommand=owl_strdup(command);
244}
245
246char *owl_global_get_buffercommand(owl_global *g) {
247  if (g->buffercommand) return(g->buffercommand);
248  return("");
249}
250
251/* refresh */
252
253int owl_global_is_needrefresh(owl_global *g) {
254  if (g->needrefresh==1) return(1);
255  return(0);
256}
257
258void owl_global_set_needrefresh(owl_global *g) {
259  g->needrefresh=1;
260}
261
262void owl_global_set_noneedrefresh(owl_global *g) {
263  g->needrefresh=0;
264}
265
266/* variable dictionary */
267
268owl_vardict *owl_global_get_vardict(owl_global *g) {
269  return &(g->vars);
270}
271
272/* command dictionary */
273
274owl_cmddict *owl_global_get_cmddict(owl_global *g) {
275  return &(g->cmds);
276}
277
278/* rightshift */
279
280void owl_global_set_rightshift(owl_global *g, int i) {
281  g->rightshift=i;
282}
283
284int owl_global_get_rightshift(owl_global *g) {
285  return(g->rightshift);
286}
287
288/* typwin */
289
290int owl_global_is_typwin_active(owl_global *g) {
291  if (g->typwinactive==1) return(1);
292  return(0);
293}
294
295void owl_global_set_typwin_active(owl_global *g) {
296  g->typwinactive=1;
297}
298
299void owl_global_set_typwin_inactive(owl_global *g) {
300  g->typwinactive=0;
301}
302
303/* resize */
304
305void owl_global_set_resize_pending(owl_global *g) {
306  g->resizepending=1;
307}
308
309char *owl_global_get_homedir(owl_global *g) {
310  if (g->homedir) return(g->homedir);
311  return("/");
312}
313
314int owl_global_get_direction(owl_global *g) {
315  return(g->direction);
316}
317
318void owl_global_set_direction_downwards(owl_global *g) {
319  g->direction=OWL_DIRECTION_DOWNWARDS;
320}
321
322void owl_global_set_direction_upwards(owl_global *g) {
323  g->direction=OWL_DIRECTION_UPWARDS;
324}
325
326/* perl stuff */
327
328void owl_global_set_perlinterp(owl_global *g, void *p) {
329  g->perl=p;
330}
331
332void *owl_global_get_perlinterp(owl_global *g) {
333  return(g->perl);
334}
335
336int owl_global_is_config_format(owl_global *g) {
337  if (g->config_format) return(1);
338  return(0);
339}
340
341void owl_global_set_config_format(owl_global *g, int state) {
342  if (state==1) {
343    g->config_format=1;
344  } else {
345    g->config_format=0;
346  }
347}
348
349void owl_global_set_have_config(owl_global *g) {
350  g->haveconfig=1;
351}
352
353void owl_global_set_no_have_config(owl_global *g) {
354  g->haveconfig=0;
355}
356
357int owl_global_have_config(owl_global *g) {
358  if (g->haveconfig) return(1);
359  return(0);
360}
361
362void owl_global_resize(owl_global *g, int x, int y) {
363  /* resize the screen.  If x or y is 0 use the terminal size */
364  struct winsize size;
365   
366  if (!g->resizepending) return;
367
368  /* delete the current windows */
369  delwin(g->recwin);
370  delwin(g->sepwin);
371  delwin(g->msgwin);
372  delwin(g->typwin);
373  if (!isendwin()) {
374    endwin();
375  }
376
377  refresh();
378
379  /* get the new size */
380  ioctl(STDIN_FILENO, TIOCGWINSZ, &size);
381  if (x==0) {
382    g->lines=size.ws_row;
383  } else {
384    g->lines=x;
385  }
386
387  if (y==0) {
388    g->cols=size.ws_col;
389  } else {
390    g->cols=y;
391  }
392
393  /* resizeterm(size.ws_row, size.ws_col); */
394
395  /* re-initialize the windows */
396  _owl_global_setup_windows(g);
397
398  /* in case any styles rely on the current width */
399  owl_messagelist_invalidate_formats(owl_global_get_msglist(g));
400
401  /* refresh stuff */
402  g->needrefresh=1;
403  owl_mainwin_redisplay(&(g->mw));
404  sepbar(NULL);
405
406  if (owl_global_is_typwin_active(g)) {
407    owl_editwin_redisplay(&(g->tw), 0);
408  }     
409  /* TODO: this should handle other forms of popwins */
410  if (owl_popwin_is_active(owl_global_get_popwin(g)) 
411      && owl_global_get_viewwin(g)) {
412    owl_popwin_refresh(owl_global_get_popwin(g));
413    owl_viewwin_redisplay(owl_global_get_viewwin(g), 0);
414  }
415
416  owl_function_debugmsg("New size is %i lines, %i cols.", size.ws_row, size.ws_col);
417  owl_function_makemsg("");
418  g->resizepending=0;
419}
420
421/* debug */
422
423int owl_global_is_debug_fast(owl_global *g) {
424  if (g->debug) return(1);
425  return(0);
426}
427
428/* starttime */
429
430time_t owl_global_get_starttime(owl_global *g) {
431  return(g->starttime);
432}
433
434time_t owl_global_get_runtime(owl_global *g) {
435  return(time(NULL)-g->starttime);
436}
437
438void owl_global_get_runtime_string(owl_global *g, char *buff) {
439  time_t diff;
440
441  diff=time(NULL)-owl_global_get_starttime(g);
442
443  /* print something nicer later */   
444  sprintf(buff, "%i seconds", (int) diff);
445}
446
447char *owl_global_get_hostname(owl_global *g) {
448  if (g->thishost) return(g->thishost);
449  return("");
450}
451
452/* userclue */
453
454void owl_global_set_userclue(owl_global *g, int clue) {
455  g->userclue=clue;
456}
457
458void owl_global_add_userclue(owl_global *g, int clue) {
459  g->userclue|=clue;
460}
461
462int owl_global_get_userclue(owl_global *g) {
463  return(g->userclue);
464}
465
466int owl_global_is_userclue(owl_global *g, int clue) {
467  if (g->userclue & clue) return(1);
468  return(0);
469}
470
471/* viewwin */
472
473owl_viewwin *owl_global_get_viewwin(owl_global *g) {
474  return(&(g->vw));
475}
476
477
478/* vert offset */
479
480int owl_global_get_curmsg_vert_offset(owl_global *g) {
481  return(g->curmsg_vert_offset);
482}
483
484void owl_global_set_curmsg_vert_offset(owl_global *g, int i) {
485  g->curmsg_vert_offset=i;
486}
487
488/* startup args */
489
490void owl_global_set_startupargs(owl_global *g, int argc, char **argv) {
491  int i, len;
492
493  if (g->startupargs) owl_free(g->startupargs);
494 
495  len=0;
496  for (i=0; i<argc; i++) {
497    len+=strlen(argv[i])+5;
498  }
499  g->startupargs=malloc(len+5);
500
501  strcpy(g->startupargs, "");
502  for (i=0; i<argc; i++) {
503    sprintf(g->startupargs, "%s%s ", g->startupargs, argv[i]);
504  }
505  g->startupargs[strlen(g->startupargs)-1]='\0';
506}
507
508char *owl_global_get_startupargs(owl_global *g) {
509  if (g->startupargs) return(g->startupargs);
510  return("");
511}
512
513/* history */
514
515owl_history *owl_global_get_msg_history(owl_global *g) {
516  return(&(g->msghist));
517}
518
519owl_history *owl_global_get_cmd_history(owl_global *g) {
520  return(&(g->cmdhist));
521}
522
523/* filterlist */
524
525owl_list *owl_global_get_filterlist(owl_global *g) {
526  return(&(g->filterlist));
527}
528
529owl_filter *owl_global_get_filter(owl_global *g, char *name) {
530  int i, j;
531  owl_filter *f;
532
533  j=owl_list_get_size(&(g->filterlist));
534  for (i=0; i<j; i++) {
535    f=owl_list_get_element(&(g->filterlist), i);
536    if (!strcmp(name, owl_filter_get_name(f))) {
537      return(f);
538    }
539  }
540  return(NULL);
541}
542
543void owl_global_add_filter(owl_global *g, owl_filter *f) {
544  owl_list_append_element(&(g->filterlist), f);
545}
546
547void owl_global_remove_filter(owl_global *g, char *name) {
548  int i, j;
549  owl_filter *f;
550
551  j=owl_list_get_size(&(g->filterlist));
552  for (i=0; i<j; i++) {
553    f=owl_list_get_element(&(g->filterlist), i);
554    if (!strcmp(name, owl_filter_get_name(f))) {
555      owl_filter_free(f);
556      owl_list_remove_element(&(g->filterlist), i);
557      break;
558    }
559  }
560}
561
562/* nextmsgid */
563
564int owl_global_get_nextmsgid(owl_global *g) {
565  return(g->nextmsgid++);
566}
567
568/* current view */
569
570owl_view *owl_global_get_current_view(owl_global *g) {
571  return(&(g->current_view));
572}
573
574owl_filterelement *owl_global_get_filterelement_true(owl_global *g) {
575  return(&(g->fe_true));
576}
577
578owl_filterelement *owl_global_get_filterelement_false(owl_global *g) {
579  return(&(g->fe_false));
580}
581
582owl_filterelement *owl_global_get_filterelement_null(owl_global *g) {
583  return(&(g->fe_null));
584}
585
586/* has colors */
587
588int owl_global_get_hascolors(owl_global *g) {
589  if (g->hascolors) return(1);
590  return(0);
591}
592
593/* color pairs */
594
595int owl_global_get_colorpairs(owl_global *g) {
596  return(g->colorpairs);
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
804char *owl_global_get_response(owl_global *g)
805{
806  if (g->response==NULL) return("");
807  return(g->response);
808}
809
810void owl_global_set_response(owl_global *g, char *resp)
811{
812  if (g->response) owl_free(g->response);
813  g->response=owl_strdup(resp);
814}
815
816
817void owl_global_set_haveaim(owl_global *g)
818{
819  g->haveaim=1;
820}
821
822int owl_global_is_haveaim(owl_global *g)
823{
824  if (g->haveaim) return(1);
825  return(0);
826}
827
828void owl_global_set_havezephyr(owl_global *g)
829{
830  g->havezephyr=1;
831}
832
833int owl_global_is_havezephyr(owl_global *g)
834{
835  if (g->havezephyr) return(1);
836  return(0);
837}
838
839owl_timer *owl_global_get_aim_buddyinfo_timer(owl_global *g)
840{
841  return(&(g->aim_buddyinfo_timer));
842}
843
844owl_errqueue *owl_global_get_errqueue(owl_global *g)
845{
846  return(&(g->errqueue));
847}
848
849void owl_global_set_errsignal(owl_global *g, int signum, siginfo_t *siginfo)
850{
851  g->got_err_signal = signum;
852  if (siginfo) {
853    g->err_signal_info = *siginfo;
854  } else {
855    memset(&(g->err_signal_info), 0, sizeof(siginfo_t));
856  }
857}
858
859int owl_global_get_errsignal_and_clear(owl_global *g, siginfo_t *siginfo)
860{
861  int signum;
862  if (siginfo && g->got_err_signal) {
863    *siginfo = g->err_signal_info;
864  } 
865  signum = g->got_err_signal;
866  g->got_err_signal = 0;
867  return signum;
868}
869
Note: See TracBrowser for help on using the repository browser.