File: send.c

package info (click to toggle)
fakeroot 0.0-17
  • links: PTS
  • area: main
  • in suites: slink
  • size: 160 kB
  • ctags: 189
  • sloc: ansic: 690; cpp: 543; makefile: 126; sh: 68
file content (25 lines) | stat: -rw-r--r-- 442 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdio.h>
#include "fakeroot.h"

void main(int argc, char **argv){
  int msg;
  key_t key;
  struct my_msgbuf buf;
  int l;
  int r;

  key=ftok("./get", FAKE_PROJ);
  msg=msgget(key,IPC_CREAT|0600);
  printf("msg=%i, key=%i\n",msg,key);

  l=strlen(argv[1])+1;
  buf.mtype=1;
  strcpy(buf.mtext,argv[1]);
  r=msgsnd(msg,&buf, l, 0);
  if(r)
   perror("send");	   
}