bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strsignal module


From: Bruno Haible
Subject: Re: strsignal module
Date: Tue, 8 Jan 2008 01:56:55 +0100
User-agent: KMail/1.5.4

Colin Watson wrote:
> I use strsignal in man-db, and would like a Gnulib module to cope with
> its portability problems. Here's one which seems to be doing the right
> thing for me so far. This is my first attempt at writing a Gnulib module
> from scratch, so I'd appreciate any comments, style or otherwise.

Thanks! It's very well done. Only a few minor nits:
  - All added or modified files should contain the year 2008 in the
    copyright statement.
  - The use of the macro gl_once_define should not have a semicolon at
    the end, otherwise you get an ANSI C syntax error on platforms where
    gl_once_define(...) expands to empty.
  - The unit test uses SIGHUP, which is not defined on mingw.
  - I don't understand the #if logic in the unit test. Shouldn't it be like
    this:?

int
main (int argc, char **argv)
{
  char *str;

#ifdef SIGHUP
  str = strsignal (SIGHUP);
  ASSERT (str);
  ASSERT (*str);

# if !HAVE_DECL_SYS_SIGLIST
  /* In this case, we can guarantee some signal descriptions.  */
  ASSERT (!strcmp (str, "Hangup"));
# endif
#endif

#ifdef SIGINT
  str = strsignal (SIGINT);
  ASSERT (str);
  ASSERT (*str);
# if !HAVE_DECL_SYS_SIGLIST
  /* In this case, we can guarantee some signal descriptions.  */
  ASSERT (!strcmp (str, "Interrupt"));
# endif
#endif

  return 0;
}


Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]