import Glibc
import Foundation
//
// 'main program'
//
// command: "blake2b filename [key]", 
//
guard Process.arguments.count == 2 else 
{
  print("Usage:  blake2b FILENAME")
  exit(-1)
}

let filename = Process.arguments[1]

let file_handle = fopen (filename, "r")

let BUFSIZE = 1024

var buf     = [CChar](repeating:CChar(0), count:BUFSIZE)

while fgets(&buf, Int32(BUFSIZE), file_handle) != nil {
  print(buf)
}

exit(0)