let flush output = 
  match output with
    | Channel cout -> Pervasives.flush cout
    | Buffer b -> ()