#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdlib.h>
#define SHMSZ  27
main() {
  char c, *shm, *s;
  int chave= 5678, shmid;

  shmid= shmget(chave, SHMSZ, (IPC_CREAT|0666));
  shm= (char *)shmat(shmid, NULL, 0);

  s= shm;                 /* escreve info em memória */
  for (c='a'; c<='z'; c++)
    *s++= c;
  *s= '\0';
                          /* espera até que outro proc.  
                             altere o 1o. char em memória */
  while (*shm != '*')
    sleep(1);
  shmdt(shmid);  /* liberta segmento */
  exit(0);
}
