All about programming in GNU/LINUX

Program to obtain the short description of a signal given the signal number

/*Program to obtain the short description of a signal
  given the signal number as input , using
  `strsignal()` system call in GNU/LINUX */

#include<string.h>
#include<signal.h>
int main()
{
    char *sigdescrip;
    int signo;
    sigdescrip= malloc(100);
    printf(“\nEnter the Signal Number: “);
    scanf(“%d”,&signo);
    sigdescrip=strsignal(signo);
    // char *strsignal(int signo);
    /*strsignal returns a character pointer to a string which stores
      the short signal description */
    printf(“\n\n%s\n\n”,sigdescrip);
    exit(0);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s