YaK:: histo_block_byte0.c [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   
[mega_changes]
[photos]

histo_block_byte0.c

#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>  // exit()

/*
  typedef void (*sighandler_t)(int);
  sighandler_t signal(int signum, sighandler_t handler);

  int fseek(FILE *stream, long offset, int whence);
*/

long a[256];

void finish(int _) {
  int i;
  for (i=0; i<256; i++) {
    printf("%d: %ld\t", i, a[i]);
    if ((i&15) == 15) putchar('\n');
  }
  putchar('\n');
  exit(0);
}

int main() {
  signal(1, finish);
  signal(2, finish);
  while (1) {
    int c = getchar();
    if (c<0) break;
    c &= 255;
    assert(c>=0);
    assert(c<=255);
    a[c]++;

    fseek(stdin, 4095, SEEK_CUR);
  }
  finish(0);
  return 0;
}

(unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
(last modified 2011-06-15)       [Login]
(No back references.)