Back to index

radiance  4R0+20100331
Functions | Variables
getinfo.c File Reference
#include <stdio.h>
#include <string.h>
#include "platform.h"
#include "resolu.h"

Go to the source code of this file.

Functions

static void getdim (register FILE *fp)
static void copycat (void)
static int tabstr (register char *s, void *p)
int main (int argc, char **argv)

Variables

static const char RCSid [] = "$Id: getinfo.c,v 2.8 2004/01/02 11:44:24 schorsch Exp $"
static gethfunc tabstr

Function Documentation

static void copycat ( void  ) [static]

Definition at line 125 of file getinfo.c.

{
       register int  c;

       while ((c = getchar()) != EOF)
              putchar(c);
}

Here is the caller graph for this function:

static void getdim ( register FILE *  fp) [static]

Definition at line 88 of file getinfo.c.

{
       int  j;
       register int  c;

       getheader(fp, NULL, NULL);  /* skip header */

       switch (c = getc(fp)) {
       case '+':            /* picture */
       case '-':
              do
                     putchar(c);
              while (c != '\n' && (c = getc(fp)) != EOF);
              break;
       case 1:                     /* octree */
              getc(fp);
              j = 0;
              while ((c = getc(fp)) != EOF)
                     if (c == 0)
                            if (++j >= 4)
                                   break;
                            else
                                   putchar(' ');
                     else
                            putchar(c);
              putchar('\n');
              break;
       default:             /* ??? */
              fputs("unknown file type\n", stdout);
              break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 38 of file getinfo.c.

{
       int  dim = 0;
       FILE  *fp;
       int  i;

       if (argc > 1 && !strcmp(argv[1], "-d")) {
              argc--; argv++;
              dim = 1;
              SET_DEFAULT_BINARY(); /* for output file */
              SET_FILE_BINARY(stdin);
       } else if (argc == 2 && !strcmp(argv[1], "-")) {
              SET_FILE_BINARY(stdin);
              SET_FILE_BINARY(stdout);
              getheader(stdin, NULL, NULL);
              copycat();
              return 0;
       }
       for (i = 1; i < argc; i++) {
              fputs(argv[i], stdout);
              if ((fp = fopen(argv[i], "r")) == NULL)
                     fputs(": cannot open\n", stdout);
              else {
                     if (dim) {
                            fputs(": ", stdout);
                            getdim(fp);
                     } else {
                            tabstr(":\n", NULL);
                            getheader(fp, tabstr, NULL);
                            putchar('\n');
                     }
                     fclose(fp);
              }
       }
       if (argc == 1) {
              if (dim) {
                     getdim(stdin);
              } else {
                     getheader(stdin, (gethfunc*)fputs, stdout);
                     putchar('\n');
              }
       }
       return 0;
}

Here is the call graph for this function:

static int tabstr ( register char *  s,
void *  p 
) [static]

Definition at line 22 of file getinfo.c.

{
       while (*s) {
              putchar(*s);
              s++;
       }
       if (*--s == '\n')
              putchar('\t');
       return(0);
}

Variable Documentation

const char RCSid[] = "$Id: getinfo.c,v 2.8 2004/01/02 11:44:24 schorsch Exp $" [static]

Definition at line 2 of file getinfo.c.

gethfunc tabstr [static]

Definition at line 16 of file getinfo.c.