Thu, 07 Apr 2005 14:55:02 +0000
[gaim-migrate @ 12431]
" The following log snippets should explain it: " --rlaager
(20:24:00) rlaager: Regarding the signal handling
conversation the other day... I've written a patch to stop
calling signal handlers and return as soon as we find one
signal handler that returns TRUE to indicate that it's
handled the signal. Is this the right approach?
(20:24:22) Ethan Blanton (Paco-Paco): the trouble is that it's
documented to behave exactly the way it does
(20:24:31) Ethan Blanton (Paco-Paco): so changing it is
notbackwards compatible
(20:24:31) rlaager: I'm talking for HEAD.
(20:24:41) Ethan Blanton (Paco-Paco): oh, I think that's a
good approach, yes
(20:24:53) rlaager: The way I've described is how I
*expected* it to work, having not read the documentation.
(20:25:09) Ethan Blanton (Paco-Paco): I'm convinced
(20:27:04) Stu Tomlinson (nosnilmot): rlaager: this, I
assume, breaks the generic-ness of signals, by assuming
that any that return values return booleans?
(20:27:26) Ethan Blanton (Paco-Paco): please break it
(20:27:33) Ethan Blanton (Paco-Paco): we already have
out-parameters
(20:27:42) rlaager: nosnilmot: from what I can see, the
return type is handled as a (void *)... so I'm checking that
ret_value != NULL
(20:27:57) rlaager: nosnilmot: that's the correct way to do it,
right?
...
(20:29:01) Ethan Blanton (Paco-Paco): allowing a
meaningful return value is an over-engineering
(20:30:07) rlaager: even after this patch, you should be able
to return meaningful return values
(20:30:15) rlaager: it'll just short-circuit on the first handler
that does
committer: Luke Schierer <lschiere@pidgin.im>
| 2086 | 1 | /* |
| 2 | * $Header$ | |
| 3 | * $Source$ | |
| 4 | * $Locker$ | |
| 5 | * | |
| 6 | * Copyright 1987 by the Student Information Processing Board | |
| 7 | * of the Massachusetts Institute of Technology | |
| 8 | * | |
| 9 | * For copyright info, see "mit-sipb-copyright.h". | |
| 10 | */ | |
| 11 | ||
| 12 | #include "error_table.h" | |
| 13 | #include "mit-sipb-copyright.h" | |
| 14 | #include "com_err.h" | |
|
6903
56f56665ee88
[gaim-migrate @ 7450]
Mark Doliner <markdoliner@pidgin.im>
parents:
2086
diff
changeset
|
15 | #include <sysdep.h> |
| 2086 | 16 | |
| 17 | static const char rcsid[] = | |
| 18 | "$Header$"; | |
| 19 | static const char copyright[] = | |
| 20 | "Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology"; | |
| 21 | ||
| 22 | char *error_table_name_r __P((int, char *)); | |
| 23 | ||
| 24 | struct et_list * _et_list = (struct et_list *) NULL; | |
| 25 | ||
| 26 | const char * error_message (code) | |
| 27 | long code; | |
| 28 | { | |
| 29 | static char buf[COM_ERR_BUF_LEN]; | |
| 30 | ||
| 31 | return(error_message_r(code, buf)); | |
| 32 | } | |
| 33 | ||
| 34 | const char * error_message_r (code, buf) | |
| 35 | long code; | |
| 36 | char *buf; | |
| 37 | { | |
| 38 | int offset; | |
| 39 | struct et_list *et; | |
| 40 | int table_num; | |
| 41 | int started = 0; | |
| 42 | char *cp, namebuf[6]; | |
| 43 | ||
| 44 | offset = code & ((1<<ERRCODE_RANGE)-1); | |
| 45 | table_num = code - offset; | |
| 46 | if (!table_num) | |
| 47 | return strerror(offset); | |
| 48 | for (et = _et_list; et; et = et->next) { | |
| 49 | if (et->table->base == table_num) { | |
| 50 | /* This is the right table */ | |
| 51 | if (et->table->n_msgs <= offset) | |
| 52 | break; | |
| 53 | return(et->table->msgs[offset]); | |
| 54 | } | |
| 55 | } | |
| 56 | ||
| 57 | strcpy (buf, "Unknown code "); | |
| 58 | if (table_num) { | |
| 59 | strcat (buf, error_table_name_r (table_num, namebuf)); | |
| 60 | strcat (buf, " "); | |
| 61 | } | |
| 62 | for (cp = buf; *cp; cp++) | |
| 63 | ; | |
| 64 | if (offset >= 100) { | |
| 65 | *cp++ = '0' + offset / 100; | |
| 66 | offset %= 100; | |
| 67 | started++; | |
| 68 | } | |
| 69 | if (started || offset >= 10) { | |
| 70 | *cp++ = '0' + offset / 10; | |
| 71 | offset %= 10; | |
| 72 | } | |
| 73 | *cp++ = '0' + offset; | |
| 74 | *cp = '\0'; | |
| 75 | return(buf); | |
| 76 | } |