home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume27 / dmake / part23 < prev    next >
Encoding:
Text File  |  1992-01-29  |  40.0 KB  |  1,319 lines

  1. Newsgroups: comp.sources.misc
  2. From: dvadura@plg.waterloo.edu (Dennis Vadura)
  3. Subject:  v27i124:  dmake - dmake Version 3.8, Part23/41
  4. Message-ID: <1992Jan28.214411.19408@sparky.imd.sterling.com>
  5. X-Md4-Signature: 4de588d65345833e6b8d6b75f2153c38
  6. Date: Tue, 28 Jan 1992 21:44:11 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: dvadura@plg.waterloo.edu (Dennis Vadura)
  10. Posting-number: Volume 27, Issue 124
  11. Archive-name: dmake/part23
  12. Environment: Atari-ST, Coherent, Mac, MSDOS, OS/2, UNIX
  13. Supersedes: dmake: Volume 19, Issue 22-58
  14.  
  15. ---- Cut Here and feed the following to sh ----
  16. # this is dmake.shar.23 (part 23 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file dmake/msdos/exec.asm continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 23; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test -f _shar_wnt_.tmp; then
  33. sed 's/^X//' << 'SHAR_EOF' >> 'dmake/msdos/exec.asm' &&
  34. X        call    write_segment
  35. X        jc    abort_swap_out
  36. X
  37. ; We have now saved the portion of the program segment that will not remain
  38. ; resident during the exec.  We should now walk the DOS allocation chain and
  39. ; write out all other segments owned by the current process.
  40. save_segments:    mov    ax, [psp]
  41. X        dec    ax
  42. X        mov    es, ax
  43. X        mov    bx, offset write_segment_data
  44. X        call    walk_arena_chain
  45. X        jc    abort_swap_out
  46. X
  47. ; Now we must walk the chain of allocated memory blocks again and free
  48. ; all those that are owned by the current process, except the one that is
  49. ; the current process' psp.
  50. free_segments:    mov    ax, [psp]
  51. X        dec    ax
  52. X        mov    es,ax
  53. X        mov    bx, offset free_dos_segment
  54. X        call    walk_arena_chain
  55. X        jnc    resize_program
  56. X        jmp    abort_exec_free        ; can't fix it up now.
  57. X
  58. ; We now resize the program to the size specified by cs:rootsize.  This will
  59. ; free most of the memory taken up by the current program segment.
  60. resize_program: mov    es, [psp]        ; es is segment to resize.
  61. X        mov    bx, [rootsize]        ; bx is size of segment.
  62. X        mov    ah, 04aH        ; resize memory block
  63. X        int    21H
  64. X        jnc    swap_out_ok
  65. X        jmp    abort_exec_resize    ; disaster
  66. swap_out_ok:    ret
  67. X
  68. ; The swap out failed for some reason, so free any allocated resources
  69. ; and set the carry bit.
  70. abort_swap_out:    mov    bx, [swap]
  71. X        call    [free_resource+bx]
  72. X        xor    ax, ax
  73. X        mov    [swap], ax        ; clear the swap flag
  74. X        stc
  75. X        ret
  76. swap_out endp
  77. X
  78. X
  79. ;=============================================================================
  80. ; CODE TO SET-UP FOR AND EXEC THE CHILD PROCESS
  81. ;=============================================================================
  82. ; Actually execute the program.  If cs:swap is set, this code will invoke the
  83. ; swap-out/swap-in code as required.
  84. do_exec proc near
  85. X        cmp    [swap], 0        ; does the user want to swap?
  86. X        je    no_swap_out        ; nope
  87. X        call    init_swap        ; figger out where to swap to
  88. X        jc    no_swap_out        ; if carry set then don't swap
  89. X        call    swap_out
  90. X
  91. no_swap_out:    cmp    [interrupted], 0    ; were we interrupted?
  92. X        jne    leave_exec        ; yep, so clean up, don't exec
  93. X
  94. ; free passed in environment block if it is non zero.
  95. ; This way the parent program does not need to free it.
  96. X        mov    ax, [envseg]
  97. X        or    ax, ax
  98. X        je    setup_block
  99. X        push    ax
  100. X        mov    es, ax
  101. X        mov    ah, 49H
  102. X        int    21H
  103. X        pop    ax
  104. X
  105. ; set up the parameter block for the DOS exec call.
  106. ;    offset  contents
  107. ;        00  segment address of environment to be passed,
  108. ;          0 => use parents env.
  109. ;        02  pointer to command tail for new process.
  110. ;        06  pointer to fcb1
  111. ;        0a  pointer to fcb2
  112. setup_block:    mov    ax, [envseg]
  113. X        mov    [ex_envseg], ax
  114. X        mov    cx, cs
  115. X        mov    [word ptr ex_cmdtail], offset cmdtail
  116. X        mov    [word ptr ex_cmdtail+2], cx
  117. X
  118. ; set up registers for exec call
  119. ;    ds:dx    - pointer to pathname of program to execute
  120. ;    es:bx    - pointer to above parameter block
  121. X        mov    dx, offset cmdpath
  122. X        mov    es, cx
  123. X        mov    bx, offset exec_block
  124. X
  125. ; Under DOS 2.x exec is notorious for clobbering registers and guarantees
  126. ; to preserve only cs:ip.
  127. X        push    ds
  128. X        mov    [ex_sp], sp
  129. X        mov    [ex_ss], ss
  130. X        mov    [ex_error], 0        ; clear exec error code
  131. X        inc    [in_exec]        ; set internal flag
  132. X        mov    ax, 04b00H
  133. X        int    21H
  134. X
  135. ; returned from exec, so restore possibly clobbered registers.
  136. X        mov    ss, cs:ex_ss
  137. X        mov    sp, cs:ex_sp
  138. X        pop    ds
  139. X
  140. ; check to make certain the exec call worked.
  141. X        jnc    it_worked
  142. X
  143. ; exec call failed.  Save return code from msdos.
  144. X        mov    [ex_error], ax
  145. X        jmp    leave_exec
  146. X
  147. it_worked:    mov    ah, 04dH    ; get the return code
  148. X        int    21H
  149. X        cbw
  150. X        mov    [eretcode], ax
  151. X
  152. leave_exec:    cmp    [swap], 0    ; check swap, if non-zero swap back in
  153. X        je    no_swap_in
  154. X        call    swap_in
  155. X
  156. ; Clear the in_exec after the swap back in.  This way we are guaranteed to
  157. ; get parent in and the resources freed should a ^C be hit when we are reading
  158. ; the image in.
  159. no_swap_in:    mov    [in_exec], 0
  160. X        ret
  161. do_exec endp                
  162. X
  163. X
  164. X
  165. ;==============================================================================
  166. ; Everything past this point is overwriten with the environment and new
  167. ; program after the currently executing program is swapped out.
  168. ;==============================================================================
  169. overlay_code_here label word
  170. X
  171. ;-----------------------------------------------------------------------------
  172. ; Figure out where we can swap to and initialize the resource we are going to
  173. ; use.  We try XMS, EMS, and a tempfile (if specified), in that order.  We set
  174. ; [cs:swap] to the correct value based on which of the resources exists.
  175. ; If none can be used, then [cs:swap] is set to 0, and no swap takes place.
  176. ; The exec code will still attempt to execute the child in this instance, but
  177. ; may fail due to lack of resources.   Each swap_out_* routine must provide
  178. ; its own clean-up handler should it not be able to write all program
  179. ; segments to the swap resource.
  180. init_swap proc near
  181. X        mov    [swap], 0
  182. ;call    init_xms
  183. ;jnc    init_done
  184. ;call    init_ems
  185. ;jnc    init_done
  186. X        call    init_file
  187. init_done:    ret
  188. init_swap endp
  189. X
  190. X
  191. ;-----------------------------------------------------------------------------
  192. ; This routine is used to walk the DOS allocated memory block chain
  193. ; starting at address supplied in the es register.  For each block it
  194. ; calls the routine specified by the bx register with the segment length
  195. ; in si, and its address in di.  It does not apply the routine to the
  196. ; segment if the segment is the same as the current program's [cs:psp] value.
  197. memheader struc
  198. X   magic    db    ?    ; either 'Z' for end or 'M' for allocated
  199. X   owner    dw    ?    ; psp of owner block
  200. X   len        dw    ?    ; length in paragraphs of segment
  201. memheader ends
  202. X
  203. walk_arena_chain proc near
  204. X        mov    si, word ptr es:3        ; get length
  205. X        mov    di, es
  206. X        inc    di
  207. X        mov    ax, word ptr es:1
  208. X
  209. ; Stop the search if the block is NOT owned by us.  Ignore our own psp block
  210. ; and our environment segment block.
  211. X        cmp    ax, cs:psp            ; is it owned by us?
  212. X        jne    walk_done            ; NOPE!  -- all done
  213. X        cmp    di, cs:envseg            ; skip our environment
  214. X        je    next_block
  215. X        cmp    di, cs:psp            ; skip our psp
  216. X        je    next_block
  217. X
  218. ; Now save state and call the routine pointed at by [bx].
  219. X        push    di
  220. X        push    si
  221. X        push    bx
  222. X        call    bx
  223. X        pop    bx
  224. X        pop    si
  225. X        pop    di
  226. X        jc    exit_walk            ; if error then stop
  227. X        mov    al, byte ptr es:0        ; check if at end 
  228. X        cmp    al, 'Z'
  229. X        je    walk_done
  230. X
  231. next_block:    add    di, si                ; go on to next segment
  232. X        mov    es, di
  233. X        jmp    walk_arena_chain
  234. walk_done:    clc
  235. exit_walk:    ret
  236. walk_arena_chain endp
  237. X
  238. X
  239. ;-----------------------------------------------------------------------------
  240. ; This routine takes a dos segment found in the di register and free's it.
  241. free_dos_segment proc near
  242. X        mov    es, di        ; free dos memory block
  243. X        mov    ah, 49H
  244. X        int    21H
  245. X        ret
  246. free_dos_segment endp
  247. X
  248. X
  249. ;-----------------------------------------------------------------------------
  250. ; Called to invoke write_segment with proper values in the al register.  Only
  251. ; ever called from walk_arena_chain, and so al should be set to seg_alloc.
  252. write_segment_data label near
  253. X        mov    al, seg_alloc    ; and fall through into write_segment
  254. ;-----------------------------------------------------------------------------
  255. ; This routine writes a segment as a block of data segments if the number of
  256. ; paragraphs to write exceeds 0x0fff (rarely the case).
  257. ; It stuffs the info into tmpseg, and then calls wheader and wseg to get the
  258. ; data out.
  259. ;
  260. ;    di:dx    segment:offset of segment;  offset is ALWAYS zero.
  261. ;    si    number of paragraphs to write.
  262. ;    al    mode of header to write
  263. write_segment proc near
  264. X        push    di
  265. X        push    si
  266. X        xor    dx,dx
  267. X        mov    bx, [swap]
  268. X        call    [write_header+bx]
  269. X        pop    si
  270. X        pop    di
  271. X        jc    exit_wseg
  272. X
  273. do_io_loop:    cmp    si, 0        ; are we done yet?
  274. X        je    exit_wseg    ; yup so leave.
  275. X        mov    cx, si        ; # of paragraphs to move
  276. X        cmp    cx, 0fffH    ; see if we have lots to move?
  277. X        jle    do_io
  278. X        mov    cx, 0fffH    ; reset to max I/O size
  279. X
  280. do_io:        push    cx        ; save # of paragraphs we are writing
  281. X        shl    cx, 1        ; shift cx by four to the left
  282. X        shl    cx, 1
  283. X        shl    cx, 1
  284. X        shl    cx, 1
  285. X        push    di        ; save the start, and count left
  286. X        push    si
  287. X        mov    si, cx
  288. X        xor    dx,dx
  289. X        mov    al, seg_data
  290. X        mov    bx, [swap]
  291. X        push    bx
  292. X        call    [write_header+bx]
  293. X        pop    bx
  294. X        call    [write_seg+bx]
  295. X        pop    si
  296. X        pop    di
  297. X        pop    dx        ; original paragraph count in dx
  298. X        jc    exit_wseg    ; it failed so exit.
  299. X        add    di, dx        ; adjust the pointers, and continue.
  300. X        sub    si, dx
  301. X        jmp     do_io_loop
  302. exit_wseg:    ret
  303. write_segment endp
  304. X
  305. X
  306. ;=============================================================================
  307. ; THE FOLLOWING SECTION DEALS WITH ALL ROUTINES REQUIRED TO WRITE XMS RECORDS.
  308. ;=============================================================================
  309. init_xms proc near
  310. X        ret
  311. init_xms endp
  312. X
  313. whdr_xms proc near
  314. X        ret
  315. whdr_xms endp
  316. X
  317. wseg_xms proc near
  318. X        ret
  319. wseg_xms endp
  320. ;=============================================================================
  321. X
  322. X
  323. ;=============================================================================
  324. ; THE FOLLOWING SECTION DEALS WITH ALL ROUTINES REQUIRED TO WRITE EMS RECORDS.
  325. ;=============================================================================
  326. init_ems proc near
  327. X        ret
  328. init_ems endp
  329. X
  330. whdr_ems proc near
  331. X        ret
  332. whdr_ems endp
  333. X
  334. wseg_ems proc near
  335. X        ret
  336. wseg_ems endp
  337. ;=============================================================================
  338. X
  339. X
  340. ;=============================================================================
  341. ; THE FOLLOWING SECTION DEALS WITH ALL ROUTINES REQUIRED TO WRITE FILES.
  342. ;=============================================================================
  343. ;-----------------------------------------------------------------------------
  344. ; Attempt to create a temporary file.  If the tempfile name is NIL then return
  345. ; with the cary flag set.
  346. init_file proc near
  347. X        mov    al, [tmpname]
  348. X        or    al, al
  349. X        je    err_init_file
  350. X        mov    dx, offset tmpname
  351. X        xor     cx, cx
  352. X        mov    ah, 03cH
  353. X        int    21H
  354. X        jc    err_init_file        ; if carry set then failure
  355. X        mov    [tmphandle], ax        ; init swapping
  356. X        mov    [swap], swap_file
  357. X        jmp    exit_init_file
  358. err_init_file:    stc
  359. exit_init_file: ret
  360. init_file endp
  361. X
  362. X
  363. ;-----------------------------------------------------------------------------
  364. ; This routine writes a segment header to a file.
  365. ; The header is a seven byte record formatted as follows:
  366. ;    segment address        - of data
  367. ;    offset address        - of data
  368. ;     length in paragraphs    - of data
  369. ;    mode            - 1 => segment header (allocate seg on read)
  370. ;                  0 => subsegment, don't allocate on read.
  371. ; Routine takes three arguments:
  372. ;    di:dx    segment:offset of segment
  373. ;    si    number of paragraphs to write.
  374. ;    al    mode of header to write
  375. whdr_file proc near
  376. X        mov    [word ptr tmpseg], di    ; save the segment/offset
  377. X        mov    [word ptr tmpseg+2], dx
  378. X        mov    [word ptr tmpseg+4], si    ; save the segment length
  379. X        mov    [tmpseg+6], al
  380. X        mov    dx, offset tmpseg    ; write the header record out
  381. X        mov    cx, 7
  382. X        mov    bx, [tmphandle]
  383. X        mov    ah, 040H
  384. X        int    21H
  385. X        jc    exit_whdr_file        ; make sure it worked
  386. X        cmp    ax, 7
  387. X        je    exit_whdr_file        ; oh oh, disk is full!
  388. err_whdr_file:    stc
  389. exit_whdr_file:    ret
  390. whdr_file endp
  391. X
  392. X
  393. ;-----------------------------------------------------------------------------
  394. ; Write a segment to the temporary file whose handle is in cs:tmphandle
  395. ; Parameters for the write are assumed to be stored in the tmpseg data area.
  396. ; function returns carry set if failed, carry clear otherwise.
  397. wseg_file proc near
  398. X        push    ds
  399. X        mov    ds, word ptr cs:tmpseg ; Now write the whole segment
  400. X        mov    dx, word ptr cs:tmpseg+2
  401. X        mov    cx, word ptr cs:tmpseg+4
  402. X        mov    bx, cs:tmphandle
  403. X        mov    ah, 040H
  404. X        int    21H
  405. X        pop    ds
  406. X        jc    exit_wseg_file        ; make sure it worked
  407. X        cmp    ax, [word ptr tmpseg+4]
  408. X        je    exit_wseg_file
  409. err_wseg_file:    stc                ; it failed (usually disk full)
  410. exit_wseg_file:    ret
  411. wseg_file endp
  412. ;=============================================================================
  413. X
  414. X
  415. ;=============================================================================
  416. ; _exec: THIS IS THE MAIN ENTRY ROUTINE TO THIS MODULE
  417. ;=============================================================================
  418. ; This is the main entry routine into the swap code and corresponds to the
  419. ; following C function call:
  420. ;
  421. ; exec( int swap, char far *program, char far *cmdtail, int environment_seg,
  422. ;    char far *tmpfilename );
  423. ;
  424. ; Exec performs the following:
  425. ;    1. set up the local code segment copies of arguments to the exec call.
  426. ;    2. switch to a local stack frame so that we don't clobber the user
  427. ;       stack.
  428. ;    3. save old interrupt vectors for ctrl-brk.
  429. ;    4. install our own handler for the ctrl-brk interrupt, our handler
  430. ;       terminates the current running process, and returns with non-zero
  431. ;       status code.
  432. ;    5. get our psp
  433. ;    6. setup arguments for exec call
  434. ;    7. exec the program, save result code on return.
  435. ;       8. restore previous ctrl-brk and crit-error handler.
  436. ;       9. restore previous process stack, and segment registers.
  437. ;      10. return from exec with child result code in AX
  438. ;       and global _Interrupted flag set to true if child execution was
  439. ;       interrupted.
  440. X
  441. ; NOTE:  When first called the segments here assume the standard segment
  442. ;        settings.
  443. X        assume cs:@code, ds:DGROUP,es:DGROUP,ss:DGROUP
  444. X
  445. X        public    _exec
  446. _exec proc
  447. X            push    bp        ; set up the stack frame
  448. X        mov    bp, sp
  449. X        push    si        ; save registers we shouldn't step on.
  450. X        push    di
  451. X        push    ds
  452. X
  453. ; set up for copying of parameters passed in with long pointers.
  454. X        push    cs        ; going to use lodsb/stosb, set up es
  455. X        pop    es        ; as destination.
  456. X        assume  es:@code    ; let the assembler know :-)
  457. X        cld            ; make sure direction is right
  458. X
  459. ; Copy all parameters into the bottom of the code segment.  After doing so we
  460. ; will immediately switch stacks, so that the user stack is preserved intact.
  461. X        mov    ax, ss:[a_swap]        ; save swap
  462. X        mov    es:swap, ax
  463. X        mov    ax, ss:[a_env]        ; save env seg to use
  464. X        mov    es:envseg, ax
  465. X
  466. X        mov     di, offset cs:cmdpath    ; copy the command
  467. X        lds     si, ss:[a_prog]        ; 65 bytes worth
  468. X        mov    cx, 65
  469. X        call    copy_data
  470. X
  471. X        mov    di, offset cs:cmdtail    ; copy the command tail
  472. X        lds    si, ss:[a_tail]        ; 129 bytes worth
  473. X        mov    cx, 129
  474. X        call    copy_data
  475. X
  476. X        mov    di, offset cs:tmpname    ; copy the temp file name
  477. X        lds    si, ss:[a_tmp]        ; 65 bytes worth.
  478. X        mov    cx, 65
  479. X        call    copy_data
  480. X
  481. ; Now we save the current ss:sp stack pointer and swap stack to our temporary
  482. ; stack located in the current code segment.  At the same time we reset the
  483. ; segment pointers to point into the code segment only.
  484. swap_stacks:    mov    ax, ss
  485. X        mov    es:old_ss, ax
  486. X        mov    es:old_sp, sp
  487. X        mov    ax, cs
  488. X        mov    ds, ax
  489. X        mov    ss, ax            ; set ss first, ints are then
  490. X        mov    sp, offset cs:exec_sp    ; disabled for this instr too
  491. X        assume  ds:@code, ss:@code    ; let the assembler know :-)
  492. X
  493. ; Now we save the old control break and critical error handler addresses.
  494. ; We replace them by our own routines found in the resident portion of the
  495. ; swapping exec code.
  496. set_handlers:    mov    [interrupted], 0    ; clear interrupted flag
  497. X        mov    [eretcode], 0        ; clear the return code
  498. X        mov    ax, 03523H        ; get int 23 handler address
  499. X        int    21H
  500. X        mov    cs:old_ctl_brk_off, bx
  501. X        mov    cs:old_ctl_brk_seg, es
  502. X        mov    dx, offset ctl_brk_handler
  503. X        mov    ax, 02523H        ; set int 23 handler address
  504. X        int    21H
  505. X
  506. X        mov    ax, 03524H        ; get int 24 handler address
  507. X        int    21H
  508. X        mov    cs:old_crit_err_off, bx
  509. X        mov    cs:old_crit_err_seg, es
  510. X        mov    dx, offset crit_err_handler
  511. X        mov    ax, 02524H        ; set int 24 handler address
  512. X        int    21H
  513. X
  514. ; Go and execute the child, we've set up all of its parameters.  The do_exec
  515. ; routine will attempt to perform a swap of the code if requested to do so by
  516. ; a non-zero value in the variable cs:swap.
  517. X        mov    ah, 051H        ; get the psp
  518. X        int    21H
  519. X        mov    cs:psp, bx
  520. X        call    do_exec
  521. X
  522. ; We're back from the exec, so fix things up the way they were.
  523. ; Restore the old control-break and critical-error handlers.
  524. X        lds    dx, cs:old_ctl_brk
  525. X        mov    ax, 02523H
  526. X        int    21H
  527. X        lds    dx, cs:old_crit_err
  528. X        mov    ax, 02524H
  529. X        int    21H
  530. X
  531. ; Restore previous program stack segment registers, and data segment.
  532. X        mov    ax, cs:old_ss
  533. X        mov    ss, ax            ; mov into ss first, that way
  534. X        mov    sp, cs:old_sp        ; no interrupts in this instr.
  535. X        pop    ds
  536. X
  537. ; Tell the assembler we have swaped segments again.
  538. X        assume    ds:DGROUP,es:DGROUP,ss:DGROUP
  539. X
  540. ; Set the global Interrupted flag so that parent can tell it was interrupted.
  541. X        mov    ax, seg DGROUP:_Interrupted
  542. X        mov    es, ax
  543. X        mov    ax, cs:interrupted
  544. X        mov    es:_Interrupted, ax
  545. X
  546. ; Set the global errno value to reflect the success/failure of the DOS
  547. ; exec call.
  548. X        mov    ax, seg DGROUP:_errno
  549. X        mov    es, ax
  550. X        mov    ax, cs:ex_error
  551. X        mov    es:_errno, ax
  552. X
  553. ; Fetch the child's return code, pop rest of stuff off of the stack
  554. ; and return to the caller.
  555. X        mov    ax, cs:eretcode
  556. X        pop    di
  557. X        pop    si
  558. X        pop    bp
  559. X        ret
  560. _exec endp
  561. X
  562. ; void do_hook_std_writes(int handle);
  563. ;    This saves the 21h interrupt vector and changes it to point
  564. ;    into this code.  Argument is the file handle of the -C file.
  565. X
  566. X    public _do_hook_std_writes
  567. _do_hook_std_writes proc
  568. X            push    bp
  569. X        mov    bp,sp
  570. X        push    di
  571. X
  572. X        mov    di, ss:[a_handle]    ; handle of -C file
  573. X        mov    std_fil_handle, di
  574. X
  575. X        mov    ah, 51h            ; request our PSP
  576. X        int    21h
  577. X        mov    [psp], bx        ; save it
  578. X
  579. X        mov    es, bx
  580. X        les    bx, es:[34h]        ; pointer to job file table
  581. X        mov    al, es:[bx+1]        ; system file # of our stdout
  582. X        mov    [our_stdout], al
  583. X        mov    al, es:[bx+di]        ; system file number of -C file
  584. X        mov    std_fil_number, al
  585. X
  586. X        mov    ax,3521h        ; request vector 21h
  587. X        int    21h            ; it's returned in ES:BX
  588. X        mov    word ptr [real_21h], bx
  589. X        mov    word ptr [real_21h+2], es
  590. X
  591. X        push    ds
  592. X        mov    ax,cs
  593. X        mov    ds,ax
  594. X        lea    dx,our_21h_handler    ; DS:DX is the new vector
  595. X        mov    ax,2521h        ; set vector 21h
  596. X        int    21h
  597. X
  598. X        pop    ds
  599. X        pop    di
  600. X        pop    bp
  601. X        ret
  602. _do_hook_std_writes endp
  603. X
  604. ; void do_unhook_std_writes(void);
  605. ;    This restores the 21h interrupt vector.
  606. ;    The saved vector is zero if it wasn't changed (no -C option).
  607. X
  608. X    public _do_unhook_std_writes
  609. _do_unhook_std_writes proc
  610. X        push    ds
  611. X
  612. X            lds    dx, [real_21h]    ; put saved vector into DS:DX
  613. X        mov    ax, ds
  614. X        or    ax, dx
  615. X        jz    unhook_return    ; zero means we didn't hook 21h
  616. X
  617. X        mov    ax,2521h    ; set vector 21h
  618. X        simulate_21h
  619. X
  620. unhook_return:    pop ds
  621. X        ret
  622. _do_unhook_std_writes endp
  623. end
  624. SHAR_EOF
  625. chmod 0640 dmake/msdos/exec.asm ||
  626. echo 'restore of dmake/msdos/exec.asm failed'
  627. Wc_c="`wc -c < 'dmake/msdos/exec.asm'`"
  628. test 37235 -eq "$Wc_c" ||
  629.     echo 'dmake/msdos/exec.asm: original size 37235, current size' "$Wc_c"
  630. rm -f _shar_wnt_.tmp
  631. fi
  632. # ============= dmake/msdos/exec.h ==============
  633. if test -f 'dmake/msdos/exec.h' -a X"$1" != X"-c"; then
  634.     echo 'x - skipping dmake/msdos/exec.h (File already exists)'
  635.     rm -f _shar_wnt_.tmp
  636. else
  637. > _shar_wnt_.tmp
  638. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/exec.h' &&
  639. #ifndef _EXEC_h_
  640. #define _EXEC_h_
  641. X
  642. #ifndef ANSI
  643. #if defined(__STDC__) || defined(__TURBOC__)
  644. #define ANSI(x) x
  645. #else
  646. #define ANSI(x) ()
  647. #endif
  648. #endif
  649. X
  650. extern int  exec ANSI((int, char far *, char far *, unsigned int, char far *));
  651. X
  652. #ifndef MK_FP
  653. #define MK_FP(seg,ofs) \
  654. X    ((void far *) (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
  655. #endif
  656. X
  657. #endif
  658. SHAR_EOF
  659. chmod 0640 dmake/msdos/exec.h ||
  660. echo 'restore of dmake/msdos/exec.h failed'
  661. Wc_c="`wc -c < 'dmake/msdos/exec.h'`"
  662. test 351 -eq "$Wc_c" ||
  663.     echo 'dmake/msdos/exec.h: original size 351, current size' "$Wc_c"
  664. rm -f _shar_wnt_.tmp
  665. fi
  666. # ============= dmake/msdos/exec.uue ==============
  667. if test -f 'dmake/msdos/exec.uue' -a X"$1" != X"-c"; then
  668.     echo 'x - skipping dmake/msdos/exec.uue (File already exists)'
  669.     rm -f _shar_wnt_.tmp
  670. else
  671. > _shar_wnt_.tmp
  672. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/exec.uue' &&
  673. begin 640 exec.obj
  674. M@!``#DU31$]37&5X96,N87-M;(@?````5'5R8F\@07-S96UB;&5R("!697)S
  675. M:6]N(#(N-;2(%@!`Z4!SIA8.35-$3U-<97AE8RYA<VW&B`,`0.E,E@(``&B(
  676. M`P!`H926$``)15A%0U]415A4!$-/1$5IF`<`2!`(`@,!^Y8,``5?1$%4001$
  677. M051!PI@'`$@"``0%`0V6"``&1$=23U50BYH$``;_`EN,"0`&7V5R<FYO`."0
  678. M$P`!`@Q?26YT97)R=7!T960```!9D!P```$57V1O7W5N:&]O:U]S=&1?=W)I
  679. M=&5S^0<`<I`,```!!5]E>&5CUP8`?9`:```!$U]D;U]H;V]K7W-T9%]W<FET
  680. M97.N!P"DB`0`0*(!D:`&``&8````P:(.``%<`24``0`!`````0#*H@X``8@!
  681. M00`!``$````!`(*@!0`!R0&0`*`(``',`0````"*H.P``=0!97AE8SH@1F%I
  682. M;'5R92!R96%D:6YG(&AE861E<B!B;&]C:PT*)&5X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  730. M5`'$G50!Q*!4`<2O5`'$M%0!Q+=4`<3%5`'$S50!Q-=4`<3@5`'$YU0!R.L4
  731. M`0+$\50!Q/44`0+(^!8!`<3^5`'%`A8!`<4&5`'%%E0!Q1]4`<4N5`'%-50!
  732. CQ3]4`<5$5`'%3%0!Q5M4`<5J5`&-H`8``@````!8B@(``'14
  733. `
  734. end
  735. SHAR_EOF
  736. chmod 0640 dmake/msdos/exec.uue ||
  737. echo 'restore of dmake/msdos/exec.uue failed'
  738. Wc_c="`wc -c < 'dmake/msdos/exec.uue'`"
  739. test 3671 -eq "$Wc_c" ||
  740.     echo 'dmake/msdos/exec.uue: original size 3671, current size' "$Wc_c"
  741. rm -f _shar_wnt_.tmp
  742. fi
  743. # ============= dmake/msdos/find.c ==============
  744. if test -f 'dmake/msdos/find.c' -a X"$1" != X"-c"; then
  745.     echo 'x - skipping dmake/msdos/find.c (File already exists)'
  746.     rm -f _shar_wnt_.tmp
  747. else
  748. > _shar_wnt_.tmp
  749. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/find.c' &&
  750. /*
  751. X    Directory Access Library
  752. X
  753. X           FIND.C taken from DIRLIB.C by M. J. Weinstein
  754. X         Released to public domain 1-Jan-89
  755. X
  756. X    The author may be contacted at: 
  757. X    matt@cs.ucla.edu -or- POB 84524, L.A., CA  90073
  758. X
  759. X    Modified by dvadura@watdragon.edu to work with dmake.
  760. X    (nuked the DOS version 2 code, since dmake needs version
  761. X    3.0 or greater to function).
  762. X */
  763. X
  764. X
  765. /*
  766. X * revision history:
  767. X *
  768. X *    VER    MM/DD/YY    COMMENTS
  769. X *    ----    --------    --------
  770. X *    0.99    02/24/86    Beta release to INTERNET
  771. X */
  772. X
  773. #include <stdlib.h>
  774. #include <ctype.h>
  775. #include <errno.h>
  776. #include <string.h>
  777. #include <alloc.h>
  778. #include <dos.h>
  779. #include "dirlib.h"
  780. X
  781. #ifndef MK_FP
  782. #define MK_FP(seg,ofs)    ((void far *) \
  783. X               (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
  784. #endif
  785. #ifndef FP_SEG
  786. #define FP_SEG(fp)    ((unsigned)((unsigned long)(fp) >> 16))
  787. #endif
  788. #ifndef FP_OFF
  789. #define FP_OFF(fp)    ((unsigned)(fp))
  790. #endif
  791. X
  792. int              _err;
  793. static DTA far *_getsetdta ANSI((DTA far *));
  794. X
  795. /*
  796. X * get/set dta address
  797. X */
  798. X
  799. static DTA far *
  800. _getsetdta(newdta)
  801. DTA far *newdta;
  802. {
  803. X    DTA far *olddta;
  804. X    union REGS r;
  805. X    struct SREGS s;
  806. X
  807. X    /* get old dta */         
  808. X    r.h.ah = 0x2f;
  809. X    intdos(&r, &r);
  810. X    segread(&s);
  811. X    olddta = (DTA far *) MK_FP(s.es, r.x.bx);
  812. X
  813. X    /* conditionally set new dta */
  814. X    if (newdta) {
  815. X        r.h.ah = 0x1a;
  816. X        s.ds    = FP_SEG(newdta);
  817. X        r.x.dx    = FP_OFF(newdta);    
  818. X        intdosx(&r, &r, &s);
  819. X    }
  820. X
  821. X    return olddta;
  822. }
  823. X
  824. /*
  825. X * dos findfirst
  826. X */
  827. X
  828. DTA *
  829. findfirst(name, dta)
  830. char *name;
  831. DTA  *dta;
  832. {
  833. X    union REGS r;  
  834. X    struct SREGS s;
  835. X    DTA far *dtasave;
  836. X    char far *nmp = (char far *)name;
  837. X
  838. X    dtasave = _getsetdta((DTA far *)dta);
  839. X    
  840. X    /* do directory lookup */
  841. X    segread(&s);
  842. X    r.h.ah    = 0x4e;
  843. X    r.x.cx    = 0x10;
  844. X    r.x.dx    = FP_OFF(nmp);
  845. X    s.ds    = FP_SEG(nmp);
  846. X    intdosx(&r, &r, &s);
  847. X    /* restore dta */
  848. X    _getsetdta(dtasave);
  849. X    _err = r.x.ax;
  850. X    if (r.x.cflag)
  851. X        return (DTA *) 0;
  852. X
  853. X    return dta;
  854. }
  855. X
  856. /*
  857. X * dos findnext
  858. X */
  859. X
  860. DTA *
  861. findnext(dta)
  862. DTA *dta;
  863. {
  864. X    union REGS r;  
  865. X    DTA far *dtasave;
  866. X
  867. X    dtasave = _getsetdta((DTA far *)dta);
  868. X
  869. X    /* do directory lookup */
  870. X    r.h.ah = 0x4f;
  871. X    intdos(&r, &r);
  872. X    /* restore old dta */
  873. X    _getsetdta(dtasave);
  874. X    _err = r.x.ax;
  875. X    if (r.x.cflag)
  876. X        return (DTA *) 0;
  877. X
  878. X    return dta;
  879. }
  880. SHAR_EOF
  881. chmod 0640 dmake/msdos/find.c ||
  882. echo 'restore of dmake/msdos/find.c failed'
  883. Wc_c="`wc -c < 'dmake/msdos/find.c'`"
  884. test 2140 -eq "$Wc_c" ||
  885.     echo 'dmake/msdos/find.c: original size 2140, current size' "$Wc_c"
  886. rm -f _shar_wnt_.tmp
  887. fi
  888. # ============= dmake/msdos/mscdos/config.h ==============
  889. if test ! -d 'dmake/msdos/mscdos'; then
  890.     mkdir 'dmake/msdos/mscdos'
  891. fi
  892. if test -f 'dmake/msdos/mscdos/config.h' -a X"$1" != X"-c"; then
  893.     echo 'x - skipping dmake/msdos/mscdos/config.h (File already exists)'
  894.     rm -f _shar_wnt_.tmp
  895. else
  896. > _shar_wnt_.tmp
  897. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/config.h' &&
  898. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/mscdos/config.h,v 1.1 1992/01/24 03:27:25 dvadura Exp $
  899. -- SYNOPSIS -- Configurarion include file.
  900. -- 
  901. -- DESCRIPTION
  902. --     There is one of these for each specific machine configuration.
  903. --    It can be used to further tweek the machine specific sources
  904. --    so that they compile.
  905. --
  906. -- AUTHOR
  907. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  908. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  909. --
  910. -- COPYRIGHT
  911. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  912. -- 
  913. --      This program is free software; you can redistribute it and/or
  914. --      modify it under the terms of the GNU General Public License
  915. --      (version 1), as published by the Free Software Foundation, and
  916. --      found in the file 'LICENSE' included with this distribution.
  917. -- 
  918. --      This program is distributed in the hope that it will be useful,
  919. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  920. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  921. --      GNU General Public License for more details.
  922. -- 
  923. --      You should have received a copy of the GNU General Public License
  924. --      along with this program;  if not, write to the Free Software
  925. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  926. --
  927. -- LOG
  928. --     $Log: config.h,v $
  929. X * Revision 1.1  1992/01/24  03:27:25  dvadura
  930. X * dmake Version 3.8, Initial revision
  931. X *
  932. */
  933. X
  934. #if defined (_MSC_VER)
  935. # if _MSC_VER < 500
  936. X    Force a compile-time blowup.
  937. X    Do not define define _MSC_VER for MSC compilers ealier than 5.0.
  938. # endif
  939. #endif
  940. X
  941. /* define this for configurations that don't have the coreleft function
  942. X * so that the code compiles.  To my knowledge coreleft exists only on
  943. X * Turbo C, but it is needed here since the function is used in many debug
  944. X * macros. */
  945. #define coreleft() 0L
  946. X
  947. /* MSC Version 4.0 doesn't understand SIGTERM, later versions do. */
  948. #ifndef SIGTERM
  949. #   define SIGTERM SIGINT
  950. #endif
  951. X
  952. /* Fixes unimplemented line buffering for MSC 5.x and 6.0.
  953. X * MSC _IOLBF is the same as _IOFBF
  954. X */
  955. #if defined(MSDOS) && defined (_MSC_VER)
  956. #   undef  _IOLBF
  957. #   define _IOLBF   _IONBF
  958. #endif
  959. X
  960. /* in alloc.h: size_t is redefined
  961. X * defined in stdio.h which is included by alloc.h
  962. X */
  963. #if defined(MSDOS) && defined (_MSC_VER)
  964. #   define _TYPES_
  965. #endif
  966. X
  967. /* in sysintf.c: SIGQUIT is used, this is not defined in MSC */
  968. #ifndef SIGQUIT
  969. #   define SIGQUIT SIGTERM
  970. #endif
  971. X
  972. /* MSC doesn't seem to care about CONST */
  973. #define CONST
  974. X
  975. #ifndef MSDOS
  976. #   define MSDOS 1
  977. #endif
  978. X
  979. /* a small problem with pointer to voids on some unix machines needs this */
  980. #define PVOID void *
  981. SHAR_EOF
  982. chmod 0640 dmake/msdos/mscdos/config.h ||
  983. echo 'restore of dmake/msdos/mscdos/config.h failed'
  984. Wc_c="`wc -c < 'dmake/msdos/mscdos/config.h'`"
  985. test 2637 -eq "$Wc_c" ||
  986.     echo 'dmake/msdos/mscdos/config.h: original size 2637, current size' "$Wc_c"
  987. rm -f _shar_wnt_.tmp
  988. fi
  989. # ============= dmake/msdos/mscdos/config.mk ==============
  990. if test -f 'dmake/msdos/mscdos/config.mk' -a X"$1" != X"-c"; then
  991.     echo 'x - skipping dmake/msdos/mscdos/config.mk (File already exists)'
  992.     rm -f _shar_wnt_.tmp
  993. else
  994. > _shar_wnt_.tmp
  995. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/config.mk' &&
  996. # This is the MSC 4.0 and higher DOS configuration file for DMAKE
  997. #    It simply modifies the values of SRC, and checks to see if
  998. #    OSENVIRONMENT is defined.  If so it includes the appropriate
  999. #    config.mk file.
  1000. #
  1001. # It also sets the values of .SOURCE.c and .SOURCE.h to include the local
  1002. # directory.
  1003. #
  1004. osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE)
  1005. X
  1006. TMPDIR :=
  1007. .EXPORT : TMPDIR
  1008. X
  1009. # Definition of macros for library, and C startup code.
  1010. X
  1011. # The following sources are required for MSC
  1012. OSR_SRC = tempnam.c
  1013. .SETDIR=$(osrdir) : $(OSR_SRC)
  1014. X
  1015. SRC += $(OSR_SRC)
  1016. .SOURCE.h : $(osrdir)
  1017. X
  1018. SET_STACK = /stack:4096
  1019. NDB_LDFLAGS += $(SET_STACK)
  1020. X
  1021. # Local configuration modifications for CFLAGS 
  1022. # If you have a 286 or better, you can uncomment the following line.
  1023. #HAVE_286 = y
  1024. X
  1025. .IF $(HAVE_286)
  1026. X  CFLAGS  += -G2
  1027. X  ASFLAGS += -Dhave286
  1028. .END
  1029. X
  1030. ASFLAGS += -t -mx $(S_$(MODEL))
  1031. X
  1032. # Microsoft C doesn't need tail but needs head
  1033. LDTAIL = ;
  1034. LDHEAD = $(LDFLAGS)
  1035. X
  1036. # Debugging libraries
  1037. DB_LDFLAGS += /co /li /map $(SET_STACK)
  1038. DB_LDLIBS  +=
  1039. X
  1040. # NO Debug MSC flags:
  1041. # Set the environment variable MSC_VER to be one of 4.0, 5.0, 5.1, or 6.0
  1042. # to get these by default when you make dmake using 'dmake'.
  1043. #
  1044. # Setting MSC_VER to one of the above sets the variable _MSC_VER appropriately
  1045. # and sets the flags appropriately.
  1046. X
  1047. .IMPORT .IGNORE : MSC_VER
  1048. MSC_VER *= 6.0              # If unset, assume 6.0 by default.
  1049. X
  1050. .IF $(MSC_VER) == 4.0
  1051. X   CFLAGS      += -I$(osrdir) $(C_$(MODEL):s/A/m/)
  1052. X   CFLAGS      += -DM_I86=1      # 5.0+ define this automatically
  1053. #   CFLAGS      += -D__STDC__=1    # 5.0, 5.1, but not 6.0 do this automatically
  1054. X   NDB_CFLAGS  +=
  1055. X   DB_CFLAGS   += -Zi
  1056. .ELSE
  1057. X   DB_CFLAGS   += -Zi
  1058. X   CFLAGS      += -I$(osrdir) $(C_$(MODEL))
  1059. X   .IF $(MSC_VER) != 6.0
  1060. X      # For 5.0 and 5.1, we define _MSC_VER=500 or 510
  1061. X      CFLAGS      += -D_MSC_VER=$(MSC_VER:s,.,,)0
  1062. X      NDB_CFLAGS  += -Oscl -Gs
  1063. X   .ELSE
  1064. X      # Microsoft C 6.0 auto defines _MSC_VER=600, but not __STDC__
  1065. X      CFLAGS      += -D__STDC__=1 # incredibly not auto done by 6.0
  1066. X      NDB_CFLAGS  += -Osecgl -Gs
  1067. X
  1068. X      # Redefine rule for making our objects, we don't need mv
  1069. X      %$O : %.c ;% $(CC) -c $(CFLAGS) -Fo$@ $<
  1070. X   .END
  1071. X   NDB_LDFLAGS += /exe /packc /batch
  1072. X   NDB_LDLIBS  +=
  1073. .END
  1074. X
  1075. # See if we modify anything in the lower levels.
  1076. .IF $(OSENVIRONMENT) != $(NULL)
  1077. X   .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk
  1078. .END
  1079. X
  1080. C_s =
  1081. C_m = -AM
  1082. C_c = -AC
  1083. C_l = -AL
  1084. X
  1085. S_s = -Dmsmall
  1086. S_m = -Dmmedium
  1087. S_c = -Dmcompact
  1088. S_l = -Dmlarge
  1089. SHAR_EOF
  1090. chmod 0640 dmake/msdos/mscdos/config.mk ||
  1091. echo 'restore of dmake/msdos/mscdos/config.mk failed'
  1092. Wc_c="`wc -c < 'dmake/msdos/mscdos/config.mk'`"
  1093. test 2471 -eq "$Wc_c" ||
  1094.     echo 'dmake/msdos/mscdos/config.mk: original size 2471, current size' "$Wc_c"
  1095. rm -f _shar_wnt_.tmp
  1096. fi
  1097. # ============= dmake/msdos/mscdos/lib.rsp ==============
  1098. if test -f 'dmake/msdos/mscdos/lib.rsp' -a X"$1" != X"-c"; then
  1099.     echo 'x - skipping dmake/msdos/mscdos/lib.rsp (File already exists)'
  1100.     rm -f _shar_wnt_.tmp
  1101. else
  1102. > _shar_wnt_.tmp
  1103. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/lib.rsp' &&
  1104. X
  1105. SHAR_EOF
  1106. chmod 0640 dmake/msdos/mscdos/lib.rsp ||
  1107. echo 'restore of dmake/msdos/mscdos/lib.rsp failed'
  1108. Wc_c="`wc -c < 'dmake/msdos/mscdos/lib.rsp'`"
  1109. test 1 -eq "$Wc_c" ||
  1110.     echo 'dmake/msdos/mscdos/lib.rsp: original size 1, current size' "$Wc_c"
  1111. rm -f _shar_wnt_.tmp
  1112. fi
  1113. # ============= dmake/msdos/mscdos/libswp.rsp ==============
  1114. if test -f 'dmake/msdos/mscdos/libswp.rsp' -a X"$1" != X"-c"; then
  1115.     echo 'x - skipping dmake/msdos/mscdos/libswp.rsp (File already exists)'
  1116.     rm -f _shar_wnt_.tmp
  1117. else
  1118. > _shar_wnt_.tmp
  1119. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/libswp.rsp' &&
  1120. X
  1121. SHAR_EOF
  1122. chmod 0640 dmake/msdos/mscdos/libswp.rsp ||
  1123. echo 'restore of dmake/msdos/mscdos/libswp.rsp failed'
  1124. Wc_c="`wc -c < 'dmake/msdos/mscdos/libswp.rsp'`"
  1125. test 1 -eq "$Wc_c" ||
  1126.     echo 'dmake/msdos/mscdos/libswp.rsp: original size 1, current size' "$Wc_c"
  1127. rm -f _shar_wnt_.tmp
  1128. fi
  1129. # ============= dmake/msdos/mscdos/mk40.bat ==============
  1130. if test -f 'dmake/msdos/mscdos/mk40.bat' -a X"$1" != X"-c"; then
  1131.     echo 'x - skipping dmake/msdos/mscdos/mk40.bat (File already exists)'
  1132.     rm -f _shar_wnt_.tmp
  1133. else
  1134. > _shar_wnt_.tmp
  1135. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/mk40.bat' &&
  1136. md objects
  1137. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  infer.c
  1138. copy infer.obj objects
  1139. del infer.obj
  1140. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  make.c
  1141. copy make.obj objects
  1142. del make.obj
  1143. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  stat.c
  1144. copy stat.obj objects
  1145. del stat.obj
  1146. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  expand.c
  1147. copy expand.obj objects
  1148. del expand.obj
  1149. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dmstring.c
  1150. copy dmstring.obj objects
  1151. del dmstring.obj
  1152. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  hash.c
  1153. copy hash.obj objects
  1154. del hash.obj
  1155. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dag.c
  1156. copy dag.obj objects
  1157. del dag.obj
  1158. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dmake.c
  1159. copy dmake.obj objects
  1160. del dmake.obj
  1161. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  path.c
  1162. copy path.obj objects
  1163. del path.obj
  1164. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  imacs.c
  1165. copy imacs.obj objects
  1166. del imacs.obj
  1167. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  sysintf.c
  1168. copy sysintf.obj objects
  1169. del sysintf.obj
  1170. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  parse.c
  1171. copy parse.obj objects
  1172. del parse.obj
  1173. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  getinp.c
  1174. copy getinp.obj objects
  1175. del getinp.obj
  1176. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  quit.c
  1177. copy quit.obj objects
  1178. del quit.obj
  1179. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  state.c
  1180. copy state.obj objects
  1181. del state.obj
  1182. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  basename.c
  1183. copy basename.obj objects
  1184. del basename.obj
  1185. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dmdump.c
  1186. copy dmdump.obj objects
  1187. del dmdump.obj
  1188. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  macparse.c
  1189. copy macparse.obj objects
  1190. del macparse.obj
  1191. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  rulparse.c
  1192. copy rulparse.obj objects
  1193. del rulparse.obj
  1194. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  percent.c
  1195. copy percent.obj objects
  1196. del percent.obj
  1197. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  function.c
  1198. copy function.obj objects
  1199. del function.obj
  1200. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\ruletab.c
  1201. copy ruletab.obj objects
  1202. del ruletab.obj
  1203. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\dirbrk.c
  1204. copy dirbrk.obj objects
  1205. del dirbrk.obj
  1206. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\runargv.c
  1207. copy runargv.obj objects
  1208. del runargv.obj
  1209. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\arlib.c
  1210. copy arlib.obj objects
  1211. del arlib.obj
  1212. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\_chdir.c
  1213. copy _chdir.obj objects
  1214. del _chdir.obj
  1215. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\switchar.c
  1216. copy switchar.obj objects
  1217. del switchar.obj
  1218. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\rmprq.c
  1219. copy rmprq.obj objects
  1220. del rmprq.obj
  1221. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\tee.c
  1222. copy tee.obj objects
  1223. del tee.obj
  1224. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\mscdos\tempnam.c
  1225. copy tempnam.obj objects
  1226. del tempnam.obj
  1227. copy msdos\mscdos\startup.mk startup.mk
  1228. link /stack:4096 @msdos\mscdos\obj.rsp,dmake.exe,NUL.MAP;
  1229. SHAR_EOF
  1230. chmod 0640 dmake/msdos/mscdos/mk40.bat ||
  1231. echo 'restore of dmake/msdos/mscdos/mk40.bat failed'
  1232. Wc_c="`wc -c < 'dmake/msdos/mscdos/mk40.bat'`"
  1233. test 3032 -eq "$Wc_c" ||
  1234.     echo 'dmake/msdos/mscdos/mk40.bat: original size 3032, current size' "$Wc_c"
  1235. rm -f _shar_wnt_.tmp
  1236. fi
  1237. # ============= dmake/msdos/mscdos/mk40swp.bat ==============
  1238. if test -f 'dmake/msdos/mscdos/mk40swp.bat' -a X"$1" != X"-c"; then
  1239.     echo 'x - skipping dmake/msdos/mscdos/mk40swp.bat (File already exists)'
  1240.     rm -f _shar_wnt_.tmp
  1241. else
  1242. > _shar_wnt_.tmp
  1243. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/mk40swp.bat' &&
  1244. md objects
  1245. masm -t -mx -Dmlarge msdos\exec.asm;
  1246. mv exec.obj objects
  1247. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  infer.c
  1248. copy infer.obj objects
  1249. del infer.obj
  1250. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  make.c
  1251. copy make.obj objects
  1252. del make.obj
  1253. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  stat.c
  1254. copy stat.obj objects
  1255. del stat.obj
  1256. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  expand.c
  1257. copy expand.obj objects
  1258. del expand.obj
  1259. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dmstring.c
  1260. copy dmstring.obj objects
  1261. del dmstring.obj
  1262. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  hash.c
  1263. copy hash.obj objects
  1264. del hash.obj
  1265. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dag.c
  1266. copy dag.obj objects
  1267. del dag.obj
  1268. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dmake.c
  1269. copy dmake.obj objects
  1270. del dmake.obj
  1271. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  path.c
  1272. copy path.obj objects
  1273. del path.obj
  1274. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  imacs.c
  1275. copy imacs.obj objects
  1276. del imacs.obj
  1277. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  sysintf.c
  1278. copy sysintf.obj objects
  1279. del sysintf.obj
  1280. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  parse.c
  1281. copy parse.obj objects
  1282. del parse.obj
  1283. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  getinp.c
  1284. copy getinp.obj objects
  1285. del getinp.obj
  1286. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  quit.c
  1287. copy quit.obj objects
  1288. del quit.obj
  1289. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  state.c
  1290. copy state.obj objects
  1291. del state.obj
  1292. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  basename.c
  1293. copy basename.obj objects
  1294. del basename.obj
  1295. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  dmdump.c
  1296. copy dmdump.obj objects
  1297. del dmdump.obj
  1298. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  macparse.c
  1299. copy macparse.obj objects
  1300. del macparse.obj
  1301. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  rulparse.c
  1302. copy rulparse.obj objects
  1303. del rulparse.obj
  1304. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  percent.c
  1305. copy percent.obj objects
  1306. del percent.obj
  1307. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  function.c
  1308. copy function.obj objects
  1309. del function.obj
  1310. cl -c -I. -Imsdos -Imsdos\mscdos -mL -DM_I86=1  msdos\ruletab.c
  1311. copy ruletab.obj objects
  1312. SHAR_EOF
  1313. true || echo 'restore of dmake/msdos/mscdos/mk40swp.bat failed'
  1314. fi
  1315. echo 'End of part 23, continue with part 24'
  1316. echo 24 > _shar_seq_.tmp
  1317. exit 0
  1318. exit 0 # Just in case...
  1319.