ftp.nice.ch/pub/next/unix/graphics/urt.3.0.s.tar.gz#/urt.3.0.s/get/gmr27/getgmr.c

This is getgmr.c in view mode; [Download] [Up]

/* 
 * getgmr.c - Copy a file to the frame buffer.
 * 
 * Author:	Spencer W. Thomas
 * 		Computer Science Dept.
 * 		University of Utah
 * Date:	1 April 1981
 * Copyright (c) 1981 Spencer W. Thomas
 * 
 * $Id: getgmr.c,v 3.0.1.1 90/11/19 16:45:21 spencer Exp $
 */

#include "rle_config.h"
#include "stdio.h"
#include "getfb.h"
#include "rle_code.h"
#ifdef USE_STDLIB_H
#include <stdlib.h>
#endif

int x = 0, y = 0, posflag = 0, background = 0, query = 0, debug = 0,
    cflag = 0, getchan, putchan = -1;

main(argc, argv)
char **argv;
{
	char * fname = NULL;
	short magic;

	if (scanargs(argc, argv,
		    "% D%- q%- BO%- Pi%-x!dy!d c%-channel!dinto%d file%s ",
			&debug,
			&query, &background, &posflag, &x, &y,
			&cflag, &getchan, &putchan, &fname) == 0)
	    exit(1);

        fd = rle_open_f("getgmr", fname, "r");
	if ((!query) && Fbopen() < 0)
	    exit(1);

	if (fread((char *)&magic, sizeof(short), 1, fd) != 1)
	{
	    fprintf(stderr, "Can't read magic number\n");
	    exit(1);
	}

	switch(magic)
	{
	case (RLE_MAGIC):
	    if (query)
		fprintf(stderr, "Image saved in Run Length Encoded form\n");
	    XtndRunGet(magic);
	    break;

	default:
	    fprintf(stderr,
		"File not an RLE file, can't restore (magic=0x%x)\n",
		magic);
	    exit(1);
	    break;
	}
    return 0;
}

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