Revision 1101
added some vague file type checking to prevent running simulator in simulator
updated the makefile to make simulator executable filenames end in .csim
robot.c | ||
---|---|---|
123 | 123 |
Robot* r = &robots[id]; |
124 | 124 |
// do shared memory stuff here |
125 | 125 |
key_t key = IPC_PRIVATE; |
126 |
|
|
127 |
|
|
128 |
/* colony simulator executable must end in .csim */ |
|
129 |
if(strstr(execname, ".csim") - execname != strlen(execname) - 5) |
|
130 |
{ |
|
131 |
fprintf(stderr, "Error, \"%s\" is not recognized as a colony simulator executable\n", execname); |
|
132 |
return -1; |
|
133 |
} |
|
134 |
|
|
126 | 135 |
//Memory accessible only to children with r/w privileges |
127 | 136 |
r->sharedMemID = shmget(key, sizeof(RobotShared), IPC_CREAT | 0666); |
128 | 137 |
|
Also available in: Unified diff