window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	' űԵ(Ʈ)'
		leftKanjiFont	$(kanjiFont)
		leftFont	$(kanaFont)
		switch $(COLOR)
			case MONO:
				bitmapPath	$(bitmaps)
				backgroundFile	GRAY3
				transparent	false
				break
		endswitch
	endres:
endtitle:
dialog: dialogs
	res:
		defaultDistance		#(fWidth)
		dialogType		modeless
	endres:
	ditem: name_label
		res:
			itemType	bitmap
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			label		'͸:'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
	endditem:
	ditem: name
		res:
			itemType	text
			fromHoriz	name_label
			vertDistance	#(fWidth)
			horizDistance	4
			width		#(fWidth)*20+4
			height		#(fHeight)
			length		20
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(line)
			put $(line)@0 $(TMP_PRINTER_NAME)
		endact:
	endditem:
	ditem: host_label
		res:
			itemType	bitmap
			fromVert	name_label
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			label		'ȣƮ'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
	endditem:
	ditem: host
		res:
			itemType	bitmap
			fromVert	host_label
			vertDistance	2
			horizDistance	#(fWidth)
			leftLabel	'                '
			leftKanjiFont	$(kanjiFont)
			leftFont	$(kanaFont)
			borderWidth	1
		endres:
	endditem:
	ditem: host_list
		res:
			itemType	scrtext
			fromVert	host
			vertDistance	4
			horizDistance	#(fWidth)
			width		#(fWidth)+1*20
			height		#(lHeight)*7+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		host_select1
			bind2		host_select2
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@0 $(TMP_PRINTER_HOST1)
		endact:
	endditem:
	ditem: host_select
		res:
			itemType	button
			fromVert	host_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			label		'   '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			put $(TMP_PRINTER_HOST1) $(TMP_PRINTER_HOST)
			job host_select
		endact:
	endditem:
	ditem: printer_label
		res:
			itemType	bitmap
			fromVert	name_label
			fromHoriz	host_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
			label		''
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
	endditem:
	ditem: printer
		res:
			itemType	text
			fromHoriz	host_list
			fromVert	printer_label
			vertDistance	2
			horizDistance	#(fWidth)*2
			length		20
			width		#(fWidth)*20+4
			height		#(fHeight)
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(line)
			put $(line)@0 $(TMP_REMOTE_PRINTER)
		endact:
	endditem:
	ditem: printer_list
		res:
			itemType	scrtext
			fromVert	printer
			fromHoriz	host_list
			vertDistance	4
			horizDistance	#(fWidth)*2
			width		#(fWidth)+1*24
			height		#(lHeight)*7+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		printer_select1
			bind2		printer_select2
			textOptions	1
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@0 $(TMP_REMOTE_PRINTER1)
		endact:
	endditem:
	ditem: printer_select
		res:
			itemType	button
			fromVert	printer_list
			fromHoriz	host_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
			label		'   '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			job printer_select
		endact:
	endditem:
	ditem: type_label
		res:
			itemType	bitmap
			fromVert	name_label
			fromHoriz	printer_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
			label		'Ÿ'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
	endditem:
	ditem: type
		res:
			itemType	bitmap
			fromVert	type_label
			fromHoriz	printer_list
			vertDistance	2
			horizDistance	#(fWidth)*2
			leftLabel	'                '
			leftKanjiFont	$(kanjiFont)
			leftFont	$(kanaFont)
			borderWidth	1
		endres:
	endditem:
	ditem: type_list
		res:
			itemType	scrtext
			fromVert	type
			fromHoriz	printer_list
			vertDistance	4
			horizDistance	#(fWidth)*2
			width		#(fWidth)+1*20
			height		#(lHeight)*7+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		type_select1
			bind2		type_select2
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@0 $(TMP_REMOTE_TYPE1)
		endact:
	endditem:
	ditem: type_select
		res:
			itemType	button
			fromVert	type_list
			fromHoriz	printer_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
			label		'   '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			put $(TMP_REMOTE_TYPE1) $(TMP_REMOTE_TYPE)
			job type_select
		endact:
	endditem:
	ditem: set
		res:
			itemType	button
			fromHoriz	printer_list
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*10
			label		'   '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			switch $(TMP_PRINTER_NAME)
				case '':
					put 1 $(err_no)
					job err
					quit
				case at:
				case locks:
				case lpd:
				case lpd.lock:
				case mail:
				case mqueue:
				case news:
				case rwho:
				case uucp:
				case uucppublic:
					put 11 $(err_no)
					job err
					quit
			endswitch
			switch $(TMP_PRINTER_HOST)
				case '':
					put 2 $(err_no)
					job err
					quit
			endswitch
			switch $(TMP_REMOTE_PRINTER)
				case '':
					put 3 $(err_no)
					job err
					quit
			endswitch
			put 2 $(cmd)
			put on $(ONRUN)
			put 101 $(menu_no)
			$(onrun) = sub $(commonPath)/onrun ++48++48
			switch $(PRINTER_NEW)
				case on:
					$(pid) = bg $(etc)/Printer/Sprintcap.sh add remote $(TMP_PRINTER_NAME) $(TMP_PRINTER_HOST) $(TMP_REMOTE_PRINTER) $(TMP_REMOTE_TYPE)
					break
				case off:
					$(pid) = bg $(etc)/Printer/Sprintcap.sh chg $(PRINTER_NAME) $(TMP_PRINTER_NAME) remote $(TMP_PRINTER_HOST) $(TMP_REMOTE_PRINTER) $(TMP_REMOTE_TYPE)
					break
			endswitch
			$(bgstat) = trap $(pid) cmd_end
		endact:
	endditem:
enddialog:
proc: pre
	$(TMP) = mktemp
	put /tmp/$(TMP) $(STATION_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(REMOTE_PRINTER_LIST)
	echo -n > $(REMOTE_PRINTER_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(SORT_LIST)
	$(bin)/Snet_check -lh > $(SORT_LIST)
	sort -u $(SORT_LIST) > $(STATION_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(TYPE_LIST)
	sh -c 'ls $(PRINTER_DB)/Remote|sed "s/^/  /"' > $(TYPE_LIST)
	switch $(PRINTER_NEW)
		case on:
			put Standard $(REMOTE_TYPE)
			break
		case off:
			switch #(PRINTER_CONNECT)
				case 4:
					sh -c 'eval `$(bin)/Sprintcap -g $(PRINTER_NAME) -i /etc/printcap -rm`; echo $rm'
					put $(stdout)@0 $(PRINTER_HOST)
					sh -c 'eval `$(bin)/Sprintcap -g $(PRINTER_NAME) -i /etc/printcap -rp`; echo $rp'
					put $(stdout)@0 $(REMOTE_PRINTER)
					$(bin)/Sprintcap -e $(PRINTER_NAME) -name NWP-549 -i /etc/printcap
					switch #(status)
						case 0:
							put NWP-549 $(REMOTE_TYPE)
							break
						default:
							$(bin)/Sprintcap -g $(PRINTER_NAME) -i /etc/printcap -nc
							switch $(stdout)
								case nc:
									put nc $(REMOTE_TYPE)
									break
								default:
									put Standard $(REMOTE_TYPE)
									break
							endswitch
							break
					endswitch
			endswitch
			break
	endswitch
	put 0 $(menu_no)
	put on $(mapped)
	put off $(opened)
	put off $(CHANGE_PRINTER)
endproc:
proc: close
	switch $(ONRUN)
		case on:
			quit
	endswitch
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
			close $(err)
	endswitch
	rm -f $(STATION_LIST) $(REMOTE_PRINTER_LIST) $(SORT_LIST) $(TYPE_LIST)
endproc:
proc: open
	setval host_list file $(STATION_LIST)
	setval host_select sensitive false
	setval type_list file $(TYPE_LIST)
	setval type_select sensitive false
	job printer_init
	switch $(PRINTER_NEW)
		case on:
			setval title leftLabel  ' űԵ(Ʈ)'
			setval set label '   '
			setval name string ''
			setval host leftLabel ''
			setval printer string ''
			put '' $(TMP_PRINTER_HOST)
			break
		case off:
			setval title leftLabel  ' (Ʈ)'
			setval set label '   '
			put $(PRINTER_NAME) $(TMP_PRINTER_NAME)
			setval name string $(TMP_PRINTER_NAME)
			switch #(PRINTER_CONNECT)
				case 4:
					break
				default:
					setval host leftLabel ''
					setval printer string ''
					quit
			endswitch
			put $(PRINTER_HOST) $(TMP_PRINTER_HOST)
			put $(REMOTE_PRINTER) $(TMP_REMOTE_PRINTER)
			setval printer string $(TMP_REMOTE_PRINTER)
			job host_select
			break
	endswitch
	put $(REMOTE_TYPE) $(TMP_REMOTE_TYPE)
	setval type leftLabel $(TMP_REMOTE_TYPE)
endproc:
proc: host_select1
	switch $(TMP_PRINTER_HOST1)
		case '':
			quit
	endswitch
	setval host_select sensitive true
endproc:
proc: host_select2
	switch $(TMP_PRINTER_HOST1)
		case '':
			quit
	endswitch
	setval host_select selected true
	put $(TMP_PRINTER_HOST1) $(TMP_PRINTER_HOST)
	job host_select
	setval host_select selected false
endproc:
proc: host_select
	setval host leftLabel $(TMP_PRINTER_HOST)
	put 1 $(cmd)
	put on $(ONRUN)
	put 101 $(menu_no)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	$(pid) = bg $(etc)/Printer/Sget_remote.sh $(TMP_PRINTER_HOST) $(REMOTE_PRINTER_LIST)
	$(bgstat) = trap $(pid) cmd_end
endproc:
proc: printer_select1
	switch $(TMP_REMOTE_PRINTER1)
		case '':
			quit
	endswitch
	setval printer_select sensitive true
endproc:
proc: printer_select2
	switch $(TMP_REMOTE_PRINTER1)
		case '':
			quit
	endswitch
	setval printer_select selected true
	job printer_select
	setval printer_select selected false
endproc:
proc: printer_select
	setval printer string $(TMP_REMOTE_PRINTER1)
endproc:
proc: type_select1
	switch $(TMP_REMOTE_TYPE1)
		case '':
			quit
	endswitch
	setval type_select sensitive true
endproc:
proc: type_select2
	switch $(TMP_REMOTE_TYPE1)
		case '':
			quit
	endswitch
	put $(TMP_REMOTE_TYPE1) $(TMP_REMOTE_TYPE)
	setval type_select selected true
	job type_select
	setval type_select selected false
endproc:
proc: type_select
	setval type leftLabel $(TMP_REMOTE_TYPE)
endproc:
proc: printer_init
	setval printer_list file $(REMOTE_PRINTER_LIST)
	setval printer_select sensitive false
endproc:
proc: cmd_end
	close $(onrun)
	buzzer $(main)
	switch #(cmd)
		case 1:
			switch #(bgstat)
				case 0:
					put 0 $(menu_no)
					put off $(ONRUN)
					job printer_init
					quit
			endswitch
	endswitch
	switch $(mapped)
		case on:
			switch #(cmd)
				case 1:
					job getprinter
					break
				case 2:
					job bgdone
					break
			endswitch
			break
		case off:
			put on $(opened)
			break
	endswitch
	put 102 $(menu_no)
endproc:
proc: unmap
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
			unmap $(err)
			break
		case 101:
			unmap $(onrun)
			break
		case 102:
			unmap $(n_end)
			break
	endswitch
	put off $(mapped)
endproc:
proc: map
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
			move $(err)
			raise $(err)
			map $(err)
			break
		case 101:
			move $(onrun)
			raise $(onrun)
			map $(onrun)
			break
		case 102:
			switch $(opened)
				case on:
					switch #(cmd)
						case 1:
							job getprinter
							break
						case 2:
							job bgdone
							break
					endswitch
					break
				case off:
					move $(n_end)
					raise $(n_end)
					map $(n_end)
					break
			endswitch
	endswitch
	put on $(mapped)
	put off $(opened)
endproc:
proc: title
	job move
	job up
endproc:
proc: raise
	job up
endproc:
proc: move
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
			move $(err)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
			raise $(err)
			break
		case 101:
			raise $(onrun)
			break
		case 102:
			raise $(n_end)
			break
	endswitch
endproc:
proc: bgdone
	switch #(bgstat)
		case 0:
			$(n_end) = sub $(commonPath)/normalEnd ++48++48
			trap $(n_end) n_end
			break
		case 0x100:
			put '͡$(TMP_PRINTER_NAME)() ̹ ϵǾ ֽϴ.' $(confirm_msg1)
			$(n_end) = sub $(commonPath)/error1 ++48++48
			trap $(n_end) n_err
			break
		case 0x200:
			put '͡$(PRINTER_NAME)()  Դϴ.' $(confirm_msg1)
			put 'μⰡ   Ͽ ֽʽÿ.' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
		case 0x400:
			put 'ȣƮ$(TMP_PRINTER_HOST) Ʈ͡$(TMP_REMOTE_PRINTER) ' $(confirm_msg1)
			put '̹ ϵǾ ֽϴ.' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
	endswitch
endproc:
proc: getprinter
	switch #(bgstat)
		case 0x100:
			put 'ȣƮ$(TMP_PRINTER_HOST) ' $(confirm_msg1)
			put 'Ͱ ϵǾ  ʽϴ.' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
		case 0x200:
			put 'ȣƮ$(TMP_PRINTER_HOST) ϵǾ ִ ' $(confirm_msg1)
			put '͸  ϴ.' $(confirm_msg2)
			put 'Ȯ , Ű忡 ԷϿ ֽʽÿ.' $(confirm_msg3)
			$(n_end) = sub $(commonPath)/error3 ++48++48
			trap $(n_end) n_err
			break
	endswitch
	job printer_init
endproc:
proc: n_end
	put off $(ONRUN)
	put on $(CHANGE_PRINTER)
	put 0 $(menu_no)
	job close
endproc:
proc: n_err
	put off $(ONRUN)
	put 0 $(menu_no)
endproc:
proc: err
	put $(err_no) $(menu_no)
	switch #(err_no)
		case 1:
			put '͸ Ͽ ֽʽÿ.' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 2:
			put 'ȣƮ Ͽ ֽʽÿ.' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 3:
			put 'Ʈ͸ Ͽ ֽʽÿ.' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 11:
			put 1 $(menu_no)
			put '$(TMP_PRINTER_NAME) ͸ Ҽϴ.' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
	endswitch
	buzzer
	trap $(err) err_end
endproc:
proc: err_end
	put 0 $(menu_no)
endproc:
