Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

833 lines
20 KiB

  1. page ,132
  2. ; SCCSID = @(#)tpipe.asm 1.1 85/05/14
  3. ; SCCSID = @(#)tpipe.asm 1.1 85/05/14
  4. TITLE PART8 COMMAND Transient routines.
  5. ;/*
  6. ; * Microsoft Confidential
  7. ; * Copyright (C) Microsoft Corporation 1991
  8. ; * All Rights Reserved.
  9. ; */
  10. ;
  11. ; Revision History
  12. ; ================
  13. ;
  14. ; M025 SR 9/12/90 Removed calls to SetStdInOn,SetStdInOff
  15. ; SetStdOutOn & SetStdOutOff.
  16. ;
  17. .xlist
  18. .xcref
  19. include comsw.asm
  20. include dossym.inc
  21. include syscall.inc
  22. include pdb.inc
  23. include comseg.asm
  24. include comequ.asm
  25. .list
  26. .cref
  27. DATARES SEGMENT PUBLIC BYTE ;AC000;
  28. EXTRN ECHOFLAG:BYTE
  29. EXTRN InitFlag:byte
  30. EXTRN INPIPEPTR:WORD
  31. EXTRN OUTPIPEPTR:WORD
  32. EXTRN PIPE1:BYTE
  33. ;;; EXTRN PIPE1T:BYTE
  34. EXTRN PIPE2:BYTE
  35. ;;; EXTRN PIPE2T:BYTE
  36. EXTRN PIPEFILES:BYTE
  37. EXTRN PIPEFLAG:BYTE
  38. EXTRN PIPEPTR:WORD
  39. EXTRN RESTDIR:BYTE
  40. EXTRN SINGLECOM:WORD
  41. DATARES ENDS
  42. TRANDATA SEGMENT PUBLIC BYTE ;AC000;
  43. EXTRN BADDAT_PTR:WORD
  44. EXTRN BADTIM_PTR:WORD
  45. EXTRN curdat_mo_day:word ;AN000;
  46. EXTRN CURDAT_PTR:WORD
  47. EXTRN curdat_yr:word ;AN000;
  48. EXTRN curtim_hr_min:word ;AN000;
  49. EXTRN CURTIM_PTR:WORD
  50. EXTRN curtim_sec_hn:word ;AN000;
  51. EXTRN eurdat_ptr:word
  52. EXTRN japdat_ptr:word
  53. EXTRN newdat_format:word ;AN000;
  54. EXTRN NEWDAT_PTR:WORD
  55. EXTRN NEWTIM_PTR:WORD
  56. EXTRN parse_date:byte ;AN000;
  57. EXTRN parse_time:byte ;AN000;
  58. EXTRN PIPEEMES_PTR:WORD
  59. EXTRN promtim_hr_min:word ;AN000;
  60. EXTRN promtim_ptr:word ;AN000;
  61. EXTRN promtim_sec_hn:word ;AN000;
  62. EXTRN STRING_BUF_PTR:WORD ;AC000;
  63. EXTRN SYNTMES_PTR:WORD
  64. EXTRN usadat_ptr:word
  65. extrn TempVarName:byte
  66. TRANDATA ENDS
  67. TRANSPACE SEGMENT PUBLIC BYTE ;AC000;
  68. EXTRN COMBUF:BYTE
  69. EXTRN date_day:byte ;AN000;
  70. EXTRN date_month:byte ;AN000;
  71. EXTRN date_year:word ;AN000;
  72. EXTRN INTERNATVARS:BYTE
  73. EXTRN RESSEG:WORD
  74. EXTRN time_fraction:byte ;AN000;
  75. EXTRN time_hour:byte ;AN000;
  76. EXTRN time_minutes:byte ;AN000;
  77. EXTRN time_seconds:byte ;AN000;
  78. TRANSPACE ENDS
  79. TRANCODE SEGMENT PUBLIC BYTE
  80. ASSUME CS:TRANGROUP,DS:NOTHING,ES:NOTHING,SS:NOTHING
  81. EXTRN CERROR:NEAR
  82. EXTRN NOPIPEPROC:NEAR
  83. EXTRN STD_PRINTF:NEAR
  84. EXTRN TCOMMAND:NEAR
  85. EXTRN TESTDOREIN:NEAR
  86. EXTRN TESTDOREOUT:NEAR
  87. EXTRN TESTKANJ:NEAR ;AN000;3/3/KK
  88. EXTRN TSYSGETMSG:NEAR ;AN000;
  89. extrn Find_Name_In_Environment:near
  90. PUBLIC CTIME
  91. PUBLIC DATE
  92. PUBLIC DATINIT
  93. PUBLIC PIPEDEL
  94. PUBLIC PIPEERRSYN
  95. PUBLIC PIPEPROC
  96. PUBLIC PIPEPROCSTRT
  97. PUBLIC PRINT_TIME
  98. PUBLIC SETREST
  99. PUBLIC SETREST1
  100. PUBLIC SINGLETEST
  101. SINGLETEST:
  102. ASSUME DS:NOTHING
  103. push ds
  104. MOV DS,ResSeg
  105. ASSUME DS:ResGroup
  106. CMP [SINGLECOM],0
  107. JZ TestDone
  108. CMP [SINGLECOM],0EFFFH
  109. TestDone:
  110. pop ds
  111. return
  112. ASSUME DS:TRANGROUP
  113. SETREST1:
  114. MOV AL,1
  115. SETREST:
  116. PUSH DS
  117. MOV DS,[RESSEG]
  118. ASSUME DS:RESGROUP
  119. MOV [RESTDIR],AL
  120. POP DS
  121. ASSUME DS:TRANGROUP
  122. return
  123. ASSUME DS:RESGROUP
  124. ;
  125. ; Note that we need to handle the same thing that RestDir handles: the
  126. ; requirement that we try only once to restore the user's environment after
  127. ; and INT 24 or the like. If the condition that causes the INT 24 does not
  128. ; disappear, we just give up.
  129. ;
  130. PIPEDEL:
  131. assume ds:nothing
  132. push ds
  133. PUSH DX
  134. mov ds,ResSeg
  135. assume ds:ResGroup
  136. mov DX,OFFSET RESGROUP:PIPE1 ; Clean up in case ^C
  137. MOV AH,UNLINK
  138. INT 21h
  139. MOV DX,OFFSET RESGROUP:PIPE2
  140. MOV AH,UNLINK
  141. INT 21h
  142. POP DX
  143. call PipeOff
  144. mov PipeFiles,0
  145. pop ds
  146. return
  147. PIPEERRSYN:
  148. MOV DX,OFFSET TRANGROUP:SYNTMES_ptr
  149. CALL PIPEDEL
  150. PUSH CS
  151. POP DS
  152. JMP CERROR
  153. PIPEERR:
  154. pushf
  155. invoke triageError
  156. SaveReg <AX,DX> ; Save results from TriageError
  157. MOV DX,OFFSET TRANGROUP:PIPEEMES_ptr
  158. CALL PIPEDEL
  159. PUSH CS
  160. POP DS
  161. invoke std_eprintf
  162. RestoreReg <DX,AX> ; Restore results from TriageError
  163. popf
  164. cmp ax, 65
  165. jnz tcommandj
  166. JMP CERROR
  167. tcommandj:
  168. jmp tcommand
  169. PIPEPROCSTRT:
  170. ASSUME DS:TRANGROUP,ES:TRANGROUP
  171. MOV DS,[RESSEG]
  172. ASSUME DS:RESGROUP
  173. INC [PIPEFILES] ; Flag that the pipe files exist
  174. push es
  175. push di
  176. push ds
  177. push si
  178. push ds
  179. push es
  180. pop ds ;ds = TRANGROUP
  181. mov si,offset TRANGROUP:TempVarName ;ds:si = "TEMP="
  182. ;
  183. ;Some hideous code in Find_Name_In_Environment. Expects ds = TRANGROUP and
  184. ;so the routine is not really general
  185. ;
  186. call Find_Name_In_Environment ;es:di points at path
  187. pop ds ;ds = DATARES again
  188. jc no_temp_path
  189. push ds
  190. push es
  191. pop ds
  192. pop es ;swap ds and es
  193. mov si,di ;ds:si points at path
  194. call skip_white ;skip white space chars
  195. ;
  196. ;This copies the path into both buffers -- Pipe1 & Pipe2
  197. ;
  198. call copy_pipe_path ;copy the pipe path
  199. ;
  200. ;Check if the TEMP path is valid
  201. ;
  202. push es
  203. pop ds ;ds = DATARES
  204. mov dx,offset DATARES:Pipe1 ;ds:dx = path to look for
  205. mov ax, (CHMOD shl 8) or 0
  206. int 21h
  207. jc no_temp_path
  208. test cx,10h ;is it a directory?
  209. jnz no_temp_path ;yes, continue (carry clear)
  210. stc ;no, indicate fail
  211. no_temp_path:
  212. pop si
  213. pop ds
  214. pop di
  215. pop es
  216. jnc crt_temp ;path found, create tempfiles
  217. ;;;;
  218. ;;;;Invalid or no TEMP path, default to root of current drive
  219. ;;;;
  220. ;;; MOV AH,Get_Default_Drive ; Get current drive
  221. ;;; INT 21h
  222. ;;; ADD AL,capital_A
  223. ;;; MOV PIPE2,AL ; Make pipe files in root of def drv
  224. ;;; MOV Pipe1,AL
  225. ;;; mov al,':'
  226. ;;; mov ah,'\'
  227. ;;; mov word ptr Pipe1+1,ax
  228. ;;; mov word ptr Pipe2+1,ax ;store ':\'
  229. ;;;
  230. ;;; xor ah,ah ; nul terminate path names
  231. ;;; mov Pipe1+3,ah
  232. ;;; mov Pipe2+3,ah
  233. ;SR;
  234. ; We want to create temp files in the current directory rather than in the
  235. ;root of the drive. This is because the number of files that can be present
  236. ;in the root directory is fixed, whereas it is not so in subdirectories.
  237. ;
  238. mov ah,'.'
  239. mov Pipe1,ah
  240. mov Pipe2,ah
  241. xor ah,ah
  242. mov Pipe1+1,ah
  243. mov Pipe2+1,ah ;create files in current dir
  244. crt_temp:
  245. MOV DX,offset DATARES:Pipe1
  246. XOR CX,CX
  247. mov ah,CreateTempFile ; the CreateTemp call
  248. INT 21h
  249. JnC @f
  250. jmp PIPEERR ; Couldn't create
  251. @@:
  252. MOV BX,AX
  253. MOV AH,CLOSE ; Don't proliferate handles
  254. INT 21h
  255. MOV DX,OFFSET RESGROUP:PIPE2
  256. mov ah,createTempFile ; the CreateTemp call
  257. INT 21h
  258. JnC @f
  259. jmp PIPEERR
  260. @@:
  261. MOV BX,AX
  262. MOV AH,CLOSE
  263. INT 21h
  264. CALL TESTDOREIN ; Set up a redirection if specified
  265. MOV SI,[PIPEPTR]
  266. CMP [SINGLECOM],-1
  267. JNZ NOSINGP
  268. MOV [SINGLECOM],0F000H ; Flag single command pipe
  269. NOSINGP:
  270. JMP SHORT FIRSTPIPE
  271. PIPEPROC:
  272. ASSUME DS:RESGROUP
  273. AND [ECHOFLAG],0FEh ; force current echo to be off
  274. MOV SI,[PIPEPTR]
  275. LODSB
  276. CMP AL,AltPipeChr ; Alternate pipe char?
  277. JZ IsPipe1 ; Yes
  278. CMP AL,vbar
  279. jz IsPipe1
  280. jmp PIPEEND ; Pipe done
  281. IsPipe1:
  282. MOV DX,[INPIPEPTR] ; Get the input file name
  283. MOV AX,(OPEN SHL 8)
  284. INT 21h
  285. PIPEERRJ:
  286. jnc no_pipeerr
  287. JMP PIPEERR ; Lost the pipe file
  288. no_pipeerr:
  289. MOV BX,AX
  290. MOV AL,0FFH
  291. XCHG AL,[BX.PDB_JFN_Table]
  292. MOV DS:[PDB_JFN_Table],AL ; Redirect
  293. FIRSTPIPE:
  294. MOV DI,OFFSET TRANGROUP:COMBUF + 2
  295. XOR CX,CX
  296. CMP BYTE PTR [SI],0DH ; '|<CR>'
  297. JNZ PIPEOK1
  298. PIPEERRSYNJ:
  299. JMP PIPEERRSYN
  300. PIPEOK1:
  301. mov al,vbar
  302. CMP BYTE PTR [SI],al ; '||'
  303. JZ PIPEERRSYNJ
  304. CMP BYTE PTR [SI],AltPipeChr ; '##' or '|#'?
  305. JZ PipeErrSynJ ; Yes, Error
  306. PIPECOMLP:
  307. LODSB
  308. STOSB
  309. ;;;; IFDEF DBCS 3/3/KK
  310. CALL TESTKANJ
  311. JZ NOTKANJ5
  312. MOVSB
  313. ;
  314. ; Added following 2 commands to the fix pipe bug.
  315. ;
  316. inc cx ;AN000; 3/3/KK
  317. inc cx ;AN000; 3/3/KK
  318. ;
  319. JMP PIPECOMLP
  320. NOTKANJ5:
  321. ;;;; ENDIF ; 3/3/KK
  322. CMP AL,0DH
  323. JZ LASTPIPE
  324. INC CX
  325. CMP AL,AltPipeChr
  326. JZ IsPipe2
  327. CMP AL,vbar
  328. JNZ PIPECOMLP
  329. IsPipe2:
  330. MOV BYTE PTR ES:[DI-1],0DH
  331. DEC CX
  332. MOV [COMBUF+1],CL
  333. DEC SI
  334. MOV [PIPEPTR],SI ; On to next pipe element
  335. MOV DX,[OUTPIPEPTR]
  336. PUSH CX
  337. XOR CX,CX
  338. MOV AX,(CREAT SHL 8)
  339. INT 21h
  340. POP CX
  341. JC PIPEERRJ ; Lost the file
  342. MOV BX,AX
  343. MOV AL,0FFH
  344. XCHG AL,[BX.PDB_JFN_Table]
  345. MOV DS:[PDB_JFN_Table+1],AL
  346. XCHG DX,[INPIPEPTR] ; Swap for next element of pipe
  347. MOV [OUTPIPEPTR],DX
  348. JMP SHORT PIPECOM
  349. LASTPIPE:
  350. MOV [COMBUF+1],CL
  351. DEC SI
  352. MOV [PIPEPTR],SI ; Point at the CR (anything not '|' will do)
  353. CALL TESTDOREOUT ; Set up the redirection if specified
  354. PIPECOM:
  355. PUSH CS
  356. POP DS
  357. JMP NOPIPEPROC ; Process the pipe element
  358. PIPEEND:
  359. CALL PIPEDEL
  360. CMP [SINGLECOM],0F000H
  361. JNZ NOSINGP2
  362. MOV [SINGLECOM],-1 ; Make it return
  363. NOSINGP2:
  364. JMP TCOMMAND
  365. ASSUME DS:TRANGROUP,ES:TRANGROUP
  366. ; Date and time are set during initialization and use
  367. ; this routines since they need to do a long return
  368. DATINIT PROC FAR
  369. mov cs:[resseg],ds ; SetInitFlag needs resseg initialized
  370. PUSH ES
  371. PUSH DS ; Going to use the previous stack
  372. MOV AX,CS ; Set up the appropriate segment registers
  373. MOV ES,AX
  374. MOV DS,AX
  375. invoke TSYSLOADMSG ;AN000; preload messages
  376. MOV DX,OFFSET TRANGROUP:INTERNATVARS;Set up internat vars
  377. MOV AX,INTERNATIONAL SHL 8
  378. INT 21H
  379. MOV WORD PTR DS:[81H],13 ; Want to prompt for date during initialization
  380. MOV [COMBUF],COMBUFLEN ; Init COMBUF
  381. MOV WORD PTR [COMBUF+1],0D01H
  382. CALL DATE
  383. CALL CTIME
  384. POP DS
  385. POP ES
  386. RET
  387. DATINIT ENDP
  388. ; DATE - Gets and sets the time
  389. break Date
  390. ; ****************************************************************
  391. ; *
  392. ; * ROUTINE: DATE - Set system date
  393. ; *
  394. ; * FUNCTION: If a date is specified, set the system date,
  395. ; * otherwise display the current system date and
  396. ; * prompt the user for a new date. If an invalid
  397. ; * date is specified, issue an error message and
  398. ; * prompt for a new date. If the user enters
  399. ; * nothing when prompted for a date, terminate.
  400. ; *
  401. ; * INPUT: command line at offset 81H
  402. ; *
  403. ; * OUTPUT: none
  404. ; *
  405. ; ****************************************************************
  406. assume ds:trangroup,es:trangroup
  407. DATE:
  408. MOV SI,81H ; Accepting argument for date inline
  409. mov di,offset trangroup:parse_date ;AN000; Get adderss of PARSE_DATE
  410. xor cx,cx ;AN000; clear counter for positionals
  411. xor dx,dx ;AN000;
  412. invoke cmd_parse ;AC000; call parser
  413. cmp ax,end_of_line ;AC000; are we at end of line?
  414. JZ PRMTDAT ;AC000; yes - go ask for date
  415. cmp ax,result_no_error ;AN000; did we have an error?
  416. jne daterr ;AN000; yes - go issue message
  417. JMP short COMDAT ;AC000; we have a date
  418. PRMTDAT:
  419. ; Print "Current date is
  420. invoke GetDate ;AN000; get date for output
  421. xchg dh,dl ;AN000; switch month & day
  422. mov CurDat_yr,cx ;AC000; put year into message control block
  423. mov CurDat_mo_day,dx ;AC000; put month and day into message control block
  424. mov dx,offset trangroup:CurDat_ptr ;AC000; set up message for output
  425. invoke std_printf
  426. ;AD061; mov CurDat_yr,0 ;AC000; reset year, month and day
  427. ;AD061; mov CurDat_mo_day,0 ;AC000; pointers in control block
  428. GET_NEW_DATE: ;AN000;
  429. call getdat ;AC000; prompt user for date
  430. cmp ax,end_of_line ;AC000; are we at end of line?
  431. jz date_end ;AC000; yes - exit
  432. cmp ax,result_no_error ;AN000; did we have an error?
  433. jne daterr ;AN000; yes - go issue message
  434. COMDAT:
  435. mov cx,date_year ;AC000; get parts of date in
  436. mov dh,date_month ;AC000; cx and dx for set
  437. mov dl,date_day ;AC000; date function call.
  438. push cx ;AC000; save date
  439. push dx ;AC000;
  440. mov cx,1 ;AC000; set 1 positional entered
  441. xor dx,dx ;AN029;
  442. invoke cmd_parse ;AN029; call parser
  443. cmp al,end_of_line ;AN029; Are we at end of line?
  444. pop dx ;AC000; retrieve date
  445. pop cx ;AC000;
  446. jnz daterr ;AC000; extra stuff on line - try again
  447. MOV AH,SET_DATE ;yes - set date
  448. INT 21h
  449. OR AL,AL
  450. JNZ DATERR
  451. date_end:
  452. ret
  453. DATERR:
  454. invoke crlf2 ;AN028; print out a blank line
  455. MOV DX,OFFSET TRANGROUP:BADDAT_ptr
  456. invoke std_printf
  457. JMP GET_NEW_DATE ;AC000; get date again
  458. ; TIME gets and sets the time
  459. break Time
  460. ; ****************************************************************
  461. ; *
  462. ; * ROUTINE: TIME - Set system time
  463. ; *
  464. ; * FUNCTION: If a time is specified, set the system time,
  465. ; * otherwise display the current system time and
  466. ; * prompt the user for a new time. If an invalid
  467. ; * time is specified, issue an error message and
  468. ; * prompt for a new time. If the user enters
  469. ; * nothing when prompted for a time, terminate.
  470. ; *
  471. ; * INPUT: command line at offset 81H
  472. ; *
  473. ; * OUTPUT: none
  474. ; *
  475. ; ****************************************************************
  476. assume ds:trangroup,es:trangroup
  477. CTIME:
  478. MOV SI,81H ; Accepting argument for time inline
  479. mov di,offset trangroup:parse_time ;AN000; Get adderss of PARSE_time
  480. xor cx,cx ;AN000; clear counter for positionals
  481. xor dx,dx ;AN000;
  482. invoke cmd_parse ;AC000; call parser
  483. cmp ax,end_of_line ;AC000; are we at end of line?
  484. JZ PRMTTIM ;AC000; yes - prompt for time
  485. cmp ax,result_no_error ;AN000; did we have an error?
  486. jne timerr ;AN000; yes - go issue message
  487. JMP short COMTIM ;AC000; we have a time
  488. PRMTTIM:
  489. ;Printf "Current time is ... "
  490. MOV AH,GET_TIME ;AC000; get the current time
  491. INT 21h ;AC000; Get time in CX:DX
  492. xchg ch,cl ;AN000; switch hours & minutes
  493. xchg dh,dl ;AN000; switch seconds & hundredths
  494. mov CurTim_hr_min,cx ;AC000; put hours and minutes into message subst block
  495. mov CurTim_sec_hn,dx ;AC000; put seconds and hundredths into message subst block
  496. mov dx,offset trangroup:CurTim_ptr ;AC000; set up message for output
  497. invoke std_printf
  498. ;AD061; mov CurTim_hr_min,0 ;AC000; reset hour, minutes, seconds, and hundredths
  499. ;AD061; mov CurTim_sec_hn,0 ;AC000; pointers in control block
  500. GET_NEW_TIME:
  501. call gettim ;AC000;
  502. cmp ax,end_of_line ;AC000; are we at end of line?
  503. jz time_end ;AC000;
  504. cmp ax,result_no_error ;AN000; did we have an error?
  505. jne timerr ;AN000; yes - go issue message
  506. COMTIM:
  507. mov ch,time_hour ;AC000; get parts of time in
  508. mov cl,time_minutes ;AC000; cx and dx for set
  509. mov dh,time_seconds ;AC000; time function call
  510. mov dl,time_fraction ;AC000;
  511. push cx ;AC000; save time
  512. push dx ;AC000;
  513. mov cx,1 ;AC000; set 1 positional parm entered
  514. xor dx,dx ;AN029;
  515. invoke cmd_parse ;AN029; call parser
  516. cmp al,end_of_line ;AN029; Are we at end of line?
  517. pop dx ;AC000; retieve time
  518. pop cx ;AC000;
  519. jnz timerr ;AC000; extra stuff on line - try again
  520. SAVTIM:
  521. MOV AH,SET_TIME
  522. INT 21h
  523. OR AL,AL
  524. JNZ TIMERR ;AC000; if an error occured, try again
  525. TIME_END:
  526. ret
  527. TIMERR:
  528. invoke crlf2 ;AN028; print out a blank line
  529. MOV DX,OFFSET TRANGROUP:BADTIM_ptr
  530. invoke std_printf ; Print error message
  531. JMP GET_NEW_TIME ;AC000; Try again
  532. ;
  533. ; Set the special flag in the INIT flag to the value in CX.
  534. ;
  535. SetInitFlag:
  536. mov ds,[RESSEG]
  537. assume ds:resgroup
  538. and InitFlag,NOT initSpecial
  539. or InitFlag,cL
  540. push cs
  541. pop ds
  542. return
  543. Public PipeOff
  544. PipeOff:
  545. ASSUME DS:NOTHING,ES:NOTHING
  546. SaveReg <DS,AX>
  547. MOV DS,ResSeg
  548. ASSUME DS:RESGroup
  549. XOR AL,AL
  550. XCHG PipeFlag,AL
  551. OR AL,AL
  552. JZ PipeOffDone
  553. SHR EchoFlag,1
  554. PipeOffDone:
  555. RestoreReg <AX,DS>
  556. return
  557. PRINT_TIME:
  558. MOV AH,GET_TIME
  559. INT 21h ; Get time in CX:DX
  560. PUSH ES
  561. PUSH CS
  562. POP ES
  563. xchg ch,cl ;AN000; switch hours & minutes
  564. xchg dh,dl ;AN000; switch seconds & hundredths
  565. mov promTim_hr_min,cx ;AC000; put hours and minutes into message subst block
  566. mov promTim_sec_hn,dx ;AC000; put seconds and hundredths into message subst block
  567. mov dx,offset trangroup:promTim_ptr ;AC000; set up message for output
  568. invoke std_printf
  569. ;AD061; mov promTim_hr_min,0 ;AC000; reset hour, minutes, seconds, and hundredths
  570. ;AD061; mov promTim_sec_hn,0 ;AC000; pointers in control block
  571. POP ES
  572. return
  573. ; ****************************************************************
  574. ; *
  575. ; * ROUTINE: GETDAT - Prompt user for date
  576. ; *
  577. ; * FUNCTION: Gets the date format from the COUNTRY DEPENDENT
  578. ; * INFORMATION and issues the "Enter new date"
  579. ; * message with the proper date format. COMBUF
  580. ; * is reset to get a date from the command line.
  581. ; * The PARSE_DATE blocks are then reset and the
  582. ; * PARSE function call is issued.
  583. ; *
  584. ; * INPUT: NONE
  585. ; *
  586. ; * OUTPUT: COMBUF
  587. ; * PARSER RETURN CODES
  588. ; *
  589. ; ****************************************************************
  590. GETDAT proc near ;AC000;
  591. mov ax,(International SHL 8) ; Determine what format the date
  592. mov dx,5ch ; should be entered in and
  593. int 21h ; print a message describing it
  594. mov si,dx
  595. lodsw
  596. mov dx,usadat_ptr ;AC000; get mm-dd-yy
  597. dec ax
  598. js printformat
  599. mov dx,eurdat_ptr ;AC000; get dd-mm-yy
  600. jz printformat
  601. mov dx,japdat_ptr ;AC000; get yy-mm-dd
  602. printformat:
  603. mov ax,dx ;AN000; get message number of format
  604. mov dh,util_msg_class ;AN000; this is a utility message
  605. call Tsysgetmsg ;AN000; get the address of the message
  606. mov newdat_format,si ;AN000; put the address in subst block
  607. MOV DX,OFFSET TRANGROUP:NEWDAT_ptr ;AC000; get address of message to print
  608. invoke std_printf
  609. mov newdat_format,no_subst ;AN000; reset subst block
  610. MOV AH,STD_CON_STRING_INPUT
  611. MOV DX,OFFSET TRANGROUP:COMBUF
  612. mov cx,initSpecial ; Set bit in InitFlag that indicates
  613. call SetInitFlag ; prompting for date.
  614. INT 21h ; Get input line
  615. xor cx,cx ; Reset bit in InitFlag that indicates
  616. call SetInitFlag ; prompting for date.
  617. invoke CRLF2
  618. MOV SI,OFFSET TRANGROUP:COMBUF+2
  619. mov di,offset trangroup:parse_date ;AN000; Get adderss of PARSE_DATE
  620. xor cx,cx ;AN000; clear counter for positionals
  621. xor dx,dx ;AN000;
  622. invoke cmd_parse ;AC000; call parser
  623. ret
  624. GETDAT endp ;AC000;
  625. ; ****************************************************************
  626. ; *
  627. ; * ROUTINE: GETTIME - Prompt user for time
  628. ; *
  629. ; * FUNCTION: Gets the time format from the COUNTRY DEPENDENT
  630. ; * INFORMATION and issues the "Enter new time"
  631. ; * message. COMBUF is reset to get a time from the
  632. ; * command line. The PARSE_TIME blocks are then
  633. ; * reset and the PARSE function call is issued.
  634. ; *
  635. ; * INPUT: NONE
  636. ; *
  637. ; * OUTPUT: COMBUF
  638. ; * PARSER RETURN CODES
  639. ; *
  640. ; ****************************************************************
  641. GETTIM proc near ;AC000;
  642. XOR CX,CX ; Initialize hours and minutes to zero
  643. MOV DX,OFFSET TRANGROUP:NEWTIM_ptr
  644. invoke std_printf
  645. MOV AH,STD_CON_STRING_INPUT
  646. MOV DX,OFFSET TRANGROUP:COMBUF
  647. mov cx,initSpecial ; Set bit in InitFlag that indicates
  648. call SetInitFlag ; prompting for time.
  649. INT 21h ; Get input line
  650. xor cx,cx ; Reset bit in InitFlag that indicates
  651. call SetInitFlag ; prompting for time.
  652. invoke CRLF2
  653. MOV SI,OFFSET TRANGROUP:COMBUF+2
  654. mov di,offset trangroup:parse_time ;AN000; Get adderss of PARSE_TIME
  655. xor cx,cx ;AN000; clear counter for positionals
  656. xor dx,dx ;AN000;
  657. invoke cmd_parse ;AC000; call parser
  658. ret
  659. GETTIM endp ;AC000;
  660. ;
  661. ;Skip_white: Skips over the whitespace chars that could be present after
  662. ;the '=' sign in the environment variable before the actual path.
  663. ;
  664. ; ENTRY: ds:si = arguments of the environment variable
  665. ;
  666. ; EXIT: ds:si = start of the path
  667. ;
  668. ; REGISTERS AFFECTED: ax
  669. ;
  670. Skip_white proc near
  671. cld
  672. skw_lp:
  673. lodsb
  674. cmp al,' ' ;blank char?
  675. jz skw_lp ;yes, skip it
  676. cmp al,09 ;tab char?
  677. jz skw_lp ;yes, skip it
  678. dec si ;point at first non-white
  679. ret
  680. Skip_white endp
  681. ;
  682. ;Copy_pipe_path: This routine copies the path from the TEMP environment
  683. ;variable into the path buffers Pipe1 & Pipe2.
  684. ;
  685. ; ENTRY: ds:si = path to be copied
  686. ; es = RESGROUP
  687. ;
  688. ; EXIT: Path copied into Pipe1 and Pipe2.
  689. ;
  690. ; REGISTERS AFFECTED: si, di, cx, ax
  691. ;
  692. Copy_pipe_path proc near
  693. mov cx,0ffffh
  694. xor al,al
  695. mov di,si
  696. push es ;save es
  697. push ds
  698. pop es ;es:di = path to be copied
  699. cld
  700. push di
  701. repnz scasb ;look for the null char
  702. pop di
  703. pop es ;es = RESGROUP again
  704. not cx ;length including the null
  705. mov di,offset DATARES:Pipe1
  706. push di
  707. push cx
  708. rep movsb ;copy path into Pipe1
  709. pop cx
  710. pop di
  711. push ds
  712. push es
  713. pop ds ;ds:si = Pipe1
  714. mov si,di
  715. mov di,offset DATARES:Pipe2 ;es:di = Pipe2
  716. rep movsb ;copy path into Pipe2
  717. pop ds
  718. ret ;
  719. Copy_pipe_path endp
  720. TRANCODE ENDS
  721. END
  722.