Thinking out loud (re: file(1) plugins

Ian Darwin ian at darwinsys.com
Wed Aug 3 22:59:41 EEST 2005


I had this juxtaposition just now: reading this blog entry...

http://weblogs.java.net/blog/jive/archive/2005/07/factors_of_succ.html

and, thinking about one of my clients that has a high-level file format 
and API that is based on top of both NetCDF and HDF (both listed in 
magdir/images).

It would probably not be worth this group's while to write (or maintain) 
custom code for identifying such files (you really have to dig to find 
out whether it's a "MINC" file or "just" a CDF or HDF file), but it 
might be worth the clients' time to write a MINC "plugin" for the file 
command.  That is, if we supported a plugin API. In Java it's 
practically trivial to generate a plugin API; in C you have to work a 
bit harder but it's not unreasonable. It would want to be something like 
this, called from file_buffer in funcs.c:

    /* Returns 1 if identified and printed, 0 otherwise */
    extern int fileplugin(int fd, ...);

where any number of such plugins would be dlopen'd from .so files in 
either /usr/local/libexec/file/ or ~/file/.



More information about the File mailing list