Clean up the ORCA/C NDA template. Add retries to the unmount step in creating the disk image because sometimes the disk is still busy.

This commit is contained in:
Jeremy Rand 2018-07-27 23:29:49 -04:00
parent 0aeb8ac646
commit 684f1efb71
2 changed files with 26 additions and 19 deletions

View File

@ -89,8 +89,20 @@ do
cd "$OLDDIR"
done
RETRIES=0
while [ $RETRIES -lt 5 ]
do
umount "$MOUNTDIR"
if [ $? != 0 ]
if [ $? -eq 0 ]
then
break
fi
RETRIES=`expr $RETRIES + 1`
sleep 1
done
if [ $RETRIES -ge 5 ]
then
echo Unable to unmount the disk image.
cleanupAndExit

View File

@ -32,19 +32,6 @@ static unsigned int resourceId;
static Str255 gStrBuf;
BOOLEAN OpenResourceFork(void)
{
GSString255Ptr fPtr;
unsigned id;
id = SetHandleID(0, FindHandle((Pointer) OpenResourceFork));
fPtr = (GSString255Ptr) LGetPathname2(id, 1);
if (toolerror() == 0)
resourceId = OpenResourceFile(1, NULL, (Pointer) fPtr);
return toolerror() == 0;
}
void NDAClose(void)
{
if (ndaActive) {
@ -98,6 +85,7 @@ GrafPortPtr NDAOpen(void)
oldResourceApp = GetCurResourceApp();
ResourceStartUp(userId);
pathToSelf = LGetPathname2(userId, 1);
levelDCB.pCount = 2;
@ -119,7 +107,6 @@ GrafPortPtr NDAOpen(void)
SetSysWindow(winPtr);
ShowWindow(winPtr);
SelectWindow(winPtr);
SetPort(winPtr);
ndaActive = TRUE;
@ -135,7 +122,7 @@ GrafPortPtr NDAOpen(void)
}
void HandleAction(void)
void HandleRun(void)
{
}
@ -150,6 +137,11 @@ void HandleKey(EventRecord *event)
}
void HandleCursor(void)
{
}
void HandleMenu(int menuItem)
{
}
@ -157,14 +149,13 @@ void HandleMenu(int menuItem)
BOOLEAN NDAAction(EventRecord *sysEvent, int code)
{
int event;
static EventRecord localEvent;
unsigned int eventCode;
BOOLEAN result = FALSE;
switch (code) {
case runAction:
HandleAction();
HandleRun();
break;
case eventAction:
@ -189,6 +180,10 @@ BOOLEAN NDAAction(EventRecord *sysEvent, int code)
}
break;
case cursorAction:
HandleCursor();
break;
case cutAction:
case copyAction:
case pasteAction: