Skip to content
fossil-examples Documentation
Login

Documentation

/* notes: print a note from stdin, wrapped to a width (default 40). */
#include <stdio.h>
#include <stdlib.h>
#include "vendor/wrap/wrap.h"

int main(int argc, char **argv){
  static char buf[65536];
  int width = argc > 1 ? atoi(argv[1]) : 40;
  size_t n = fread(buf, 1, sizeof buf - 1, stdin);
  buf[n] = 0;
  wrap_print(stdout, buf, width);
  return 0;
}