Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!island!daniel From: daniel@island.uu.net (Dan Smith "Ivana wanna, Trump chump") Newsgroups: comp.windows.x Subject: Re: Xloadimage patchlevel 04 now available Message-ID: <1417@island.uu.net> Date: 1 Mar 90 00:43:25 GMT References: <1990Feb23.165346.26243@intercon.com> <4953@helios.ee.lbl.gov> <1990Feb26.184738.3816@intercon.com> Reply-To: daniel@island.uu.net (Dan Smith "Ivana wanna, Trump chump") Organization: Island Graphics, Marin County, California Lines: 33 >In article <4953@helios.ee.lbl.gov>, jef@ace.ee.lbl.gov (Jef Poskanzer) writes: >> Another possible design would be for the pXm-reading library routines to fork >> off such a magic-number switch when they don't recognize a file format. > >I like this idea. It would also be nice if the magic-number switcher was >driven by a configuration file somewhere, so that one could add formats at >will (one of the strengths of pbmplus already). > A quickie solution that would go part of the way is to have a shell script wrapper that would work off of file name extensions: #! /bin/csh -f # # cvt_fmt if ($#argv != 2) then cat << +++ usage: cvt_fmt file fmt_to_convert_to example: "cvt_fmt foo.xbm rast" would give a "foo.rast" file +++ else set source=$1 set dest=$2 ${source:e}topbm $source | pbmto${dest} > ${source:r}.$dest endif add cases for color and graymap and additional seasoning to taste :-) dan -- dansmith@well.sf.ca.us daniel@island.uu.net unicom!daniel@pacbell.com ph: (415) 332 3278 (h), 491 1000 (w) disclaimer: Island's coffee was laced :-)