Back to index

plt-scheme  4.2.1
Functions
cdjpeg.c File Reference
#include "cdjpeg.h"
#include <ctype.h>

Go to the source code of this file.

Functions

 keymatch (char *arg, const char *keyword, int minchars)
 read_stdin (void)
 write_stdout (void)

Function Documentation

keymatch ( char *  arg,
const char *  keyword,
int  minchars 
)

Definition at line 122 of file cdjpeg.c.

{
  register int ca, ck;
  register int nmatched = 0;

  while ((ca = *arg++) != '\0') {
    if ((ck = *keyword++) == '\0')
      return FALSE;         /* arg longer than keyword, no good */
    if (isupper(ca))        /* force arg to lcase (assume ck is already) */
      ca = tolower(ca);
    if (ca != ck)
      return FALSE;         /* no good */
    nmatched++;                    /* count matched characters */
  }
  /* reached end of argument; fail if it's too short for unique abbrev */
  if (nmatched < minchars)
    return FALSE;
  return TRUE;                     /* A-OK */
}

Here is the caller graph for this function:

Definition at line 149 of file cdjpeg.c.

{
  FILE * input_file = stdin;

#ifdef USE_SETMODE          /* need to hack file mode? */
  setmode(fileno(stdin), O_BINARY);
#endif
#ifdef USE_FDOPEN           /* need to re-open in binary mode? */
  if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
    fprintf(stderr, "Cannot reopen stdin\n");
    exit(EXIT_FAILURE);
  }
#endif
  return input_file;
}

Here is the caller graph for this function:

Definition at line 167 of file cdjpeg.c.

{
  FILE * output_file = stdout;

#ifdef USE_SETMODE          /* need to hack file mode? */
  setmode(fileno(stdout), O_BINARY);
#endif
#ifdef USE_FDOPEN           /* need to re-open in binary mode? */
  if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
    fprintf(stderr, "Cannot reopen stdout\n");
    exit(EXIT_FAILURE);
  }
#endif
  return output_file;
}

Here is the caller graph for this function: