int lockname (char *lock,char *fname,int op) { int ld; char c,*s; if (!((s = lockdir (lock,getenv ("TEMP"),NIL)) || (s = lockdir (lock,getenv ("TMP"),NIL)) || (s = lockdir (lock,getenv ("TMPDIR"),NIL)) || /* C:\TEMP is last resort */ (s = lockdir (lock,defaultDrive (),"TEMP")))) { mm_log ("Unable to find temporary directory",ERROR); return -1; } /* generate file name */ while (c = *fname++) switch (c) { case '/': case '\\': case ':': *s++ = '!'; /* convert bad chars to ! */ break; default: *s++ = c; break; } *s++ = c; /* tie off name */ /* get the lock */ if (((ld = open (lock,O_BINARY|O_RDWR|O_CREAT,S_IREAD|S_IWRITE)) >= 0) && op) flock (ld,op); /* apply locking function */ return ld; /* return locking file descriptor */ }
void FourWheelOmniPilot::drive (Robot* rob, float x_goal, float y_goal, float theta_goal, float x_goal2, float y_goal2, MoveType moveType){ switch (moveType) { case MoveType::facePoint: facePointDrive(rob,x_goal,y_goal,theta_goal); break; case MoveType::dribble: dribbleDrive(rob,x_goal,y_goal,theta_goal); break; default: defaultDrive(rob,x_goal,y_goal,theta_goal, x_goal2, y_goal2); } }