DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T m

⟦97676f87d⟧ TextFile

    Length: 1630 (0x65e)
    Types: TextFile
    Names: »main.c++«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/image/upperbound/main.c++« 

TextFile

/*
    This applies an upper bound to a var file
    The syntax is:
    upperbound bound [input.var [output.var]]
*/
#include <stream.h>
#include <stdio.h>
#include <vartools.h++>


int
main ( int argc , char *argv[] )
    {
    switch(argc)
	{
	// with 1 argument it acts as a pipe
    case 2:
	upper_bound(atof(argv[1]),stdin,stdout,"Bounding file from stdin\n");
    break;
	// with 2 arguments it reads from specified file and writes to stdout
    case 3:
	FILE *input;
	if(NULL == (input = fopen(argv[2],"r")))
	    {
	    perror(form("upperbound problem with openning %s:",argv[2]));
	    return 5;
	    }
	upper_bound(atof(argv[1]),input,stdout,form("bounding file %s\n",argv[2]));
    break;
	// with 3 arguments it reads from specified file and writes to 
	// specified file
    case 4:
	FILE *input;
	FILE *output;
	if(NULL == (input = fopen(argv[2],"r")))
	    {
	    perror(form("upperbound problem with openning %s:",argv[2]));
	    return 5;
	    }
	if(NULL == (output = fopen(argv[3],"w")))
	    {
	    perror(form("upperbound problem with openning %s:",argv[3]));
	    return 6;
	    }
	upper_bound(atof(argv[1]),input,output,form("bounding file %s to file %s\n",argv[2],argv[3]));
    break;
	// otherwise wrong number of arguments failure!
    default:
	cerr << "Syntax is: upperbound bound [input.var [output.var]]";
	return 1;
    break;
	}
    return 0;
    }
/*
Copyright (C) 1986, David Sher in the University of Rochester
Permission is granted to any individual or institution to use, copy, or
redistribute this software so long as it is not sold for profit, provided
this copyright notice is retained.
*/