Listing 5

/* Remove message queue. The argument buf
 * is not needed but is casted to keep the
 * compiler happy.
*/
if (msgctl(msqid, IPC_RMID, (struct msqid_ds *)0) == -1) {
   /* The perror(3C) function prints the
    * text of the error number contained
    * in the external integer errno.
   */
       perror("msgctl() failed: ");
       return(-1);
}