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 volume_dump_switch_on: vdsn: proc;
 12 
 13 /* This command, modeled after the set_saftey_switch command, sets the incremental and complete
 14    volume dump switches of a segment on or off. When a segment is created its dump switches are by default on, that is it
 15    will be dumped. If the user does not want a segment dumped, the dump switches can be set off.  The two switches
 16    control the different modes of volume dumping. Note that if both switches are off and the segment is lost, it
 17    can not be recovered. */
 18 
 19 dcl (dirname, new_path) char (168) aligned;
 20 dcl (entname, ename) char (32) aligned;
 21 dcl  arg char (alng) based (aptr) unaligned;
 22 dcl  b_name char (32) based;
 23 dcl (aptr, eptr, nptr, bentp, npp, dirp, entp) ptr init (null);
 24 dcl (i, j, alng, ecount, retc, nargs) fixed bin (17);
 25 dcl  code fixed bin (35);
 26 dcl (incr_volume_dump_sw, comp_volume_dump_sw) fixed bin;
 27 dcl  myname char (32) aligned;
 28 
 29 dcl  cleanup condition;
 30 
 31 dcl (error_table_$incorrect_access,
 32      error_table_$no_info) ext fixed bin (35);
 33 
 34 dcl ioa_ entry options(variable);
 35 dcl  check_path_name_ ext entry (ptr, fixed bin (17), bit (1) aligned, char (32) aligned, ptr, ptr, ptr,
 36      fixed bin (17), ptr, ptr, fixed bin (17));
 37 dcl  check_path_name_$indiv ext entry (ptr, ptr, bit (1) aligned);
 38 dcl  cu_$arg_count entry(fixed bin);
 39 dcl  cu_$arg_ptr ext entry (fixed bin (17), ptr, fixed bin (17), fixed bin (35));
 40 dcl  com_err_ ext entry options (variable);
 41 dcl  hcs_$set_volume_dump_switches entry (char (*) aligned, char (*) aligned, fixed bin, fixed bin, fixed bin (35));
 42 
 43 dcl (null, addr) builtin;
 44 
 45           incr_volume_dump_sw = -1;
 46           comp_volume_dump_sw = -1;
 47           myname = "volume_dump_switch_on";
 48           goto start;
 49 
 50 volume_dump_switch_off: vdsf: entry;
 51           incr_volume_dump_sw = 1;
 52           comp_volume_dump_sw = 1;
 53           myname = "volume_dump_switch_off";
 54 
 55 start:
 56           call cu_$arg_count(nargs);
 57           if nargs < 1 then do;
 58                call ioa_("^a: USAGE ^a pathname [-incr] | [-comp]", myname, myname);
 59                return;
 60           end;
 61           npp = addr (new_path);
 62           dirp = addr (dirname);
 63           entp = addr (entname);
 64 
 65           on cleanup call vds_cleanup;
 66 
 67           do i = 1 to nargs;                                /* look for control args */
 68                call cu_$arg_ptr (i, aptr, alng, code);
 69                if code ^= 0 then do;
 70                     call com_err_(code, myname);
 71                     return;
 72                end;
 73                if arg = "-incr" | arg = "-incremental" then comp_volume_dump_sw = 0;
 74                if arg = "-comp" | arg = "-complete" then incr_volume_dump_sw = 0;
 75           end;
 76 
 77           if comp_volume_dump_sw = 0 & incr_volume_dump_sw = 0 then do;
 78                call com_err_(0, myname, "Both control arguments may not be used together");
 79                return;
 80           end;
 81 
 82           do i = 1 by 1;                                    /* loop through all arguments */
 83                call cu_$arg_ptr (i, aptr, alng, code);
 84                if code ^= 0 then return;
 85                if arg = "-incr" | arg = "-incremental" then goto skip_loop;
 86                if arg = "-comp" | arg = "-complete" then goto skip_loop;
 87 check_name:
 88                call check_path_name_ (aptr, alng, "0"b, myname, dirp, entp, npp, ecount, eptr, nptr, retc);
 89                if retc = 2 then go to free_up;              /* error message was already printed */
 90                ename = entname;
 91 
 92                do j = 1 to ecount;                          /* loop through all enames */
 93                     if retc = 1 then do;                    /* a star name */
 94                          call check_path_name_$indiv (dirp, bentp, "0"b);
 95                          ename = bentp -> b_name;
 96                     end;
 97                     call hcs_$set_volume_dump_switches (dirname, ename, incr_volume_dump_sw, comp_volume_dump_sw, code);
 98                     if code ^= 0 then do;
 99                          call com_err_ (code, myname, new_path);
100                                                             /* if user lacks modify permission on parent */
101                          if (code = error_table_$incorrect_access) | (code = error_table_$no_info) then
102                               go to free_up;                /* skip processing segments in this directory */
103                     end;
104                end;
105 free_up:
106                call vds_cleanup;
107 skip_loop:
108           end;                                              /* loop through pathnames */
109 
110           return;
111 
112 vds_cleanup: proc;
113                if eptr ^= null then free eptr -> b_name;
114                if nptr ^= null then free nptr -> b_name;
115                return;
116           end vds_cleanup;
117 
118      end volume_dump_switch_on;