;COPYRIGHT Hewlett-Packard Company 1987, 1988, 1989, 1990, 1991
; Routines to install an application:
;
; welcome_init
; print_source
; find_helpdir
; get_volume
; check_volume
; build_dirs
; start_install
; copyb_files
; install_help
; copy_files
; update_windows
; update_addwin
; get_info      
; get_response
; get_edit
; print_ins
; print_box
; print_menu
; print_screen
; print_welcome
; stash_screen
; rebuild_screen
; farewell
; get_windows
; get_winini
; get_app
; get_file
; update_givenfile

;Variables map
;	macro setvar.txt
;	macro symbol.txt	

 	goto skip_setutl
	
welcome_init
	       
;This procedure initiates the installation and
;determines the source and destination drives.
;
;Outputs:
;  var003 - gets the source drive (and a colon).
;  var004 - gets the application destination drive (and a colon).
;  var005 - gets the application destination directory.
;  var070 - gets the MS Windows drive (and a colon).
;  var071 - gets the MS Windows directory.
;  var072 - gets the MW Windows win.ini drive (and a colon).
;  var073 - gets the MS Windows win.ini directory.
							     
					;Get source drive now
	onerror gosub floppy_out
	whichdrive var003
	strcat var003 colon
					;List source info
	gosub print_source
					;Go get drive info
	set var004 defdrive
	strcat var004 colon
	set var005 app_dir
	set var070 var004
	set var071 win_path
	set var072 var004
	set var073 win_path

return
	
print_source

;This procedure will list all the disks required for installing the application.
;  Maximum 3 source disks are expected now.
;
;Inputs:			
;  var002 - application name.

	gosub print_welcome
	pos 4,3
	print app_instruct cr

	; 1st disk:
	pos 4,5
	diskette 1
	pos 22,6
	print app_name1 app_ext1
 	if app_name2 = null goto print_source1

	; 2nd disk:
	pos 6,9
	diskette 1
	pos 24,10
	print app_name2 app_ext2
 	if app_name3 = null goto print_source1

	; 3rd disk:
	pos 8,13
	diskette 1
	pos 26,14
	print app_name3 app_ext3
print_source1
 	if app_name4 = null goto print_source2

	; 2nd disk:
	pos 6,9
	diskette 1
	pos 24,10
	print app_name4 app_ext2
 	if app_name5 = null goto print_source2

	; 3rd disk:
	pos 8,13
	diskette 1
	pos 26,14
	print app_name5 app_ext3
print_source2
	pos 4,16
	print app_instruct3                 ; A.05 - disk space needed
	pos 4,18                            ; A.05
        print app_instruct2
        pos 8,19                            ; A.05
	print win_name " and " win_ini

     	gosub get_response

return			     

find_helpdir
		       
;This procedure looks for where help file should be installed.
;All help files should be installed in the same directory.
;For Openview applications, it will look in WIN.INI to find
;out where help files should be installed.
;
;Inputs:	 
;  var003 - application source drive
;  var072 - MS Windows WIN.INI disk drive.
;  var073 - MS Windows WIN.INI dir.
;
;Outputs:
;  var006 - help dir (string in WIN.INI) without a slash at the end

	onerror gosub floppy_out
	changedrive var003
        cd app_inst

	set find_file var072			;Find Win.ini file.
	strcat find_file var073
	if var073 = "\" goto root_win		;Skip if file is at root.
	strcat find_file bslash
root_win			
	strcat find_file win_ini
	set find_hlp null
	envstr find_hlp

	run mdini.exe "getlabelinfo" app_hdr app_hlptxt find_file

	if find_hlp = null goto helpsym_failed
	set var006 find_hlp
	strlen var006 len 
	sub 1 len
	mid var006 var006 1 len

return

get_volume

;This procedure will prompt for a new volume to be 
;   loaded and verify that the correct volume was loaded.
;		     
;Inputs:
;  var003 - source disk drive.
;  var050 - Name of the volume.
;  var051 - Volume label.

					;Check if volume already there
	onerror gosub floppy_out
 	set var052 null
	label var003 var052
 	if var052 = var051 return
					;Select mount volume message
	set var014 box_disk1
	set var015 box_disk2
	set var016 box_disk3
	set var017 box_disk4
					;Fill in the box's choices
 	set var022 2
					;Ask user to load the volume
	gosub print_screen
 	gosub rebuild_screen
					;Verify correct volume loaded
check_volume
	set var052 null
	onerror gosub floppy_out
	label var003 var052
 	if var052 = var051 return
					;Wrong volume.  Ask again
	bell
	set var053 vol_there
	if var052 = null set var053 vol_not
	if var052 = null set var052 vol_nolabel

	set var014 vol_again1
	set var015 vol_again2
	set var016 vol_again3
	set var017 vol_again4

	gosub print_screen
 	gosub rebuild_screen
					;Verify the volume again
	goto check_volume	
	
;return

build_dirs
		
;This procedure builds the directory structure required by application.
;
;Inputs:
;  var004 - application drive.
;  var005 - application dir.
;  var006 - help dir (string in WIN.INI) without a slash at the end
;  var007 - application private dir
;  var032 - help, symbols & bkground directory build flag
;
;Outputs:	
;  var006 - application help destination path
;  var007 - application private destination path
;  var090 - application private destination path for hidden files

	
	gosub print_welcome		 
					;Print setting up disk message
	print cr cr cr makedir
					;Check & create application dir
	set var030 var004
	set var031 var004
	strcat var031 var005
					;Set drive to default check for a file

					;build \OV
build_dirs1
	onerror gosub app_drive_error
	changedrive var030
	cd \
	exist var031 status
	if status = 1 goto file_there
        if status = 2 goto build_dirs2
					;Create dir
	mkdir var031 status
	if status != 0 gosub md_failed

					;build \OV\APP
build_dirs2	  

	if app_prv = null goto build_dirs3
 	set var007 var004
	strcat var007 var005  
 	strcat var007 app_prv
	set var030 var004
	set var031 var007

 	exist var031 status
	if status = 1 goto file_there
	if status = 2 goto build_dirs3

	mkdir var031 status
	if status != 0 gosub md_failed
					;build \OV\APP1 (for hidden files)
build_dirs3	

	if app_prvhid = null goto build_dirs4

 	set var090 var004
	strcat var090 var005  
 	strcat var090 app_prvhid
	set var030 var004
	set var031 var090

 	exist var031 status
	if status = 1 goto file_there
	if status = 2 goto build_dirs4

	mkdir var031 status
	if status != 0 gosub md_failed
					;build \OV\HELP
build_dirs4
					;Create help dir if need
	if var006 != null goto build_dirs5
 	set var006 var004
	strcat var006 var005
 	strcat var006 app_hlp
build_dirs5
	if var032 = null goto build_dirs6 ;Do not build for applications
	set var030 var004
	set var031 var006
 	exist var031 status		
	if status = 1 goto file_there
	if status = 2 goto build_dirs6

	mkdir var031 status
	if status != 0 gosub md_failed

					;build \OV\SYMBOLS
build_dirs6
					  ;Create symbols dir if need
	if var095 != null goto build_dirs7
 	set var095 var004
	strcat var095 var005

build_dirs7
	if var032 = null goto build_dirs8  ;Do not build for applications
	set var030 var077
	set var031 var095
 	exist var031 status		
	if status = 1 goto file_there
	if status = 2 goto build_dirs8
	
	mkdir var031 status
	if status != 0 gosub md_failed
					;build \OV\BKGROUND
build_dirs8
					;Create background dir if need
	if var093 != null goto build_dirs9
 	set var093 var004
	strcat var093 var005
 	strcat var093 app_bkgr
build_dirs9
	if var032 = null goto build_dirs10  ;Do not build for applications
	set var030 var004
	set var031 var093
 	exist var031 status		
	if status = 1 goto file_there
	if status = 2 goto build_dirs10	  

	mkdir var031 status
	if status != 0 gosub md_failed
	goto build_dirs10

file_there	
					;Setup prompts for the box
	set var022 2		
					;Assign box instructions
	set var014 box_error1
	set var015 box_error2
	set var016 box_error3
	set var017 box_error4
					;Go tell the user
	gosub print_screen
 	gosub rebuild_screen		 
delete_it				;Delete the file & create the dir
	delete var031 status
        goto build_dirs1
build_dirs10

return	
			
start_install

;This procedure copies the application files into the private OVDEMO\ 
;  (the sub-directory of OpenView).
;actually this installs into \OV   A.05	       	
;Inputs: 			
;  var003 - application source disk drive.
;  var007 - application private dir.
     					
					; Count files on multiple disks:
					;   on disk 1.
	set var040 cp_arch1
	set var041 app_files1
 	add app_files2 var041		  
 	add app_files3 var041
	set var042 var007 
	set var043 app_app
	strcat var043 app_prv
        
					;   on disk 2.
	if app_name2 = null goto start_install1
 	set move_x 0
	set tick1 app_files1
;A.05	sub 1 tick1 
	ticks tick1

					;   on disk 3.
	if app_name3 = null goto start_install1
;A.05	set tick2 tick1
;A.05	add app_files2 tick2
;A.05	ticks tick1, tick2

start_install1				;Copy the application's files
					;   from disk 1.
         				;	Verify correct volume mounted.
	set var050 app_name1
	set var051 app_label1
	onerror gosub floppy_out
	changedrive var003		;Set the floppy as default disk.
	cd \
;	fcount 0
	if var041 = 1 gosub copy_files	  ;If copy one file, do not display bar.
	if var041 != 1 gosub copyb_files  ;If copy more than one, display bar.
                                          ; for A.05 skip the next section
;        goto start_install2               ; A.05

; following section commented because ran out of script space - left in
; appsetup version of setutl.txt   A.05

					;   from disk 2.
	if app_name2 = null goto start_install2
	set var050 app_name2		;	Verify correct volume mounted.
	set var051 app_label2
	set var040 null			
	set var041 app_files2
	sub app_files1 move_x
	onerror gosub floppy_out
	changedrive var003		;	Set the floppy as default disk.
	cd \								      

	if var041 = 1 gosub copy_files	  ;If copy one file, do not display bar.
	if var041 != 1 gosub copyb_files  ;If copy more than one, display bar.

        goto start_install2               ; A.05
					;   from disk 3.
;	if app_name3 = null goto start_install2
;	set var050 app_name3		;	Verify correct volume mounted.
;	set var051 app_label3
;	set var040 null
;	set var041 app_files3
; 	sub app_files2 move_x
;	onerror gosub floppy_out      
;	changedrive var003		;	Set the floppy as default disk.
;	cd \								      

;	if var041 = 1 gosub copy_files	  ;If copy one file, do not display bar.
;	if var041 != 1 gosub copyb_files  ;If copy more than one, display bar.

start_install2
	ticks 0

return	       

copyb_files

;This procedure is the same as copy_files except the copy status box is drawn
;  on the screen indicating the amount of files copied in relation to 
;  the total amount expected to be copied. 
;
;Inputs:
;  var040 	The text of the message to be displayed during the copy.
;  var041	Number of files to be copied.		     
;  var042	Destination drive & directory on hard disk.
;  var043	Source directory on floppy disk.
		
					;Verify the correct volume
	gosub get_volume		       
      					;set source directory
	onerror goto copy_failed
	cd var043
					;Print copy message
	if var040 != null print cr cr cr var040 cr
					;Scroll if necessary
;	cursor old_x,old_y
;	gosub print_welcome1
;	pos old_x,old_y

	set status 1
			;Copy the files
	if var040 != null fcount 0			
	if var040 != null copyb *.* var042 status var041 
 	if var040 = null move move_x,0
	if var040 = null copyb *.* var042 status var041 noredraw
	if status != 1 goto copy_failed
return
			
install_help
		    
;This procedure copies application's help files into the HELP sub-directory 
;  of Openview even if the application is not installed under OpenView.
;  (Note: Help file must be in OpenView's HELP\ for HP openview windows
;         help system. For users of MS window 3.0 help system, the help
;         file should be in the same directory as the application or have
;         an optional path specified.)
;	       
;Inputs: 			
;  var003 - application source disk drive.
;  var006 - full qualified path where application help will be installed.
     					
	set var040 cp_arch2
	set var041 app_helps
	set var042 var006
	set var043 app_app
        strcat var043 app_hlp
					;Set the floppy as the default disk
	onerror gosub floppy_out
	changedrive var003
	cd \

;	fcount 0      
;A.05   ticks 1                           
;A.05	if var041 = 1 gosub copy_files	  ;If copy one file, do not display bar.
;A.05	if var041 != 1 gosub copyb_files  ;If copy more than one, display bar.
        gosub copy_files                  ; A.05 (only 2 files, no need for bar)
return
		
copy_files
		    
;This procedure will copy a group of files from the floppies to the hard disk.
;Inputs:
;  var040 	The text of the message to be displayed during the copy.
;  var041	Number of files to be copied.(? Doesn't appear to be used here.)
;  var042	Destination drive & directory on hard disk.
;  var043	Source directory on floppy disk.
     					
					;Verify the correct volume
	gosub get_volume		       
      					;set source directory
	onerror goto copy_failed
	cd var043
					;Print copy message
	if var040 != null print cr cr cr var040
					;Scroll if necessary
;	cursor old_x,old_y
;	gosub print_welcome1
;	pos old_x,old_y		
	set status 1
					;Copy the files
	echo off		
	copy *.* var042 status	     
	if status != 1 goto copy_failed
 
return

update_windows
	
;This procedure invokes an executable file to modify the file 
;  specified by win_ini (WIN.INI) with the contents in the holding file 
;  specified by app_sr (ADDWIN.INI).  It either replaces the whole or part 
;  of the given section or appends to the end of the file if the given
;  section does not exist. 
;	
;Inputs:
;  var003 - application source disk drive.
;  var072 - MW Windows win.ini drive.
;  var073 - MS Windows win.ini directory.
	     
	onerror gosub floppy_out
	changedrive var003
        cd app_inst

	set var008 win_name
        print cr cr cr up_arch1

	set update_file var072
	strcat update_file var073
	if var073 = "\" goto rot_win		;Skip if file is at root.
	strcat update_file bslash
rot_win
	strcat update_file win_ini	
	       
	set update_hdr app_hdr			;Set given section.
						    
 	set source_file var004
 	strcat source_file var005
	strcat source_file bslash
	strcat source_file app_sr
			      		    
	if var032 != null run mdini.exe "addinfo" source_file update_file update_hdr "map" "log"
	if var032 = null run mdini.exe "addinfo" source_file update_file update_hdr

; for expediency sake put the copy of the window group box here, after
; calling mdini to alter the progman.ini file. (note no need to check for
; var032 - it is set in setvar.txt to be upyes) also, copy the file before
; altering the .ini file
; section added - A.05
    
        set var043 "\grpbox"     ; source directory - \grpbox 
        set var076 ov_name       ; for msg - HP OPENVEIW WINDOWS
        strcat var076 " group box" ; for msg 
        set var042 var072        ; destination - windows drive
        strcat var042 var073     ; destination - windows directory
        set var040 cp_arch4      ; msg - copying file...
        gosub copy_files

; mdini ignores source_file, uses windows drive and directory and resets
; update_hdr to [Groups]
; section added - A.05

        cd app_inst             ; cd to \install 
        set var076 "PROGMAN.INI" ; for msg - file name
        set var074 var072        ; for msg - windows drive
        set var075 var073        ; for msg - windows directory
        print cr cr cr up_arch2  ; msg - updating .ini file...
;       run_error 0
        run mdini.exe "AddProg" source_file update_file update_hdr
;       onerror print cr "ARGHHHHH"
; end of A.05 changes
	     
	changedrive var004
	cd var005
	delete app_sr
	changedrive var003
        cd app_inst

return

update_addwin

;This procedure modifies ADDWIN.INI to
;reflect the user configuration.
;
;Inputs:
;  var003 - application source disk drive.
;  var080 - application keyword in ADDWIN.INI to be identified and modified
;  var081 - application destination path to be inserted
;  var082 - application section in ADDWIN.INI to be identified

	onerror gosub floppy_out
	changedrive var004
	cd var005

	exist app_sr status
	if status = 1 goto update_addwin_sub
	changedrive var003
	cd \
	cd app_inst
	set old_file var004
	strcat old_file var005
	echo off
	copy app_sr old_file status

update_addwin_sub
	changedrive var003
	cd \
	cd app_inst
	set update_file var004 
	strcat update_file var005
	strcat update_file bslash
	strcat update_file app_sr
	run mdini.exe "insertpath" var082 var080 var081 update_file

return
	
get_info      

;This procedure displays where an application should be installed
;and where the dependent system should be.  It displays edit line
;and sub-titles also.
;
;Inputs:		
;  var015 to var021 - titles and sub-titles to be displayed
;  var022 - edit control flag
;  var023 - edit line info

					;Print the title (instructions)
	gosub print_ins
	set skipline 0	     	
 	if var015 = null add 1 skipline
	if var016 = null add 1 skipline
	if var017 = null add 1 skipline
					;Print the edit line
	sub skipline box_editln
	pos box_left,box_editln
	print var023
					;Print the sub-title (instructions)
	if var022 = 2 goto get_info1
	pos box_left,box_stitle
	print var018 cr
	move box_left,0
	print var019 cr
	move box_left,0		    
	print var020 cr
	move box_left,0
	print var021 cr
get_info1
	gosub print_box

	add skipline box_editln

return
	
get_response

;This procedure gets dummy response.

	pos 42,22
	print screen_instruct
        echo off
	input 1 dummy
return
	
get_edit

;This procedure gets user input on edit line.
;
;Inputs:
;  var023 - default edit line info
;
;Outputs:
;  var023 - user edit line info

	set box_defx box_left
	set box_defy box_editln

	pos box_defx,box_defy		

	echo on
	input 64 var023 var023
	upshift var023

	mid cmd var023 2 1
	if cmd != colon bell
	if cmd != colon goto get_edit

return
	
print_ins

;This procedure displays titles only.
;
;Inputs:
;  var014 to var017 - titles to be displayed

	gosub stash_screen
	gosub print_welcome
					;Print the title (instructions)
	pos box_left,box_title
	print var014 cr
	move box_left,0
	print var015 cr
	move box_left,0		    
	print var016 cr
	move box_left,0
	print var017 cr	

return
	
print_box
		      
;This procedure displays user selections.
;Inputs:		
;  var022 - edit control flag
;               1 -> C, E, Q
;		2 -> C, Q
;		3 -> E, Q
;		4 -> Q
		      
	set var010 box_topress
	set var011 box_cont
	set var012 box_edit
	set var013 box_quit

	if var022 != 1 set var012 box_quit
	if var022 != 1 set var013 null
	if var022 = 3 set var011 box_edit
        if var022 = 4 set var011 box_quit 
        if var022 = 4 set var012 null
        if var022 = 4 set var013 null
					;Print the column labels
	pos box_text,box_head
	print var010
					;Print the box choices
	pos box_text,box_opt
	print var011 cr
	move box_text,0
	print var012 cr
	move box_text,0
	print var013 cr
					;Print the when ready message
	pos box_xinst,box_yinst
	print box_istruct			 
                                        ;Print the box with 1-3
                                        ;choices as dictated by var012/13
        if var012 != null add 1 box_end
	if var013 != null add 1 box_end
	box box_left box_top box_right box_end  bar
        if var012 != null sub 1 box_end
	if var013 != null sub 1 box_end

					;Position cursor for default response
	set box_defx box_cntx
	set box_defy box_cnty
	if var022 = 3 set box_defx box_quitx
	if var022 = 3 set box_defy box_quity
        if var022 = 4 set box_defx box_cntx
        if var022 = 4 set box_defy box_cnty

	pos box_defx,box_defy	
					;Read the user's response
	set box_return upcont
	if var022 != 1 set box_return upquit
tryagain                                ;A.05
        echo off
	input 1 box_return
	upshift box_return
					;If response is quit then quit now
	if box_return = upquit goto quit0
	if box_return = upedit gosub get_edit
        if box_return = upedit goto bailout        ;A.05
        if box_return != upcont goto tryagain      ;A.05
bailout
        return	  
	
print_menu
		      
;This procedure displays the menu to the user.
;
;Inputs:		
;  var022 - edit control flag

	set var010 menu_dirline
	set var011 menu_item1
	set var012 menu_item2
	set var013 menu_item3
	set var014 menu_item4
	set var015 box_quit

					;Print the column labels
	pos box_text,box_head
	print var010
					;Print the box choices
	pos box_text,box_opt
	print var011 cr
	move box_text,0
	print var012 cr
	move box_text,0
	print var013 cr
	if var013 != null add 1 box_end

	move box_text,0
	print var014 cr
	if var014 != null add 1 box_end

	move box_text,0
	print var015 cr
	if var015 != null add 1 box_end

					;Print the when ready message
	pos box_xinst,box_yinst
	print box_istruct			 
					;Print the box (either 2-5 choices
					; as dictated by var013-var015).
	box box_left box_top box_right box_end  bar
	if var013 != null sub 1 box_end
	if var014 != null sub 1 box_end
	if var015 != null sub 1 box_end

					;Position cursor for default response
	set box_defx box_item5x
	set box_defy box_item5y
;	if var022 = 3 set box_defx box_quitx
;	if var022 = 3 set box_defy box_quity

	pos box_defx,box_defy	
					;Read the user's response
;	set box_return upcont
	if var022 != 1 set box_return upquit

        echo off
	input 1 box_return
	upshift box_return
					;If response is quit then quit now
	if box_return = upquit goto quit_all

return
	
print_screen

;This procedure displays titles and user selections.
;
		   
	gosub print_ins			       
	gosub print_box	

return

print_welcome

;This procedure will clear the screen and print the title 
;  in the upper left corner.  An alternate entry point
;  (print_welcome1) will print the title without clearing 
;  the screen.
;
;Inputs:
;  var001 - application version.
;  var002 - application name.

	cls
print_welcome1
	pos 0,0
	set clear_ln "                                                            "
	print clear_ln
	print cr
	print clear_ln
	pos 0,0		 
	print welcome
	print cr
	print var001
return

stash_screen

;This procedure will save the screen &
;cursor position into memory.
;
;Outputs:
;  save_x - save the original cursor
;  save_y - save the original cursor

					;Save the cursor
	cursor save_x,save_y
					;Save the screen lines
	pos 0,0
	savline save_0
	pos 0,1
	savline save_1
	pos 0,2
	savline save_2
	pos 0,3
	savline save_3
	pos 0,4
	savline save_4
	pos 0,5
	savline save_5
	pos 0,6
	savline save_6
	pos 0,7
	savline save_7
	pos 0,8
	savline save_8
	pos 0,9
	savline save_9
	pos 0,10
	savline save_10
	pos 0,11
	savline save_11
	pos 0,12
	savline save_12
	pos 0,13
	savline save_13
	pos 0,14
	savline save_14
	pos 0,15
	savline save_15
	pos 0,16
	savline save_16
	pos 0,17
	savline save_17
	pos 0,18
	savline save_18
	pos 0,19
	savline save_19
	pos 0,20
	savline save_20
	pos 0,21
	savline save_21
	pos 0,22
	savline save_22
	pos 0,23
	savline save_23
return

rebuild_screen

;This procedure is the companion to stash_screen.  
;It will restore the screen & cursor.
;
;Inputs:
;  save_x - the original cursor
;  save_y - the original cursor
 
					;Restore the screen
	pos 0,0	    
	print save_0 
	print save_1 
	print save_2 
	print save_3 
	print save_4 
	print save_5 
	print save_6 
	print save_7 
	print save_8 
	print save_9 
	print save_10
	print save_11 
	print save_12 
	print save_13 
	print save_14 
	print save_15 
	print save_16 
	print save_17 
	print save_18 
	print save_19 
	print save_20 
	print save_21 
	print save_22 
	print save_23 
					;Restore the cursor position
	pos save_x,save_y

return	 
	
farewell

;This procedure will print the last instruction
;for user to start up the application after the
;installation.
;
;Inputs:
;  var002 - the application name
;  var003 - the application source drive (and a colon).

	cls
	set box_line 2
	pos 4,box_line
	print box_fare1
	
	if box_fare2 = null goto farewell3
	add 2 box_line
	pos 4,box_line
	print box_fare2
farewell3
	if box_fare3 = null goto farewell4
	add 1 box_line
	pos 4,box_line
	print box_fare3
farewell4
	if box_fare4 = null goto farewell5
	add 1 box_line
	pos 4,box_line
	print box_fare4
farewell5
	if box_fare5 = null goto farewell6
	add 1 box_line
	pos 4,box_line
	print box_fare5
farewell6
	if box_fare6 = null goto farewell7
	add 1 box_line
	pos 4,box_line
	print box_fare6
farewell7
	if box_fare7 = null goto farewell8
	add 1 box_line
	pos 4,box_line
	print box_fare7
farewell8
	if box_fare8 = null goto farewell9
	add 1 box_line
	pos 4,box_line
	print box_fare8			  
farewell9	
	if box_fare9 = null goto farewell0
	add 1 box_line
	pos 4,box_line
	print box_fare9
farewell0
	if box_fare0 = null goto farewell21
	add 1 box_line
	pos 4,box_line
	print box_fare0
farewell21
	if box_fare21 = null goto farewell22
	add 2 box_line
	pos 4, box_line
	print box_fare21
farewell22
	if box_fare22 = null goto farewells
	add 1 box_line
	pos 4, box_line
	print box_fare22
farewells
	add 1 box_line
	box 2,1,75,box_line bar
	add 2 box_line
	pos 4,box_line
return 
	
get_windows

; This procedure gets MS Windows.
;Inputs:
;  var070 - expected MS Windows disk drive
;  var071 - expected MS Windows directory
;  winfile1 - MS Windows file used to verify
;  winfile2 - MS Windows file used to verify
;  win_name - MS Windows name
;Outputs:
;  var070 - actual MS Windows disk drive
;  var071 - actual MS Windows directory

	set var022 1

	set var014 box_dep1
	set var015 box_dep2
	set var016 box_dep3
	set var017 box_dep4
				; Edit mode user instructions.		
 	set var018 box_stitle1
 	set var019 box_stitle2
 	set var020 box_stitle3
 	set var021 box_stitle4
			  	; Set specifics for Windows files.
	set needed_file win_file1
	set needed_file2 win_file2
	set var008 win_name	
	set var023 var070
	strcat var023 var071
	
	gosub get_info							  
				;Re-set incase altered in get_info.				
	mid var074 var023 1 2
	mid var075 var023 3 62		 

	set var070 var074
	set var071 var075

	gosub find_neededfile
				;Re-set incase altered in find_neededfile.
	set var070 var074
	set var071 var075	
return
			    
get_winini

;This procedure gets the WIN.INI file to update.
;Inputs:
;  var070 - expected MS Windows WIN.INI disk drive
;  var071 - expected MS Windows WIN.INI directory
;  win_ini - Win.ini name
;Outputs:
;  var072 - actual Win.ini disk drive
;  var073 - actual Win.ini directory

	set var022 1

	set var014 box_dep1
	set var015 box_dep2
	set var016 box_dep3
	set var017 box_dep4
				; Edit mode user instructions.
 	set var018 box_stitle1	
 	set var019 box_stitle2
 	set var020 box_stitle3
 	set var021 box_stitle4

	set var008 win_ini	; Set expectant WIN.INI specifics.
	set needed_file win_ini	  
	set needed_file2 null
	set var023 var070
	strcat var023 var071

	gosub get_info		; Modify path to user's input.

				;Re-set incase altered in get_info.
	mid var074 var023 1 2
	mid var075 var023 3 62		 

	set var072 var074
	set var073 var075

	gosub find_neededfile
				;Re-set incase altered in find_neededfile.
	set var072 var074
	set var073 var075	

return
	
get_file

; This procedure gets given file.
;Inputs:
;  var074 - expected disk drive
;  var075 - expected directory
;  needed_file - file to get
;Outputs:
;  var074 - actual disk drive
;  var075 - actual directory

	set var022 1

	set var014 box_dep1
	set var015 box_dep2
	set var016 box_dep3
	set var017 box_dep4
				; Edit mode user instructions.		
 	set var018 box_stitle1
 	set var019 box_stitle2
 	set var020 box_stitle3
 	set var021 box_stitle4
			  
	set var008 needed_file
	set var023 var074
	strcat var023 var075

	gosub get_info

	mid var074 var023 1 2
	mid var075 var023 3 62

	gosub find_neededfile
	
return
	
get_app
				  
;This procedure gets the OpenView paths from the Win.ini file 
;  (OV\, HELP\, SYMBOLS\, and BKGROUND\)  It also allows user
;  to alter all of theses paths if OV is being installed.
;Inputs:
;  var004 - application drive
;  var005 - application directory
;  app_hlp - Help directory
;  app_sym - Symbol directory
;  app_bkgr - Background directory	
					
				;Set full OV,Help or App path.
					; Set Help path to application path.
	set var006 var004
	strcat var006 var005
	strcat var006 app_hlp
	
   	if var032 = null gosub find_helpdir	;Get path from Win.ini

					; Extract path.
	strlen app_hlp len1
	strlen var006 len
	sub len1 len
	mid var023 var006 1 len					      
					;Display path.
	set var014 box_title1
	set var015 box_title2
	set var016 box_title3
	set var017 box_title4
					; Edit mode instructions.
 	set var018 box_dtitle1
 	set var019 box_stitle2
 	set var020 box_stitle3
 	set var021 box_stitle4
					; Get user input.
	gosub get_info
	mid var004 var023 1 2
	mid var005 var023 3 62
				; Re-set Help path to application path.
	if var032 = null goto get_app2	;If not OV, don't allow user to change.
	set var006 var004
	strcat var006 var005
	strcat var006 app_hlp	      				      

get_app2		;Set full Bkground path.
				; Set Bkground path to application path.
	set var093 var004	
	strcat var093 var005
	strcat var093 app_bkgr
	set var091 var004
	set var092 var005
	
	;When same SetUtl.txt is used in AddSetup this check must be changed.
 	if var032 = null gosub find_bkgrdir  ;If not OV, get path from Win.ini.
	if var032 = null goto get_app3	;If not OV, don't allow user to change.

					;Display path to user.		
	set var076 bkgr_files
	strcat var076 " files"	
	set var023 var093
	set var014 box_gtitle1
	set var015 box_title2
	set var016 box_title3
	set var017 box_title4
					; Edit mode instructions.
 	set var018 box_gstitle1
 	set var019 box_stitle2
 	set var020 box_stitle3
 	set var021 box_stitle4
					; Get user input.
	gosub get_info
	mid var091 var023 1 2
	mid var092 var023 3 62

	strlen var092 len		;Remove end "\" if there.
	mid temp var092 len 1
	if temp = "\" sub 1 len
	mid var092 var092 1 len
				; Set Bkground path to application path
	set var093 var091
	strcat var093 var092

get_app3			;Set full Symbols path.
				; Set Symbol to application path.
	set var095 var004
	strcat var095 var005
	strcat var095 app_sym
	set var077 var004
	set var078 var005

	;This check may need to change when AddSetup is the same again.
  	gosub find_symdir   		;Get path from Win.ini.
	goto get_app4			;Don't allow user to change.

					;Display Symbols path to user.		
	set var076 sym_files		
	strcat var076 " files"
	set var023 var095
	set var014 box_gtitle1
	set var015 box_title2
	set var016 box_title3
	set var017 box_title4
					; Edit mode instructions.
 	set var018 box_gstitle1
 	set var019 box_stitle2
 	set var020 box_stitle3
 	set var021 box_stitle4	
					; Get user input.
	gosub get_info
	mid var077 var023 1 2
	mid var078 var023 3 62

	strlen var078 len		;Remove end "\" if there.
	mid temp var078 len 1
	if temp = "\" sub 1 len
	mid var078 var078 1 len
					; Set Symbols path to application path
	set var095 var077
	strcat var095 var078

get_app4
	
return	      

update_givenfile

;Update given file. If file does not exist, then copy it from install disk.
;If file exists, then append disk file to file. (Future: will erase old
; entry & append new.)
;Inputs:
;  var074 - given file drive
;  var075 - given file directory 
;  var076 - given file name

	gosub print_welcome

	set status 0			;If drive exists, go to that drive.
	size var074 status
	if status = 0 goto need_file
	changedrive var074
	cd \
	exist var075 status		;If dir exists, go to that dir.
	if status != 2 goto need_file
	cd var075

	print cr cr cr up_arch2 	;Print 'Updating given file' message.
	pause 3

	exist var076 status		;Check for  given file.

	if status != 1 gosub copy_diskfile
	if status = 1 gosub append_diskfile
return

append_diskfile
	append ON
	gosub copy_diskfile
	append OFF	
return

copy_diskfile
;Since file does not exist in given path, copy from install disk.

	onerror gosub floppy_out	;Go to INSTALL\ on disk.
	changedrive var003
	cd \
        cd app_inst

	set file_path var074		;Set destination path.
	strcat file_path var075

	echo off
	copy var076 file_path status
	if status != 1 goto copy_failed
	set status 0
return

skip_setutl
