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
branches/simulator/projects/simulator/simulator/core/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 |
|
branches/simulator/projects/template/Makefile | ||
---|---|---|
343 | 343 |
sim: dist |
344 | 344 |
|
345 | 345 |
buildsim: $(SIMOBJ) |
346 |
$(SIMCC) $(SIMALL_CFLAGS) $^ -o $(TARGET) $(SIMLDFLAGS) |
|
346 |
$(SIMCC) $(SIMALL_CFLAGS) $^ -o $(TARGET).csim $(SIMLDFLAGS)
|
|
347 | 347 |
dist: buildsim |
348 | 348 |
$(CP) $(TARGET) $(PROJECTSROOT)/simulator/simulator/bin/ |
349 | 349 |
|
Also available in: Unified diff