1 /* ***********************************************************
  2    *                                                         *
  3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  4    *                                                         *
  5    * Copyright (c) 1972 by Massachusetts Institute of        *
  6    * Technology and Honeywell Information Systems, Inc.      *
  7    *                                                         *
  8    *********************************************************** */
  9 
 10 
 11 lfree_name: lfn:    procedure (path);
 12 
 13           /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
 14           /*                                                                                        */
 15           /* N^H__^Ha_^Hm_^He_^Hs:  lfree_name, lfn                                                                     */
 16           /*                                                                                        */
 17           /*      This command is part of the Multics Installation System (MIS).  It frees the      */
 18           /* entryname portion of its pathname argument so that this entryname may be used          */
 19           /* on another segment.  If the final component of the entryname is "._^Hn" where n is an  */
 20           /* integer, then the name is freed by adding one to _^Hn.  Otherwise, the entryname is    */
 21           /* freed by appending a component of ".1" to the name.                                    */
 22           /*                                                                                        */
 23           /* E^H__^Hn_^Ht_^Hr_^Hi_^He_^Hs:  lfree_name, lfn                                                             */
 24           /*                                                                                        */
 25           /*       This entry frees an entryname.                                                   */
 26           /*                                                                                        */
 27           /* U^H__^Hs_^Ha_^Hg_^He                                                                                       */
 28           /*                                                                                        */
 29           /*      lfree_name  path_name                                                             */
 30           /*                                                                                        */
 31           /* 1) path_name     is the absolute or relative path name of the directory entryname      */
 32           /*                  which is to be freed. (Input)                                         */
 33           /*                                                                                        */
 34           /* E^H__^Hn_^Ht_^Hr_^Hi_^He_^Hs:  lfree_name$restore, lfn$restore                                             */
 35           /*                                                                                        */
 36           /*      This entry point restores an entryname which has been freed to its original value.*/
 37           /*                                                                                        */
 38           /* U^H__^Hs_^Ha_^Hg_^He                                                                                       */
 39           /*                                                                                        */
 40           /*      lfree_name$restore  path_name                                                     */
 41           /*                                                                                        */
 42           /* 1) path_name     is the original absolute or relative path name of the directory       */
 43           /*                  entryname which is to be restored. (Input)                            */
 44           /*                                                                                        */
 45           /* S^H__^Ht_^Ha_^Ht_^Hu_^Hs                                                                                   */
 46           /*                                                                                        */
 47           /* 1) Created:  Jan, 1973 by G. C. Dixon                                                  */
 48           /*                                                                                        */
 49           /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
 50 
 51 ^L
 52      dcl                                                    /*        parameter                               */
 53           path                          char(*);            /* pathname of the entryname to be freed.         */
 54 
 55      dcl                                                    /*        automatic variables                     */
 56           Nargs                         fixed bin,          /* number of input arguments we were passed.      */
 57           code                          fixed bin(35),      /* a status code.                                 */
 58           dir                           char(168) aligned,  /* directory portion of path.                     */
 59           e                             fixed bin,          /* entry point indicator.                         */
 60           entry                         char(32) aligned;   /* entry portion of path.                         */
 61 
 62      dcl                                                    /*        entries and builtin functions           */
 63           addr                          builtin,
 64           com_err_                      entry options (variable),
 65           cu_$arg_count                 entry (fixed bin),
 66           expand_path_                  entry (ptr, fixed bin, ptr, ptr, fixed bin(35)),
 67           length                        builtin,
 68           upd_free_name_                entry (char(*) aligned, char(*) aligned, fixed bin(35)),
 69           upd_free_name_$restore        entry (char(*) aligned, char(*) aligned, fixed bin(35));
 70 
 71      dcl                                                    /*        static variables                        */
 72           ep (2)                        char(18) aligned int static init (
 73                                              "lfree_name",
 74                                              "lfree_name$restore"),
 75           error_table_$wrong_no_of_args fixed bin(35) ext static;
 76 ^L
 77           e = 1;                                            /* set entry point indicator.                     */
 78           go to common;
 79 
 80 restore:  entry (path);                                     /* restore name entry point.                      */
 81           e = 2;                                            /* set entry point indicator.                     */
 82 
 83 common:   call cu_$arg_count (Nargs);                       /* make sure we were passed 1 argument.           */
 84           if Nargs ^= 1 then
 85                go to wrong_no_of_args;
 86           call expand_path_ (addr(path), length(path), addr(dir), addr(entry), code);
 87           if code ^= 0 then                                 /* convert relative path to absolute one.         */
 88                go to err;
 89           go to call(e);                                    /* make call appropo to our entry point.          */
 90 
 91 call(1):  call upd_free_name_ (dir, entry, code);
 92           go to join;
 93 call(2):  call upd_free_name_$restore (dir, entry, code);   /* free or restore the entryname, as appropo      */
 94 
 95 join:     if code ^= 0 then
 96                go to err;
 97           return;
 98 
 99 wrong_no_of_args:
100           call com_err_ (error_table_$wrong_no_of_args, (ep(e)),
101                "^/Calling sequence is:^-^a <path_name>", (ep(e)));
102           return;
103 
104 err:      call com_err_ (code, (ep(e)), "^a", path);
105 
106 
107           end lfree_name;