|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1735 (0x6c7) Types: TextFile Names: »main.c++«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec1/image/scale/main.c++«
/* Main routine for scaling image Syntax of scale is: scale scale [increment [input.var [output.var]]] */ #include <stream.h> #include <stdio.h> #include <string.h> #include <vartools.h++> int main ( int argc , char *argv[] ) { switch(argc) { // if just scale given (acts as a pipe) case 2: scale(atof(argv[1]),0.,stdin,stdout,""); break; // if just scale and increment given (acts as a pipe) case 3: scale(atof(argv[1]),atof(argv[2]),stdin,stdout,""); break; // if scale, increment and input file given (output to stdout) case 4: { FILE *input; if(NULL == (input = fopen(argv[3],"r"))) { char * string = form("Could not open %s for reading:",argv[3]); perror(string); return 2; } scale(atof(argv[1]),atof(argv[2]),input,stdout,""); } break; // if scale, increment, input file and output file given case 5: { FILE *input; FILE *output; if(NULL == (input = fopen(argv[3],"r"))) { char * string = form("Could not open %s for reading:",argv[3]); perror(string); return 2; } if(NULL == (output = fopen(argv[4],"w"))) { char * string = form("Could not open %s for writing:",argv[3]); perror(string); return 3; } scale(atof(argv[1]),atof(argv[2]),input,output,""); } break; // if wrong arguments given default: cerr << "Syntax is: scale scale [increment [input.var [output.var]]]\n"; 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. */