Changeset 609 for branches/GNU/src/binutils/libiberty/strsignal.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/libiberty/strsignal.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 18 18 declare it ourselves. With luck, this will always work. */ 19 19 #define sys_siglist no_such_symbol 20 #define sys_nsig sys_nsig__no_such_symbol 20 21 21 22 #include <stdio.h> … … 39 40 found in the system header files. */ 40 41 #undef sys_siglist 42 #undef sys_nsig 41 43 42 44 #ifndef NULL 43 # ifdef __STDC__45 # ifdef ANSI_PROTOTYPES 44 46 # define NULL (void *) 0 45 47 # else … … 66 68 struct signal_info 67 69 { 68 int value; /* The numeric value from <signal.h> */69 const char * name; /* The equivalent symbolic value */70 const int value; /* The numeric value from <signal.h> */ 71 const char *const name; /* The equivalent symbolic value */ 70 72 #ifndef HAVE_SYS_SIGLIST 71 const char * msg; /* Short message about this value */73 const char *const msg; /* Short message about this value */ 72 74 #endif 73 75 }; … … 349 351 /* 350 352 351 NAME 352 353 signo_max -- return the max signo value 354 355 SYNOPSIS 356 357 int signo_max (); 358 359 DESCRIPTION 360 361 Returns the maximum signo value for which a corresponding symbolic 362 name or message is available. Note that in the case where 363 we use the sys_siglist supplied by the system, it is possible for 364 there to be more symbolic names than messages, or vice versa. 365 In fact, the manual page for psignal(3b) explicitly warns that one 366 should check the size of the table (NSIG) before indexing it, 367 since new signal codes may be added to the system before they are 368 added to the table. Thus NSIG might be smaller than value 369 implied by the largest signo value defined in <signal.h>. 370 371 We return the maximum value that can be used to obtain a meaningful 372 symbolic name or message. 353 @deftypefn Extension int signo_max (void) 354 355 Returns the maximum signal value for which a corresponding symbolic 356 name or message is available. Note that in the case where we use the 357 @code{sys_siglist} supplied by the system, it is possible for there to 358 be more symbolic names than messages, or vice versa. In fact, the 359 manual page for @code{psignal(3b)} explicitly warns that one should 360 check the size of the table (@code{NSIG}) before indexing it, since 361 new signal codes may be added to the system before they are added to 362 the table. Thus @code{NSIG} might be smaller than value implied by 363 the largest signo value defined in @code{<signal.h>}. 364 365 We return the maximum value that can be used to obtain a meaningful 366 symbolic name or message. 367 368 @end deftypefn 373 369 374 370 */ … … 390 386 /* 391 387 392 NAME 393 394 strsignal -- map a signal number to a signal message string 395 396 SYNOPSIS 397 398 const char *strsignal (int signo) 399 400 DESCRIPTION 401 402 Maps an signal number to an signal message string, the contents of 403 which are implementation defined. On systems which have the external 404 variable sys_siglist, these strings will be the same as the ones used 405 by psignal(). 406 407 If the supplied signal number is within the valid range of indices 408 for the sys_siglist, but no message is available for the particular 409 signal number, then returns the string "Signal NUM", where NUM is the 410 signal number. 411 412 If the supplied signal number is not a valid index into sys_siglist, 413 returns NULL. 414 415 The returned string is only guaranteed to be valid only until the 416 next call to strsignal. 388 @deftypefn Supplemental {const char *} strsignal (int @var{signo}) 389 390 Maps an signal number to an signal message string, the contents of 391 which are implementation defined. On systems which have the external 392 variable @code{sys_siglist}, these strings will be the same as the 393 ones used by @code{psignal()}. 394 395 If the supplied signal number is within the valid range of indices for 396 the @code{sys_siglist}, but no message is available for the particular 397 signal number, then returns the string @samp{Signal @var{num}}, where 398 @var{num} is the signal number. 399 400 If the supplied signal number is not a valid index into 401 @code{sys_siglist}, returns @code{NULL}. 402 403 The returned string is only guaranteed to be valid only until the next 404 call to @code{strsignal}. 405 406 @end deftypefn 417 407 418 408 */ … … 460 450 /* 461 451 462 NAME 463 464 strsigno -- map an signal number to a symbolic name string 465 466 SYNOPSIS 467 468 const char *strsigno (int signo) 469 470 DESCRIPTION 471 472 Given an signal number, returns a pointer to a string containing 473 the symbolic name of that signal number, as found in <signal.h>. 474 475 If the supplied signal number is within the valid range of indices 476 for symbolic names, but no name is available for the particular 477 signal number, then returns the string "Signal NUM", where NUM is 478 the signal number. 479 480 If the supplied signal number is not within the range of valid 481 indices, then returns NULL. 482 483 BUGS 484 485 The contents of the location pointed to are only guaranteed to be 486 valid until the next call to strsigno. 452 @deftypefn Extension {const char*} strsigno (int @var{signo}) 453 454 Given an signal number, returns a pointer to a string containing the 455 symbolic name of that signal number, as found in @code{<signal.h>}. 456 457 If the supplied signal number is within the valid range of indices for 458 symbolic names, but no name is available for the particular signal 459 number, then returns the string @samp{Signal @var{num}}, where 460 @var{num} is the signal number. 461 462 If the supplied signal number is not within the range of valid 463 indices, then returns @code{NULL}. 464 465 The contents of the location pointed to are only guaranteed to be 466 valid until the next call to @code{strsigno}. 467 468 @end deftypefn 487 469 488 470 */ … … 523 505 /* 524 506 525 NAME 526 527 strtosigno -- map a symbolic signal name to a numeric value 528 529 SYNOPSIS 530 531 int strtosigno (char *name) 532 533 DESCRIPTION 534 535 Given the symbolic name of a signal, map it to a signal number. 536 If no translation is found, returns 0. 507 @deftypefn Extension int strtosigno (const char *@var{name}) 508 509 Given the symbolic name of a signal, map it to a signal number. If no 510 translation is found, returns 0. 511 512 @end deftypefn 537 513 538 514 */ … … 569 545 /* 570 546 571 NAME 572 573 psignal -- print message about signal to stderr 574 575 SYNOPSIS 576 577 void psignal (unsigned signo, char *message); 578 579 DESCRIPTION 580 581 Print to the standard error the message, followed by a colon, 582 followed by the description of the signal specified by signo, 583 followed by a newline. 547 @deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) 548 549 Print @var{message} to the standard error, followed by a colon, 550 followed by the description of the signal specified by @var{signo}, 551 followed by a newline. 552 553 @end deftypefn 554 584 555 */ 585 556 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.