2 ; SCCSID = @(#)tucode.asm 4.2 85/05/31
3 ; SCCSID = @(#)tucode.asm 4.2 85/05/31
4 Title COMMAND Language midifiable
Code Transient
17 DATARES
SEGMENT PUBLIC BYTE ;AC000;
21 TRANDATA
SEGMENT PUBLIC BYTE ;AC000;
22 EXTRN BAD_ON_OFF_ptr
:word
23 EXTRN ctrlcmes_ptr
:word
24 EXTRN DEL_Y_N_PTR
:WORD
25 EXTRN ECHOMES_ptr
:word
26 EXTRN extend_buf_ptr
:word ;AC000;
29 EXTRN PARSE_BREAK
:BYTE ;AN000;
30 EXTRN promptdat_moday
:word ;AC000;
31 EXTRN promptdat_ptr
:word ;AC000;
32 EXTRN promptdat_yr
:word ;AC000;
33 EXTRN string_buf_ptr
:word
34 EXTRN SUREMES_ptr
:word
35 EXTRN VERIMES_ptr
:BYTE
39 TRANSPACE
SEGMENT PUBLIC BYTE ;AC000;
45 EXTRN PARSE1_CODE
:BYTE ;AN000;
47 EXTRN string_ptr_2
:word
51 TRANCODE
SEGMENT PUBLIC BYTE
55 EXTRN extend_setup
:near ;AN022;
62 PUBLIC SLASHP_ERASE
;AN000;
65 ASSUME
CS:TRANGROUP
,DS:TRANGROUP
,ES:TRANGROUP
,SS:NOTHING
67 ; ****************************************************************
69 ; * ROUTINE: NOTEST2 - execution of DEL/ERASE command
71 ; * FUNCTION: Delete files based on user parsed input. Prompt
72 ; * user for Y/N if necessary. If an error occurs,
73 ; * set up an error message and go to CERROR.
75 ; * INPUT: FCB at 5ch set up with filename(s) entered
76 ; * Current directory set to entered directory
80 ; ****************************************************************
82 ; ARE YOU SURE prompt when deleting *.*
99 MOV DX,OFFSET TRANGROUP
:SUREMES_ptr
; "Are you sure (Y/N)?"
103 MOV WORD PTR [SI],120 ; zero length
104 MOV AX,(STD_CON_INPUT_FLUSH
SHL 8) OR STD_CON_STRING_INPUT
110 call char_in_xlat
;G Convert to upper case
111 retc
;AN000; return if function not supported
127 ret ; If no error, return
130 invoke set_ext_error_msg
;AN022; set up the extended error
131 push dx ;AN022; save message
133 pop dx ;AN022; restore message
135 cmp word ptr extend_buf_ptr
,error_no_more_files
;AN022; convert no more files to
136 jnz cerrorj2
;AN022; file not found
137 mov Extend_Buf_ptr
,error_file_not_found
;AN000; get message number in control block
143 ; ****************************************************************
145 ; * ROUTINE: SLASHP_ERASE - execution of DEL/ERASE /P
147 ; * FUNCTION: Delete files based on user parsed input. Prompt
148 ; * user for Y/N where necessary. If an error occurs
149 ; * set up and error message and transfer control
152 ; * INPUT: FCB at 5ch set up with filename(s) entered
153 ; * Current directory set to entered directory
157 ; ****************************************************************
159 ASSUME
CS:TRANGROUP
,DS:TRANGROUP
,ES:TRANGROUP
,SS:NOTHING
161 SLASHP_ERASE: ;AN000; entry point
162 invoke build_dir_string
;AN000; set up current directory string for output
163 mov ah,Set_DMA
;AN000; issue set dta int 21h
164 mov dx,offset trangroup
:destdir
;AN000; use Destdir for target
166 mov ah,Dir_Search_First
;AN000; do dir search first int 21h
167 mov dx,FCB
;AN000; use FCB at 5Ch for target
169 inc al ;AN000; did an error occur
170 jz eraerr
;AN022; go to error exit
172 delete_prompt_loop: ;AN000;
173 mov si,offset trangroup
:destdir
+1 ;AN000; set up FCB as source
174 mov di,offset trangroup
:dest
;AN000; set up dest as target
175 mov al,dirchar
;AN000; store a "\" in the first char
176 stosb ;AN000; of DEST
177 invoke fcb_to_ascz
;AN000; convert filename from FCB to ASCIIZ string
179 slashp_askagn: ;AN000;
180 call crlf2
;AN000; print out carriage return, line feed
181 mov dx,offset trangroup
:bwdbuf
;AN000; print out current directory string
182 mov bx,dx ;AN000; get string pointer in bx
183 cmp byte ptr [bx+3],end_of_line_out
;AN000; see if only D:\,0
184 jnz not_del_root
;AN000; no continue
185 mov byte ptr [bx+2],end_of_line_out
;AN000; yes, get rid of \
187 Not_del_root: ;AN000;
188 mov string_ptr_2
,dx ;AN000;
189 mov dx,offset trangroup
:string_buf_ptr
;AN000;
190 invoke std_printf
;AN000;
191 mov dx,offset trangroup
:dest
;AN000; print out file name string
192 mov string_ptr_2
,dx ;AN000;
193 mov dx,offset trangroup
:string_buf_ptr
;AN000;
194 invoke std_printf
;AN000;
195 mov dx,offset trangroup
:Del_Y_N_Ptr
;AN000; issue ", Delete (Y/N)?" message
196 invoke std_printf
;AN000;
197 mov si,80H
;AN000; set up buffer for input
199 mov word ptr [si],combuflen
;AN000;
200 mov ax,(std_con_input_flush
shl 8) or std_con_string_input
;AN000;
201 int int_command
;AN000; get input from the user
203 or ah,ah ;AN000; was a character entered?
204 jz slashp_askagn
;AN000; no - ask again
205 invoke scanoff
;AN000; scan off leading delimiters
206 call char_in_xlat
;AN000; yes - upper case it
207 retc
;AN000; return if function not supported
208 cmp al,capital_n
;AN000; was it no?
209 jz next_del_file
;AN000; yes - don't delete file
210 cmp al,capital_y
;AN000; was it yes?
211 jz delete_this_file
;AN000; yes - delete the file
212 jmp short slashp_askagn
;AN000; it was neither - ask again
214 delete_this_file: ;AN000;
215 mov ah,fcb_delete
;AN000; delete the file
216 mov dx,offset trangroup
:destdir
;AN000; use Destdir for target
217 int int_command
;AN000;
218 inc al ;AN000; did an error occur?
219 jnz next_del_file
;AN000; no - get next file
220 jmp eraerr
;AN022; go to error exit - need long jmp
222 next_del_file: ;AN000;
223 mov ah,dir_search_next
;AN000; search for another file
225 int int_command
;AN000;
226 inc al ;AN000; was a file found?
227 jz slash_p_exit
;AN000; no - exit
228 jmp delete_prompt_loop
;AN000; yes - continue (need long jump)
231 invoke get_ext_error_number
;AN022; get the extended error number
232 cmp ax,error_no_more_files
;AN022; was error file not found?
233 jz good_erase_exit
;AN022; yes - clean exit
234 jmp extend_setup
;AN022; go issue error message
237 invoke restudir
;AN000; we're finished - restore user's dir
238 call crlf2
;AN000; print out carriage return, line feed
242 ;************************************************
243 ; ECHO, BREAK, and VERIFY commands. Check for "ON" and "OFF"
247 assume
ds:trangroup
,es:trangroup
266 ; There was no discrenable ON or OFF after the ECHO. If there is nothing but
267 ; delimiters on the command line, we issue the ECHO is ON/OFF message.
273 cmp cl,0 ;AC000; was anything on the line?
274 jz PEcho
; just display current state.
275 MOV DX,82H
; Skip one char after "ECHO"
287 MOV DX,OFFSET TRANGROUP
:ECHOMES_ptr
291 assume
ds:trangroup
,es:trangroup
295 MOV AX,(SET_CTRL_C_TRAPPING
SHL 8) OR 1
304 INT 21H
; Turn off ^C check
308 CMP CL,0 ;AC000; rest of line blank?
309 JNZ CERRORJ
; no, oops!
315 MOV DX,OFFSET TRANGROUP
:CTRLCMES_ptr
318 mov si,offset trangroup
:onmes_ptr
;AC000; get ON pointer
321 mov si,offset trangroup
:offmes_ptr
;AC000; get OFF pointer
324 push dx ;AN000; save offset of message block
325 mov bx,dx ;AN000; save offset value
326 lodsw ;AN000; get message number of on or off
327 mov dh,util_msg_class
;AN000; this is a utility message
328 invoke Tsysgetmsg
;AN000; get the address of the message
329 add bx,ptr_off_pos
;AN000; point to offset of ON/OFF
330 mov word ptr [bx],si ;AN000; put the offset in the message block
331 pop dx ;AN000; get message back
332 invoke std_printf
;AC000; go print message
333 mov word ptr [bx],0 ;AN000; zero out message pointer
338 assume
ds:trangroup
,es:trangroup
342 MOV AX,(SET_VERIFY_ON_WRITE
SHL 8) OR 1
350 INT 21H
; Turn off verify after write
354 CMP CL,0 ;AC000; is rest of line blank?
355 JNZ CERRORJ
; nope...
356 MOV AH,GET_VERIFY_ON_WRITE
359 MOV DX,OFFSET TRANGROUP
:VERIMES_ptr
362 ; ****************************************************************
366 ; * FUNCTION: Parse the command line for an optional ON or
367 ; * OFF string for the BREAK, VERIFY, and ECHO
370 ; * INPUT: command line at offset 81H
371 ; * PARSE_BREAK control block
373 ; * OUTPUT: If carry is clear
379 ; * If nothing on command line
382 ; * CL contains error value from parse
384 ; ****************************************************************
386 assume
ds:trangroup
,es:trangroup
391 scan_on_off: ;AN032; scan off leading blanks & equal
392 lodsb ;AN032; get a char
393 cmp al,blank
;AN032; if whitespace
394 jz scan_on_off
;AN032; keep scanning
395 cmp al,tab_chr
;AN032; if tab
396 jz scan_on_off
;AN032; keep scanning
397 cmp al,equal_chr
;AN032; if equal char
398 jz parse_on_off
;AN032; start parsing
399 dec si ;AN032; if none of above - back up
401 parse_on_off: ;AN032; and start parsing
402 mov di,offset trangroup
:parse_break
;AN000; Get adderss of PARSE_BREAK
403 xor cx,cx ;AN000; clear cx,dx
405 invoke cmd_parse
;AC000; call parser
406 cmp ax,end_of_line
;AC000; are we at end of line?
407 jz BADONF
;AC000; yes, return error
408 cmp ax,result_no_error
;AN000; did an error occur
409 jz on_off_there
;AN000; no - continue
410 mov cx,ax ;AN000; yes - set cl to error code
411 jmp short BADONF
;AN000; return error
414 cmp parse1_code
,-1 ;AN014; was a valid positional present?
415 jnz good_on_off
;AN014; yes - continue
416 mov cx,badparm_ptr
;AN014; something other than ON/OFF
417 jmp short BADONF
;AN014; return error
420 xor ax,ax ;AC000; set up return code for
421 or al,parse1_code
;AC000; ON or OFF in AX
422 pushf ;AN000; save flags
423 mov di,offset trangroup
:parse_break
;AN000; Get adderss of PARSE_BREAK
425 invoke cmd_parse
;AN000; call parser
426 cmp ax,end_of_line
;AN000; are we at end of line?
427 jnz BADONF_flags
;AN000; NO, return error
428 popf ;AN000; restore flags
430 jmp short on_off_end
;AN000; return to caller
437 ; No discernable ON or OFF has been found. Put an error message pointer in DX
438 ; and return the error
441 MOV DX,OFFSET TRANGROUP
:BAD_ON_OFF_ptr
450 ;*************************************************************************
458 CALL GetDate
; get date
459 xchg dh,dl ;AN000; switch month & day
460 mov promptDat_yr
,cx ;AC000; put year into message control block
461 mov promptDat_moday
,dx ;AC000; put month and day into message control block
462 mov dx,offset trangroup
:promptDat_ptr
;AC000; set up message for output
464 ;AD061; mov promptDat_yr,0 ;AC000; reset year, month and day
465 ;AD061; mov promptDat_moday,0 ;AC000; pointers in control block
466 POP DI ;AC000; restore di,es
470 ; Do GET DATE system call and set up 3 character day of week in ARG_BUF
471 ; for output. Date will be returned in CX,DX.
475 mov di,offset trangroup
:arg_buf
;AC000; target for day of week
476 MOV AH,GET_DATE
;AC000; get current date
477 INT int_command
;AC000; Get date in CX:DX
480 push cx ;AN000; save date returned in
481 push dx ;AN000; CX:DX
485 mov cx,si ;AN000; save si
486 mov ax,weektab
;AN000; get message number of weektab
487 mov dh,util_msg_class
;AN000; this is a utility message
488 push di ;AN000; save argument buffer
489 invoke Tsysgetmsg
;AN000; get the address of the message
490 pop di ;AN000; retrieve argument buffer
491 add si,cx ;AC000; get day of week
494 mov al,end_of_line_out
;AC000; terminate the string
496 pop dx ;AN000; get back date
501 ;g This routine determines whether the character in AL is a
502 ;g Yes or No character. On return, if AL=0, the character is
503 ;g No, if AL=1, the character is Yes.
508 char_in_xlat proc
near
510 mov dl,al ;AC000; get character into DX
512 mov ax,(getextcntry
SHL 8) + 35 ;AC000; Yes/No char call
513 int int_command
;AC000;