ftp.nice.ch/pub/next/tools/workspace/eject.1.1.NI.bs.tar.gz#/eject.1.1.NI.bs/eject.m

This is eject.m in view mode; [Download] [Up]

#import <stdio.h>
#import <appkit/Application.h>
#import <appkit/workspaceRequest.h>

char *path;

@interface MyObj : Object
{
}
- appDidInit:sender;
@end

@implementation MyObj

- appDidInit:sender
{
    int rc;
    printf("App did init path=%s\n", path);
    
    [[Application workspace] unmountAndEjectDeviceAt:path];
    [NXApp perform:@selector(terminate:) with:self
        afterDelay:1000.0 cancelPrevious:NO];

    return self;
}
@end

main(int argc, char **argv)
{
    id obj;

    obj = [[MyObj alloc] init];

    if (argc != 2)
    {
	fprintf(stderr, "Usage: %s path\n", argv[0]);
	exit(1);
    }

    path = argv[1];
    printf("Ejecting %s\n", path);
    
    [Application new];
    [NXApp setDelegate:obj];
    [NXApp run];
    [NXApp free];
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.