übrigens hab ich auch schon ein gerüst für server, allerdings haperts hier noch an der zeitkodierungsumsetzung, am timer und an der signalbehandlung (fehlerbehandlung ist auch noch keine implementiert):
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/types.h>
#include <time.h>
#define SIZE 20
typedef struct
{
long mtype;
char mtext[SIZE];
}message;
int main(int argc, char *argv[])
{
getopt(argc, argv, "");
int qid = 0;
message ms;
char a_time[6];
char *ptype = NULL;
char *pendtype = NULL;
ms.text = "";
ptype = &a_time;
if((key_t key = ftok("key.txt", 'b')) == -1)
fputs("Error occured by creating key!");
if((qid = msgget(key, IPC_CREAT | 0660)) == -1)
fputs("Error occured by creating Message Queue!", stderr);
else
{
while(strcmp(ms.text, "quit") == 1)
{
msgrcv(qid, &ms, SIZE, 0, 1);
*ptype = strftime(time());
if(ms.type == strtol(ptype, pendtype, 10))
execl("/bin/sh","sh","-c",ms.mtext,NULL);
}
}
msgctl(qid, IPC_RMID, NULL);
}