msgop.2: Minor tweaks to Bill Pemberton's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-03-09 08:30:16 +01:00
parent b60093ff6a
commit a98b2e1b98
1 changed files with 5 additions and 5 deletions

View File

@ -583,7 +583,7 @@ and
.BR msgrcv ().
The example program is first run with the \fB\-s\fP option to send a
message and then run again with the \fB-r\fP option to receive a
message and then run again with the \fB\-r\fP option to receive a
message.
The following shell session shows a sample run of the program:
@ -601,8 +601,6 @@ message received: a message at Wed Mar 4 16:25:45 2015
.SS Program source
\&
.nf
/* msgop.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -642,9 +640,11 @@ send_msg(int qid, int msgtype)
msg.mtype = msgtype;
time(&t);
snprintf(msg.mtext, sizeof(msg.mtext), "a message at %s", ctime(&t));
snprintf(msg.mtext, sizeof(msg.mtext), "a message at %s",
ctime(&t));
if (msgsnd(qid, (void *) &msg, sizeof(msg.mtext), IPC_NOWAIT) == \-1) {
if (msgsnd(qid, (void *) &msg, sizeof(msg.mtext),
IPC_NOWAIT) == \-1) {
perror("msgsnd error");
exit(EXIT_FAILURE);
}