Skip to content
Snippets Groups Projects
Select Git revision
  • 61b292dc82757decb5646c43a00e038ba7b4b98c
  • release default protected
  • more-testing
  • attempt-vax90b1
  • attempt-1
  • conversion protected
  • linux
  • v0.9.1 protected
  • v0.9.0 protected
9 results

convert-vms-record-fmt.c

Blame
  • convert-vms-record-fmt.c 495 B
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <stdint.h>
    
    int
    main(int argc, char *argv[])
    {
      uint16_t len;
      size_t bytes;
      unsigned char line[0xffff + 2];
    
      while (1) {
        bytes = fread(&len, 1, sizeof(uint16_t), stdin);
        if (bytes != 2) {
          break;
        }
        if (len % 2 == 1) {
          len++;
        }
        bytes = fread(line, 1, len, stdin);
        if (bytes != len) {
          break;
        }
        line[len] = '\0';
        printf("%s\n", line);
      }
    
      exit(0);
      return 0;
    }