Back to index

radiance  4R0+20100331
Defines | Functions | Variables
dgraph.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "rterror.h"
#include "mgvars.h"
#include "meta.h"

Go to the source code of this file.

Defines

#define isopt(s)   (s[0] == '+' || s[0] == '-')

Functions

static void dofile (int optc, char *optv[], char *file)
int main (int argc, char *argv[])
void eputs (char *msg)
void quit (int code)

Variables

static const char RCSid [] = "$Id: dgraph.c,v 1.3 2003/11/15 02:13:36 schorsch Exp $"
char * progname
char * libpath [4]

Define Documentation

#define isopt (   s)    (s[0] == '+' || s[0] == '-')

Definition at line 19 of file dgraph.c.


Function Documentation

void dofile ( int  optc,
char *  optv[],
char *  file 
) [static]

Definition at line 60 of file dgraph.c.

{
       int  width = 79;
       int  length = 21;
       char  stmp[256];
       int  i;
                                          /* start fresh */
       mgclearall();
                                          /* load file */
       mgload(file);
                                          /* do options */
       for (i = 0; i < optc; i += 2)
              if (optv[i][0] == '+') {
                     sprintf(stmp, "%s=%s", optv[i]+1, optv[i+1]);
                     setmgvar("command line", stdin, stmp);
              } else
                     switch (optv[i][1]) {
                     case 'w':
                            width = atoi(optv[i+1]);
                            break;
                     case 'l':
                            length = atoi(optv[i+1]);
                            break;
                     default:
                            fprintf(stderr, "%s: unknown option: %s\n",
                                          progname, optv[i]);
                            quit(1);
                     }

                                          /* graph it */
       cgraph(width, length);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void eputs ( char *  msg)

Definition at line 99 of file dgraph.c.

{
       fputs(msg, stderr);
}
int main ( int  argc,
char *  argv[] 
)

Definition at line 29 of file dgraph.c.

{
       char  *getenv();
       int  i, file0;

       progname = argv[0];
       libpath[0] = "./";
       if ((libpath[i=1] = getenv("MDIR")) != NULL)
              i++;
       libpath[i++] = "/usr/local/lib/meta/";
       libpath[i] = NULL;

       for (file0 = 1; file0 < argc-1; file0 += 2)
              if (!isopt(argv[file0]))
                     break;

       if (file0 >= argc)
              dofile(argc-1, argv+1, NULL);
       else
              for (i = file0; i < argc; i++)
                     dofile(file0-1, argv+1, argv[i]);

       quit(0);
       return 0; /* pro forma return */
}

Here is the call graph for this function:

void quit ( int  code)

Definition at line 108 of file dgraph.c.

{
       exit(code);
}

Variable Documentation

char* libpath[4]

Definition at line 23 of file dgraph.c.

char* progname

Definition at line 21 of file dgraph.c.

const char RCSid[] = "$Id: dgraph.c,v 1.3 2003/11/15 02:13:36 schorsch Exp $" [static]

Definition at line 2 of file dgraph.c.