mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-22 00:32:44 +00:00
need a test for volume/directory calls
This commit is contained in:
parent
3448078612
commit
acea989367
@ -1,3 +1,10 @@
|
||||
|
||||
# ignore built-in rules, don't delete intermediate .o files.
|
||||
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
.SUFFIXES:
|
||||
.SECONDARY:
|
||||
|
||||
LIBS = \
|
||||
{Libraries}Stubs.o \
|
||||
{CLibraries}StdCLib.o \
|
||||
@ -15,26 +22,29 @@ LDFLAGS = -w -c 'MPS ' -t MPST \
|
||||
|
||||
SCFLAGS = -p
|
||||
|
||||
TARGETS = test_new_handle test_new_handle_2 test_new_pointer
|
||||
TARGETS = test_new_handle test_new_handle_2 test_new_pointer test_volumes
|
||||
|
||||
all : $(TARGETS)
|
||||
|
||||
clean :
|
||||
rm -f $(TARGETS) o/*
|
||||
|
||||
test_new_handle : o/test_new_handle.o
|
||||
mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
test_new_handle_2 : o/test_new_handle_2.o
|
||||
mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
test_new_pointer : o/test_new_pointer.o
|
||||
mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
|
||||
# % : o/%.o
|
||||
# test_new_handle : o/test_new_handle.o
|
||||
# mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
# test_new_handle_2 : o/test_new_handle_2.o
|
||||
# mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
# test_new_pointer : o/test_new_pointer.o
|
||||
# mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
# test_volumes : o/test_volumes.o
|
||||
# mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
|
||||
% : o/%.o
|
||||
mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
o/%.o : %.c
|
||||
mpw SC $(SCFLAGS) $< -o $@
|
||||
|
||||
|
46
test/test_volumes.c
Normal file
46
test/test_volumes.c
Normal file
@ -0,0 +1,46 @@
|
||||
#include <Files.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void gv(StringPtr name)
|
||||
{
|
||||
OSErr err;
|
||||
short vRefNum;
|
||||
err = GetVol(name, &vRefNum);
|
||||
|
||||
if (err) fprintf(stdout, "GetVol(%s): Error = %d\n", name ? name + 1 : (StringPtr)"", err);
|
||||
else fprintf(stdout, "GetVol(%s): vRefNum = %d\n", name ? name + 1 : (StringPtr)"", vRefNum);
|
||||
}
|
||||
|
||||
|
||||
void hgv(StringPtr name)
|
||||
{
|
||||
OSErr err;
|
||||
short vRefNum;
|
||||
long dirID;
|
||||
|
||||
err = HGetVol(name, &vRefNum, &dirID);
|
||||
|
||||
if (err) fprintf(stdout, "HGetVol(%s): Error = %d\n", name ? name + 1 : (StringPtr)"", err);
|
||||
else fprintf(stdout, "HGetVol(%s): vRefNum = %d dirID = %d\n",
|
||||
name ? name + 1 : (StringPtr)"", vRefNum, dirID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
gv(NULL);
|
||||
gv((StringPtr)"\pMacOS");
|
||||
|
||||
|
||||
hgv(NULL);
|
||||
hgv((StringPtr)"\pMacOS");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user