Ticket #2: 3_cleanup.diff
File 3_cleanup.diff, 7.6 KB (added by , 5 years ago) |
---|
-
cube.cmd
5 5 º Batch update of CONFIG.SYS-like files. CUBE modifies a Target ASCII º 6 6 º file, given a set of commands in a Procedure file. º 7 7 º º 8 º 2019-02-09 V3.0 RLW Adjust box-drawing characters for CP850 º 8 9 º 2019-02-09 V3.0 RLW Correct endless REPSTRING loop º 9 10 º 2019-02-09 V3.0 RLW Remove dead code º 10 º 2019-01-25 V2.9 SCS remove the bootdrive hack from YD º 11 º newer rpm don't need that anymore, as we have º 12 º nice rpm scripts for that now º 11 º 2019-01-25 V2.9 SCS Remove the bootdrive hack - no longer needed º 13 12 º 2018-06-12 V2.8 SHL Correct comments - no functional changes º 14 13 º 2017-04-01 V2.8 SHL Correct ADDSTRING ALWAYS logic more º 15 14 º 2015-04-28 V2.7 SHL Correct ADDSTRING logic º … … 168 167 if chkmd = 0 then call exit 1 source 'ended.' /* It's OVER !! and OK !! */ 169 168 if chkmd = 1 then call exit 2 source 'ended.' /* */ 170 169 171 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž172 ³ Error report and action (based on Onerr setting, from ONERROR cmd) Æ173 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/170 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 171 º Error report and action (based on Onerr setting, from ONERROR cmd) º 172 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 174 173 OnErrorDo: 175 174 parse arg line,msg 176 175 say PFile', line' line':' msg 177 176 if OnErr = 'STOP' then call Exit 0 source 'stopped.' 178 177 else return 0 179 178 180 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž181 ³ Searches All or First or Last lines in Target starting with string Æ182 ³ Returns the line number(s) found. Æ183 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/179 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 180 º Searches All or First or Last lines in Target starting with string º 181 º Returns the line number(s) found. º 182 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 184 183 Whereis: procedure expose Target. CaseM LStrip 185 184 parse arg string,direction,mode 186 185 if wordpos(direction,'F A')>0 then do; de=1; a=Target.0; par=1; end … … 205 204 end 206 205 return ret 207 206 208 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž209 ³ Update Target file from Target. stem. Remove ' ' lines Æ210 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/207 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 208 º Update Target file from Target. stem. Remove ' ' lines º 209 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 211 210 SaveFile: 212 211 address cmd 'erase' TFile 213 212 src = rc … … 220 219 end 221 220 return src 222 221 223 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž224 ³ Insert a line in Target file (stem) after line number i. Æ225 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/222 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 223 º Insert a line in Target file (stem) after line number i. º 224 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 226 225 Insert: procedure expose Target. NumberOfChanges 227 226 parse arg i string 228 227 if i = Target.0 then k = Target.0 + 1 … … 239 238 NumberOfChanges = NumberOfChanges + 1 240 239 return 241 240 242 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž243 ³ returns a procedure command line with all strings uppercased, exceptÆ244 ³ doubled-quoted strings. Æ245 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/241 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 242 º returns a procedure command line with all strings uppercased, exceptº 243 º doubled-quoted strings. º 244 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 246 245 upkw: procedure expose vn. vv. _d_ 247 246 parse arg sentence 248 247 sentence = strip(sentence) … … 260 259 end 261 260 return phrase 262 261 263 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž264 ³ apply command line-specified substitutions within a string Æ265 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/262 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 263 º apply command line-specified substitutions within a string º 264 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 266 265 Cmdrs: procedure expose vn. vv. 267 266 parse arg y 268 267 do i = 1 to vn.0 … … 278 277 end 279 278 return y 280 279 281 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž282 ³ apply env. variables substitutions to STRING if req. in OPTION. Æ283 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/280 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 281 º apply env. variables substitutions to STRING if req. in OPTION. º 282 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 284 283 Envrs: procedure 285 284 Parse arg String,Option 286 285 out = '' … … 295 294 end 296 295 return String 297 296 298 /* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍž299 ³ All that must be done to quit and more: say msg, save Target file if Æ300 ³ necessary (type=1). Æ301 ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŸ*/297 /* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 298 º All that must be done to quit and more: say msg, save Target file if º 299 º necessary (type=1). º 300 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ */ 302 301 Exit: 303 302 parse arg type msg 304 303 src=0 … … 466 465 Tar= Target.w; Wi = With; end /* string compare mode */ 467 466 else do 468 467 Tar = translate(Target.w); Wi=translate(With); end /* string compare mode */ 469 /* 2015-04-28 SHL was leaving early */470 /* 2017-04-01 SHL was still failing if not always */471 468 if pos(Wi,Tar) = 0 |, /* String not there or */ 472 469 wordpos('ALWAYS',Opt) <> 0 then do /* ALWAYS specified. */ 473 470 select /* Where to add ? */ … … 575 572 Tar = Target.w; Os=Ostr; end /* string compare mode */ 576 573 else do 577 574 Tar = translate(Target.w); Os=translate(Ostr); end /* string compare mode */ 578 /* 2015-04-28 SHL avoid spurious uppercasing */579 575 ospos = pos(Os,Tar) 580 576 if ospos > 0 then do /* String is there */ 581 577 s = left(Target.w, ospos - 1)