/*
* El extra-simplo example of the userspace driver framework.
*
* Eventually there will be a library a la libpuffs (perhaps,
* gasp, even the same lib), but for now it's all manual until
* I get it figured out.
*
* So how to run this?
* 0) sh MAKEDEV putter (if you don't have a freshly created /dev)
* 1) run this program with the argument "/dev/pud"
* 2) mknod a char device with the major 377 (see sources below)
* 3) echo ascii art and jokes into device created in previous step
* or read the device
*/
#define DEFALLOC 1024*1024
#define ECHOSTR1 "Would you like some sauce diable with that?\n"
#define ECHOSTR2 "Nej tack, you fool, I'm happy with my tournedos Rossini\n"
#define NSTR 2
const char *curstr = ECHOSTR1;
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
int
main(int argc, char *argv[])
{
struct pud_req *pdr = malloc(DEFALLOC);
struct pud_conf_reg pcr;
int fd;
ssize_t n;
if (argc != 2)
errx(1, "args");
/*
* open pud device
*/
fd = open(argv[1], O_RDWR);
if (fd == -1)
err(1, "open");