Implement image mounting in the CDev.

This commit is contained in:
Stephen Heumann 2018-08-12 22:01:25 -05:00
parent 4dbfd93179
commit 9fc13e108a
2 changed files with 39 additions and 1 deletions

28
cdev.c
View File

@ -2,13 +2,17 @@
#include <types.h>
#include <stddef.h>
#include <stdio.h>
#include <gsos.h>
#include <orca.h>
#include <quickdraw.h>
#include <qdaux.h>
#include <window.h>
#include <control.h>
#include <lineedit.h>
#include <desk.h>
#include <locator.h>
#include "mounturl.h"
#define MachineCDEV 1
#define BootCDEV 2
@ -28,17 +32,39 @@
//#define optionsPopUp 6
//#define trianglePic 7
#define mountURLError 3000
extern void FreeAllCDevMem(void);
char urlBuf[257];
WindowPtr wPtr = NULL;
struct MountURLRec mountURLRec = {sizeof(struct MountURLRec)};
void DoMount(void)
{
char numStr[6] = "";
char *subs[1] = {numStr};
WaitCursor();
GetLETextByID(wPtr, urlLine, (StringPtr)&urlBuf);
//TODO
mountURLRec.result = NETDISK_NOT_PRESENT;
mountURLRec.url = urlBuf + 1;
SendRequest(MountURL, sendToName|stopAfterOne, (Long)NETDISK_REQUEST_NAME,
(Long)&mountURLRec, NULL);
InitCursor();
if (mountURLRec.result != OPERATION_SUCCESSFUL) {
//TODO better error messages
snprintf(numStr, sizeof(numStr), "%u", mountURLRec.result);
AlertWindow(awResource+awCString+awButtonLayout, (Pointer)subs,
mountURLError);
}
}
void DoHit(long ctlID, CtlRecHndl ctlHandle)

View File

@ -255,3 +255,15 @@ resource rTextForLETextBox2 (helpWindow+helpTxt) {
"hosted on HTTP servers.\n"
};
/*
* Error messages
*/
#define mountURLError 3000
resource rAlertString (mountURLError) {
"32:"
"MountURL error *0."
":^#0\$00"
};