#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
◆ clear_extparms()
static void clear_extparms |
( |
void |
| ) |
|
|
static |
◆ get_mbi()
static long get_mbi |
( |
FILE * |
infile | ) |
|
|
static |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 304 of file seewbmp.c.
References show_wbmp_from_file().
310 for (i = 1; i < argc; i++) {
313 bmpfile = fopen(argv[i],
"r");
319 if (fclose(bmpfile) < 0) {
static int show_wbmp_from_file(char *bmpname, FILE *bmpfile)
◆ new_extparm()
static int new_extparm |
( |
char * |
name, |
|
|
char * |
value |
|
) |
| |
|
static |
◆ parse_headers()
static int parse_headers |
( |
FILE * |
bmpfile | ) |
|
|
static |
Definition at line 209 of file seewbmp.c.
References clear_extparms(), free(), malloc(), name, new_extparm(), skip_mbi(), and parm::value.
Referenced by show_wbmp_from_file().
216 if (c < 0)
return -1;
221 exttype = (c >> 5) & 0x03;
229 if (
skip_mbi(bmpfile) < 0)
return -1;
237 int namelen, valuelen;
240 if (c < 0)
return -1;
242 namelen = (c >> 4) & 0x07;
244 if (!
name)
return -1;
245 if (fread(
name, namelen, 1, bmpfile) < (
size_t) namelen)
251 if (fread(
value, valuelen, 1, bmpfile) < (
size_t) valuelen)
static void clear_extparms(void)
static int new_extparm(char *name, char *value)
static int skip_mbi(FILE *infile)
◆ print_extparms()
static void print_extparms |
( |
FILE * |
outfile | ) |
|
|
static |
◆ show_image_from_file()
static int show_image_from_file |
( |
char * |
bmpname, |
|
|
FILE * |
bmpfile, |
|
|
long |
width, |
|
|
long |
height |
|
) |
| |
|
static |
Definition at line 126 of file seewbmp.c.
Referenced by show_wbmp_from_file().
130 for (h = 0; h < height; h++) {
132 for (w = 0; w < width; ) {
142 for (bit = 0x80; bit > 0 && w < width; bit >>= 1, w++) {
143 putc((c & bit) ?
'*' :
' ', stdout);
◆ show_wbmp_from_file()
static int show_wbmp_from_file |
( |
char * |
bmpname, |
|
|
FILE * |
bmpfile |
|
) |
| |
|
static |
Definition at line 262 of file seewbmp.c.
References get_mbi(), parse_headers(), print_extparms(), and show_image_from_file().
Referenced by main().
273 fprintf(stderr,
"%s: format error in headers\n", bmpname);
279 if (width < 0 || height < 0) {
280 fprintf(stderr,
"%s: error reading height and width\n",
287 printf(
"%s, %ldx%ld B/W bitmap, no compression\n",
288 bmpname, width, height);
291 width, height) < 0) {
296 fprintf(stderr,
"%s: cannot handle level %ld wbmp\n",
static int show_image_from_file(char *bmpname, FILE *bmpfile, long width, long height)
static void print_extparms(FILE *outfile)
static long get_mbi(FILE *infile)
static int parse_headers(FILE *bmpfile)
◆ skip_mbi()
static int skip_mbi |
( |
FILE * |
infile | ) |
|
|
static |
◆ extparms
struct parm* extparms = NULL |