ftp.nice.ch/pub/next/connectivity/news/NewsBase.3.02.s.tar.gz#/NewsBase302.source/MMEdit/IFtpD.m

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

/*$Copyright:
 * Copyright (C) 1992.5.22. Recruit Co.,Ltd. 
 * Institute for Supercomputing Research
 * All rights reserved.
 * NewsBase  by ISR, Kazuto MIYAI, Gary ARAKAKI, Katsunori SUZUKI, Kok-meng Lue
 *
 * You may freely copy, distribute and reuse the code in this program under 
 * following conditions.
 * - to include this notice in the source code, if it is to be distributed 
 *   with source code.
 * - to add the file named "COPYING" within the code, which shall include 
 *   GNU GENERAL PUBLIC LICENSE(*).
 * - to display an acknowledgement in binary code as follows: "This product
 *   includes software developed by Recruit Co.,Ltd., ISR."
 * - to display a notice which shall state that the users may freely copy,
 *   distribute and reuse the code in this program under GNU GENERAL PUBLIC
 *   LICENSE(*)
 * - to indicate the way to access the copy of GNU GENERAL PUBLIC LICENSE(*)
 *
 *   (*)GNU GENERAL PUBLIC LICENSE is stored in the file named COPYING
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
$*/

#import "IFtpD.h"

#import <string.h>
#import <objc/hashtable.h>
#import <libc.h>
#import <sys/types.h>
#import <sys/stat.h>
#import <appkit/NXImage.h>
#import <math.h>
#import "ftp.h"
#import "data_types.h"
#import "errdebug.h"

// An object oriented interface to ftp routines.  This class is intended to
// support anonymous ftp as yet another external domain but is currently
// unused. 


@implementation IFtpD

static NXAtom rtfControlWord;
static NXAtom fileExtension;
static NXImage *icon;
static NXImage *image;

+ initialize
{
    rtfControlWord = NXUniqueStringNoCopy("MMftp");
    fileExtension = NXUniqueStringNoCopy("ftp");
    image = [[NXImage alloc] initFromSection:"FTP.tiff"];
    [IMediaD getFileIconFor:(Class)self];
    return(self);
}

+ (NXAtom)rtfControlWord
{
    return(rtfControlWord);
}

+ (NXAtom)fileExtension;
{
    return(fileExtension);
}

+ (NXAtom)pasteboardType
{
    return(NULL);
}

+ setIcon:(NXImage *)theIcon
{
    icon = theIcon;
    return(self);
}

+ (NXImage *)icon
{
    return(icon);
}

- (NXImage *)image
{
    return(image);
}

- initWithKey:(const char *)hostPath
{
    char *ptr;

    path = NXCopyStringBufferFromZone(hostPath, [self zone]);
    if ((ptr = rindex(path, '.')) == 0) {
        return([self free]);
    }
    *ptr = '\0';
    if ((ptr = rindex(path, '@')) == 0) {
        return([self free]);
    }
    *ptr = '\0';
    host = ptr + 1;
}

- performDoubleClickAction:sender
{
    ftp(host, NXGetDefaultValue(OWNER, FROM), path, "/tmp/ftp");
    return(self);
}

- (BOOL)readFromStream:(NXStream *)inStream
{
    return(YES);
}

- free
{
    NXZoneFree([self zone], path);
    return [super free];
}

@end

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