ftp.nice.ch/pub/next/connectivity/news/NGService.1.1.NIHS.bs.tar.gz#/NGService/Source/MMGraphicCell.m

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

/*
 *      You may freely copy, distribute and reuse the code
 *      in this example.  Scott Anguish disclaims any warranty of
 *      any kind, expressed or implied, as to its fitness
 *      for any particular use.
 *		Please keep this notice intact
 *      Written by: Scott Anguish  sanguish@digifix.com
 */

#import "MMGraphicCell.h"

#import <libc.h>					  /* MAXPATHLEN */
#import <stdio.h>
#import <strings.h>

#import <appkit/appkit.h>

#import <streams/streams.h>


@implementation MMGraphicCell:MMCell

- imageFromFilename:(const char *)filename
{
	
	theImage =[[NXImage alloc] initFromFile:filename];
	return self;
}

- imageFromAttachment
{
	char filename[MAXPATHLEN+1];

	sprintf(filename,"/tmp/%s",attachmentName);
	[self imageFromFilename:filename];
	return self;
}


- uudecodeAttachment
{
	FILE *fp;
	char commandStr[BUFSIZ];
	
	sprintf(commandStr,"rm -f /tmp/%s; /usr/bin/uudecode ",attachmentName);
	fp = popen (commandStr,"w");
	if (fp != (FILE *)NULL)
		{
		fprintf(fp,"begin 644 /tmp/%s\n",attachmentName);
		fwrite(attachmentData,sizeof(char),attachmentSize,fp);
		fprintf(fp,"end\n");
    	fprintf(stderr,"Pipe Result %d \n",pclose(fp));
		}
		else
		fprintf(stderr,"Pipe did not open \n");
	return self;
};


@end

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