mirror of https://github.com/mkerrisk/man-pages
msgop.2: Minor tweaks to Bill Pemberton's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
b60093ff6a
commit
a98b2e1b98
10
man2/msgop.2
10
man2/msgop.2
|
@ -583,7 +583,7 @@ and
|
||||||
.BR msgrcv ().
|
.BR msgrcv ().
|
||||||
|
|
||||||
The example program is first run with the \fB\-s\fP option to send a
|
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.
|
message.
|
||||||
|
|
||||||
The following shell session shows a sample run of the program:
|
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
|
.SS Program source
|
||||||
\&
|
\&
|
||||||
.nf
|
.nf
|
||||||
/* msgop.c */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -642,9 +640,11 @@ send_msg(int qid, int msgtype)
|
||||||
msg.mtype = msgtype;
|
msg.mtype = msgtype;
|
||||||
|
|
||||||
time(&t);
|
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");
|
perror("msgsnd error");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue