home *** CD-ROM | disk | FTP | other *** search
- /*
- * main -- driver for suntops
- */
-
- #include <stdio.h>
-
- extern double atof();
- extern char *optarg;
- extern int optind;
-
- #include "suntops.h"
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- FILE *fpi;
- int opt;
- double height;
- int rotate;
- double width;
-
- rotate = FALSE;
- height = IMG_HEIGHT;
- width = IMG_WIDTH;
-
- while ((opt = getopt(argc, argv, "h:rw:")) != EOF) {
- switch (opt) {
-
- case 'r':
- rotate = TRUE;
- break;
-
- case 'h':
- height = atof(optarg);
- if (height <= 0.0 || height > PAGE_HEIGHT) {
- error("-h: bad height");
- }
-
- break;
-
- case 'w':
- width = atof(optarg);
- if (width <= 0.0 || width > PAGE_WIDTH) {
- error("-w: bad width");
- }
-
- break;
-
- default:
- error(
- "Usage: suntops [-r] [-h height] [-w width] [file]"
- );
- }
- }
-
- if (argv[optind] == NULL) {
- fpi = stdin;
- }
- else {
- fpi = fopen(argv[optind], "r");
- if (fpi == NULL) {
- error(argv[optind]);
- }
- }
-
- suntops(fpi, PAGE_HEIGHT, PAGE_WIDTH, height, width, rotate, stdout);
-
- exit(0);
- }
-