1mNAME0m
       resource - Manipulate Macintosh resources

1mSYNOPSIS0m
       1mresource 4m22moption24m ?4marg24m 4marg24m 4m...24m?


1mDESCRIPTION0m
       The  1mresource 22mcommand provides some generic operations for dealing with
       Macintosh resources.  This command is only supported on  the  Macintosh
       platform.  Each Macintosh file consists of two 4mforks24m: a 4mdata24m fork and a
       4mresource24m fork.  You use the normal open, puts, close, etc. commands  to
       manipulate  the  data  fork.   You  must  use this command, however, to
       interact with the resource fork.  4mOption24m indicates what  resource  com-
       mand  to  perform.   Any  unique abbreviation for 4moption24m is acceptable.
       The valid options are:

       1mresource close 4m22mrsrcRef0m
              Closes the given  resource  reference  (obtained  from  1mresource0m
              1mopen22m).   Resources  from  that  resource  file will no longer be
              available.

       1mresource delete 22m?4moptions24m? 4mresourceType0m
              This command will delete the resource specified by  4moptions24m  and
              type  4mresourceType24m (see RESOURCE TYPES below).  The options give
              you several ways to specify the resource to be deleted.

              1m-id 4m22mresourceId0m
                     If the  1m-id  22moption  is  given  the  id  4mresourceId24m  (see
                     RESOURCE IDS below) is used to specify the resource to be
                     deleted.  The id must be a number - to specify a name use
                     the 1m-name 22moption.

              1m-name 4m22mresourceName0m
                     If  1m-name  22mis  specified, the resource named 4mresourceName0m
                     will be deleted.  If the 1m-id 22mis also provided, then there
                     must  be  a resource with BOTH this name and this id.  If
                     no name is provided, then the id will be used  regardless
                     of the name of the actual resource.

              1m-file 4m22mresourceRef0m
                     If  the  1m-file 22moption is specified then the resource will
                     be deleted from the file pointed to by 4mresourceRef24m.  Oth-
                     erwise the first resource with the given 4mresourceName24m and
                     or 4mresourceId24m which is found on the  resource  file  path
                     will  be  deleted.   To  inspect  the  file path, use the
                     4mresource24m 4mfiles24m command.

       1mresource files ?4m22mresourceRef24m?
              If 4mresourceRef24mis not provided, this command returns a  Tcl  list
              of  the  resource references for all the currently open resource
              files.  The list is in the normal  Macintosh  search  order  for
              resources.  If 4mresourceRef24m is specified, the command will return
              the path to the file whose resource fork is represented by  that
              token.

       1mresource list 4m22mresourceType24m ?4mresourceRef24m?
              List all of the resources ids of type 4mresourceType24m (see RESOURCE
              TYPES below).  If 4mresourceRef24m is specified then the command will
              limit  the  search to that particular resource file.  Otherwise,
              all resource files currently opened by the application  will  be
              searched.   A Tcl list of either the resource name's or resource
              id's of the found resources will be returned.  See the  RESOURCE
              IDS  section below for more details about what a resource id is.

       1mresource open 4m22mfileName24m ?4maccess24m?
              Open the resource for the file 4mfileName24m.  Standard  file  access
              permissions may also be specified (see the manual entry for 1mopen0m
              for details).  A resource reference  (4mresourceRef24m)  is  returned
              that  can  be used by the other resource commands.  An error can
              occur if the file doesn't exist or the  file  does  not  have  a
              resource fork.  However, if you open the file with write permis-
              sions the file and/or resource fork will be created  instead  of
              generating an error.

       1mresource read 4m22mresourceType24m 4mresourceId24m ?4mresourceRef24m?
              Read  the  entire  resource  of  type 4mresourceType24m (see RESOURCE
              TYPES below) and the name or id of 4mresourceId24m (see RESOURCE  IDS
              below)  into  memory  and  return the result.  If 4mresourceRef24m is
              specified we limit our search to that resource  file,  otherwise
              we  search  all  open  resource forks in the application.  It is
              important to note that most Macintosh resource use a binary for-
              mat  and  the  data returned from this command may have embedded
              NULLs or other non-ASCII data.

       1mresource types ?4m22mresourceRef24m?
              This command returns a Tcl  list  of  all  resource  types  (see
              RESOURCE  TYPES  below) found in the resource file pointed to by
              4mresourceRef24m.  If 4mresourceRef24m is not specified it will return all
              the resource types found in every resource file currently opened
              by the application.

       1mresource write 22m?4moptions24m? 4mresourceType24m 4mdata0m
              This command will write the passed in 4mdata24m as a new resource  of
              type  4mresourceType24m  (see RESOURCE TYPES below).  Several options
              are available that  describe  where  and  how  the  resource  is
              stored.

              1m-id 4m22mresourceId0m
                     If  the  1m-id  22moption  is  given  the  id  4mresourceId24m (see
                     RESOURCE IDS below) is used for the new resource,  other-
                     wise a unique id will be generated that will not conflict
                     with any existing resource.  However, the id  must  be  a
                     number - to specify a name use the 1m-name 22moption.

              1m-name 4m22mresourceName0m
                     If   1m-name  22mis  specified  the  resource  will  be  named
                     4mresourceName24m, otherwise it will have the empty string  as
                     the name.

              1m-file 4m22mresourceRef0m
                     If  the  1m-file 22moption is specified then the resource will
                     be written in the file pointed to by 4mresourceRef24m,  other-
                     wise the most resently open resource will be used.

              1m-force 22mIf  the  target  resource already exists, then by default
                     Tcl will not overwrite it, but raise  an  error  instead.
                     Use  the  -force  flag  to  force  overwriting the extant
                     resource.


1mRESOURCE TYPES0m
       Resource types are defined as a four  character  string  that  is  then
       mapped  to an underlying id.  For example, 1mTEXT 22mrefers to the Macintosh
       resource type for text.  The type 1mSTR# 22mis a list  of  counted  strings.
       All Macintosh resources must be of some type.  See Macintosh documenta-
       tion for a more complete list of resource types that are commonly used.


1mRESOURCE IDS0m
       For  this  command  the  notion of a resource id actually refers to two
       ideas in Macintosh resources.  Every place you can use  a  resource  Id
       you  can  use either the resource name or a resource number.  Names are
       always searched or returned in preference to numbers.  For example, the
       1mresource list 22mcommand will return names if they exist or numbers if the
       name is NULL.


1mPORTABILITY ISSUES0m
       The resource command is only available on Macintosh.


1mSEE ALSO0m
       open(n)


1mKEYWORDS0m
