ReactOS 0.4.16-dev-297-gc569aee
cdjpeg.c File Reference
#include "cdjpeg.h"
#include <ctype.h>
Include dependency graph for cdjpeg.c:

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()

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

Definition at line 122 of file cdjpeg.c.

123{
124 register int ca, ck;
125 register int nmatched = 0;
126
127 while ((ca = *arg++) != '\0') {
128 if ((ck = *keyword++) == '\0')
129 return FALSE; /* arg longer than keyword, no good */
130 if (isupper(ca)) /* force arg to lcase (assume ck is already) */
131 ca = tolower(ca);
132 if (ca != ck)
133 return FALSE; /* no good */
134 nmatched++; /* count matched characters */
135 }
136 /* reached end of argument; fail if it's too short for unique abbrev */
137 if (nmatched < minchars)
138 return FALSE;
139 return TRUE; /* A-OK */
140}
#define isupper(c)
Definition: acclib.h:71
int tolower(int c)
Definition: utclib.c:902
const char int minchars
Definition: cdjpeg.h:154
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR ca[]
Definition: main.c:455

Referenced by parse_switches().

◆ read_stdin()

read_stdin ( void  )

Definition at line 149 of file cdjpeg.c.

150{
151 FILE * input_file = stdin;
152
153#ifdef USE_SETMODE /* need to hack file mode? */
155#endif
156#ifdef USE_FDOPEN /* need to re-open in binary mode? */
157 if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
158 fprintf(stderr, "Cannot reopen stdin\n");
160 }
161#endif
162 return input_file;
163}
#define fileno
Definition: acwin.h:102
#define O_BINARY
Definition: acwin.h:109
#define NULL
Definition: types.h:112
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fdopen(_In_ int _FileHandle, _In_z_ const char *_Format)
#define stdin
Definition: stdio.h:98
#define EXIT_FAILURE
Definition: jerror.c:33
#define READ_BINARY
Definition: jmemdos.c:77
#define exit(n)
Definition: config.h:202
#define setmode(f, m)
Definition: io.h:42

Referenced by main().

◆ write_stdout()

write_stdout ( void  )

Definition at line 167 of file cdjpeg.c.

168{
169 FILE * output_file = stdout;
170
171#ifdef USE_SETMODE /* need to hack file mode? */
173#endif
174#ifdef USE_FDOPEN /* need to re-open in binary mode? */
175 if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
176 fprintf(stderr, "Cannot reopen stdout\n");
178 }
179#endif
180 return output_file;
181}
#define stdout
Definition: stdio.h:99
#define WRITE_BINARY
Definition: wrjpgcom.c:47

Referenced by main().