On Sat, May 23, 2020 at 01:12:41PM -0500, Edgar Pettijohn wrote: > fixed, thanks. jmc
> Index: fuse_main.3 > =================================================================== > RCS file: /cvs/src/lib/libfuse/fuse_main.3,v > retrieving revision 1.6 > diff -u -p -u -r1.6 fuse_main.3 > --- fuse_main.3 28 Nov 2018 21:19:11 -0000 1.6 > +++ fuse_main.3 23 May 2020 18:11:16 -0000 > @@ -56,39 +56,46 @@ Here is a simple example of a FUSE imple > > static int > fs_readdir(const char *path, void *data, fuse_fill_dir_t filler, > - off_t off, struct fuse_file_info *ffi) > + off_t off, struct fuse_file_info *ffi) > { > if (strcmp(path, "/") != 0) > - return (-ENOENT); > + return -ENOENT; > > filler(data, ".", NULL, 0); > filler(data, "..", NULL, 0); > filler(data, "file", NULL, 0); > - return (0); > + return 0; > } > > static int > fs_read(const char *path, char *buf, size_t size, off_t off, > - struct fuse_file_info *ffi) > + struct fuse_file_info *ffi) > { > - if (off >= 5) > - return (0); > + size_t len; > + const char *file_contents = "fuse filesystem example\\n"; > > - size = 5 - off; > - memcpy(buf, "data." + off, size); > - return (size); > + len = strlen(file_contents); > + > + if (off < len) { > + if (off + size > len) > + size = len - off; > + memcpy(buf, file_contents + off, size); > + } else > + size = 0; > + > + return size; > } > > static int > fs_open(const char *path, struct fuse_file_info *ffi) > { > if (strncmp(path, "/file", 10) != 0) > - return (-ENOENT); > + return -ENOENT; > > if ((ffi->flags & 3) != O_RDONLY) > - return (-EACCES); > + return -EACCES; > > - return (0); > + return 0; > } > > static int > @@ -104,10 +111,10 @@ fs_getattr(const char *path, struct stat > st->st_nlink = 1; > st->st_size = 5; > } else { > - return (-ENOENT); > + return -ENOENT; > } > > - return (0); > + return 0; > } > > struct fuse_operations fsops = { > @@ -118,9 +125,9 @@ struct fuse_operations fsops = { > }; > > int > -main(int ac, char **av) > +main(int argc, char **argv) > { > - return (fuse_main(ac, av, &fsops, NULL)); > + return (fuse_main(argc, argv, &fsops, NULL)); > } > .Ed > .Sh SEE ALSO