104         if (c < 0) 
return -1;
   105         result = (result << 7) | (c & 0x7f);
   120         if (c < 0) 
return -1;
   127             long width, 
long height) {
   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);
   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)
   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",
   304 int main(
int argc, 
char *argv[]) {
   310         for (i = 1; i < argc; i++) {
   313             bmpfile = fopen(argv[i], 
"r");
   319                 if (fclose(bmpfile) < 0) {
 static void clear_extparms(void)
 
static int new_extparm(char *name, char *value)
 
static int show_image_from_file(char *bmpname, FILE *bmpfile, long width, long height)
 
static void print_extparms(FILE *outfile)
 
static int show_wbmp_from_file(char *bmpname, FILE *bmpfile)
 
static long get_mbi(FILE *infile)
 
int main(int argc, char *argv[])
 
static int parse_headers(FILE *bmpfile)
 
static int skip_mbi(FILE *infile)