Changeset 3092 for trunk/tools
- Timestamp:
- Mar 11, 2000, 7:52:49 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/bin/DoWithDirs.cmd
r3087 r3092 1 /* $Id: DoWithDirs.cmd,v 1. 4 2000-03-11 17:11:30bird Exp $1 /* $Id: DoWithDirs.cmd,v 1.5 2000-03-11 18:52:49 bird Exp $ 2 2 * 3 3 * Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l] [-r] <cmd with args...> … … 8 8 * -i Ignore command failure (rc=0) 9 9 * -r Process diretories in reverse order. 10 * -l Lock directories for other dowithdirs.cmd processes. (-c required!) 10 * -l<tag> Lock directories for other dowithdirs.cmd processes. (-c required!) 11 * Processing stops (rc=0) on the first locked directory. 12 * <tag> is a name of the lock. 11 13 */ 12 14 … … 20 22 fLocking = 0; 21 23 fReverse = 0; 24 fExitOnLock = 1; 25 sLockTag = ''; 22 26 23 27 /* parse arguments */ … … 73 77 do 74 78 fLocking = 1; 79 sLockTag = substr(sArg.i, 3); 75 80 end 76 81 … … 143 148 fOK = 1; 144 149 if (fLocking) then 145 if (\lockdir()) then 146 do 150 if (\lockdir(sLockTag)) then 151 do 152 if (fExitOnLock) then 153 do 154 /* restore old directory and return sucessfully */ 155 call directory sOldDir; 156 say '# - Lock found, stops processing.'; 157 exit(0); 158 end 147 159 say '# - warning: Skipping '|| asDirs.i || ' - directory was locked.'; 148 160 fOK = 0; … … 158 170 /* unlock directory */ 159 171 if (fLocking & fOk) then 160 call unlockdir ;172 call unlockdir sLockTag; 161 173 162 174 /* check for return? */ … … 191 203 192 204 syntax: 193 say 'Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l ] [-r] <cmd with args...>';205 say 'Syntax: dowithdirs.cmd [-e<list of excludes>] [-c] [-i] [-l<tag>] [-r] <cmd with args...>'; 194 206 say ' -e Exclude directories.'; 195 207 say ' <list of excludes> is a INCLUDE-path styled list of directories.'; … … 198 210 say ' -i Ignore command failure (rc=0)'; 199 211 say ' -r Process diretories in reverse order.'; 200 say ' -l Lock directories for other dowithdirs.cmd processes. (-c required!)'; 212 say ' -l<tag> Lock directories for other dowithdirs.cmd processes. (-c required!)'; 213 say ' Processing stops (rc=0) on the first locked directory.'; 214 say ' <tag> is a name of the lock.'; 201 215 exit(-1) 202 216 … … 208 222 */ 209 223 lockdir: procedure 210 rc = stream('.dirlocked', 'c', 'open write'); 224 parse arg sTag 225 rc = stream('.dirlocked' || sTag, 'c', 'open write'); 211 226 return substr(rc, 1, 5) = 'READY'; 212 227 … … 216 231 */ 217 232 unlockdir: procedure 218 rc = stream('.dirlocked', 'c', 'close'); 233 parse arg sTag 234 rc = stream('.dirlocked' || sTag, 'c', 'close'); 219 235 call SysFileDelete '.dirlocked'; 220 236 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.