window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	|U|VKo^
		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
		defaultButton		next
	endres:
	ditem: list_label
		res:
			itemType	bitmap
			label		'|U|@ hc'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
	endditem:
	ditem: newname
		res:
			itemType	text
			fromVert	list_label
			vertDistance	2
			horizDistance	#(fWidth)*3
			length		8
			height		#(fHeight)
			width		#(fWidth)*8+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(NEW_NAME)
			put $(NEW_NAME)@1 $(NEW_NAME1)
			put $(NEW_NAME)@0 $(NEW_NAME)
		endact:
	endditem:
	ditem: newid
		res:
			itemType	numtext
			fromVert	list_label
			fromHoriz	newname
			vertDistance	2
			horizDistance	#(fWidth)*2
			length		5
			height		#(fHeight)
			width		#(fWidth)*5+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(NEW_ID)
		endact:
	endditem:
	ditem: list
		res:
			itemType	scrtext
			fromVert	newname
			vertDistance	4
			horizDistance	#(fWidth)
			width		#(fWidth)+1*22
			height		#(lHeight)*7+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		select
			file		/dev/null
		endres:
		act:
			put $(line)
			switch $(line)@0
				case *:
					put on $(BUF_ENV)
					put $(line)@1 $(BUF_NAME)
					put $(line)@2 $(BUF_ID)
					break
				default:
					put off $(BUF_ENV)
					put $(line)@0 $(BUF_NAME)
					put $(line)@1 $(BUF_ID)
					break
			endswitch
		endact:
	endditem:
	ditem: env
		res:
			itemType	check
			fromHoriz	list
			label		Ɗ쐬
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
			shadowWidth	0
			switch $(COLOR)
				case MONO:
					background	white
					foreground	black
					highlightBack	white
					highlightFore	black
					selectedBack	white
					selectedFore	black
					break
				default:
					background	#c5c5c5
					highlightBack	#c5c5c5
					selectedBack	#c5c5c5
					break
			endswitch
		endres:
		act:
			put $(NEW_ENV)
		endact:
	endditem:
	ditem: non-standard
		res:
			itemType	button
			fromVert	env
			fromHoriz	list
			label		|U|
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(NEW_NAME)
				case '':
					buzzer
					quit
			endswitch
			switch #(NEW_ENV)
				case 0:
					put off $(USER_ENV)
					put off $(NONS_POPDESK)
					break
				case 1:
					put on $(USER_ENV)
					put on $(NONS_POPDESK)
					break
			endswitch
			put 1 $(menu_no)
			switch $(get_defnons)
				case off:
					put on $(get_defnons)
					job defnons
					break
				case on:
					switch $(NEW_NAME)
						case $(NONS_NAME):
							break
						default:
							job defnons
							break
					endswitch
			endswitch
			$(nonstand) = sub $(menu)/nonstand ++48++48
			trap $(nonstand) nonstand_end
		endact:
	endditem:
	ditem: next
		res:
			itemType	button
			fromVert	non-standard
			fromHoriz	list
			label		mdws
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)*2
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(NEW_NAME)
				case '':
					put 1 $(err_no)
					job err
					quit
			endswitch
			switch $(NEW_NAME1)
				case '':
					break
				default:
					put 2 $(err_no)
					job err
					quit
			endswitch
			$(bin)/Sname_check user $(NEW_NAME)
			switch #(status)
				case 0x100:
					put 2 $(err_no)
					job err
					quit
			endswitch
			$(bin)/Spw_check -u $(NEW_NAME)
			switch #(status)
				case 0:
					put 4 $(err_no)
					job err
					quit
			endswitch
			put '$(NEW_NAME) $(NEW_ID)' > $(TMP_LIST)
			$(bin)/Sfile_op -e -f 0 -i $(TMP_LIST) -o $(OP_LIST)
			switch #(status)
				case 0:
					put 6 $(err_no)
					job err
					quit
			endswitch
			test $(NEW_ID) -gt 32767
			switch #(status)
				case 0:
					put 3 $(err_no)
					job err
					quit
			endswitch
			$(bin)/Spw_check -i $(NEW_ID)
			switch #(status)
				case 0:
					put 5 $(err_no)
					job err
					quit
			endswitch
			$(bin)/Sfile_op -e -f 1 -i $(TMP_LIST) -o $(OP_LIST)
			switch #(status)
				case 0:
					put 7 $(err_no)
					job err
					quit
			endswitch
			switch $(CHANGE_NONS)
				case off:
					job defnons
					break
				case on:
					switch $(NEW_NAME)
						case $(NONS_NAME):
							break
						default:
							put 2 $(menu_no)
							put |U|̕ύXA|U|ύX܂B $(confirm_msg1)
							put |U|̕ύX𖳌ɂ܂B $(confirm_msg2)
							$(confirm) = sub $(commonPath)/confirm3 ++48++48
							trap $(confirm) confirm
							buzzer
							quit
					endswitch
			endswitch
			job addlist
		endact:
	endditem:
	ditem: exec
		res:
			itemType	button
			fromVert	next
			fromHoriz	list
			label		' o@^ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			put on $(ONRUN)
			put 101 $(menu_no)
			$(onrun) = sub $(commonPath)/onrun ++48++48
			$(pid) = bg $(etc)/User/Spasswd.sh add $(OP_LIST) $(MAIL_MODE) > $(ERR_LIST)
			$(bgstat) = trap $(pid) exec_end
		endact:
	endditem:
	ditem: del
		res:
			itemType	button
			fromVert	exec
			fromHoriz	list
			label		' @ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(BUF_ENV)
				case on:
					echo '* $(BUF_NAME)' > $(TMP_LIST)
					$(bin)/Sfile_op -d -f 1 -i $(TMP_LIST) -o $(LIST)
					break
				case off:
					echo '$(BUF_NAME)' > $(TMP_LIST)
					$(bin)/Sfile_op -d -f 0 -i $(TMP_LIST) -o $(LIST)
					break
			endswitch
			echo $(BUF_NAME) > $(TMP_LIST)
			$(bin)/Sfile_op -d -f 0 -i $(TMP_LIST) -o $(OP_LIST)
			setval list file $(LIST)
			setval del sensitive false
			job chklist
		endact:
	endditem:
enddialog:
proc: pre
	global $(NONS_GID)
	global $(NONS_HOME)
	global $(NONS_SHELL)
	global $(NONS_POPDESK)
	global $(CHANGE_NONS)
	global $(NEW_NAME)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(TMP_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(OP_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(ERR_LIST)
	echo -n > $(LIST)
	echo -n > $(OP_LIST)
	put 0 $(menu_no)
	put on $(mapped)
	put off $(opened)
	$(bin)/Spw_check -M
	put #(stdout)+1 $(maxuid)
	test $(maxuid) -gt 32767
	switch #(status)
		case 0:
			put 32767 $(maxuid)
			break
	endswitch
endproc:
proc: close
	switch $(ONRUN)
		case on:
			quit
	endswitch
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 1:
			close $(nonstand)
			break
		case 2:
			close $(confirm)
			break
		case 10:
			close $(err)
			break
	endswitch
	local $(NONS_GID)
	local $(NONS_HOME)
	local $(NONS_SHELL)
	local $(NONS_POPDESK)
	local $(CHANGE_NONS)
	local $(NEW_NAME)
	rm -f $(LIST) $(TMP_LIST) $(OP_LIST) $(ERR_LIST)
endproc:
proc: open
	setval env selected on
	setval newid string $(maxuid)
	job init
endproc:
proc: init
	setval newname string ''
	setval list file $(LIST)
	setval del sensitive false
	job chklist
	put off $(CHANGE_NONS)
	put off $(get_defnons)
endproc:
proc: chklist
	test -s $(LIST)
	switch #(status)
		case 0:
			setval exec sensitive true
			break
		default:
			setval exec sensitive false
	endswitch
endproc:
proc: select
	switch $(line)
		case '':
			quit
	endswitch
	setval del sensitive true
endproc:
proc: defnons
	put $(NEW_NAME) $(NONS_NAME)
	test -s $(USER_SKEL)
	switch #(status)
		case 0:
			put $(line) < $(USER_SKEL)
			put $(line)@0 $(NONS_GID)
			put $(line)@1/$(NEW_NAME) $(NONS_HOME)
			put $(line)@2 $(NONS_SHELL)
			switch $(NONS_SHELL)
				case no_shell:
					put '' $(NONS_SHELL)
			endswitch
			put $(line)@3 $(NONS_POPDESK)
			break
		default:
			put 31 $(NONS_GID)
			put /home/$(NEW_NAME) $(NONS_HOME)
			put /bin/csh $(NONS_SHELL)
			put on $(NONS_POPDESK)
			break
	endswitch
endproc:
proc: confirm
	put 0 $(menu_no)
	switch $(answer)
		case cancel:
			quit
	endswitch
	job defnons
	job addlist
endproc:
proc: addlist
	switch #(NEW_ENV)
		case 0:
			put '   $(NEW_NAME)\L11$(NEW_ID)\R5' $(newline)
			break
		case 1:
			put ' * $(NEW_NAME)\L11$(NEW_ID)\R5' $(newline)
			break
	endswitch
	put $(newline) >> $(LIST)
	switch #(NEW_ENV)
		case 0:
			put off $(OP_ENV)
			break
		case 1:
			put on $(OP_ENV)
			break
	endswitch
	switch $(NONS_HOME)
		case '':
			put no_home $(NONS_HOME)
	endswitch
	switch $(NONS_SHELL)
		case '':
			put no_shell $(NONS_SHELL)
	endswitch
	put '$(NEW_NAME) $(NEW_ID) $(OP_ENV) $(NONS_GID) $(NONS_HOME) $(NONS_SHELL) $(NONS_POPDESK)' >> $(OP_LIST)
	job init
	put #(NEW_ID)+1 $(NEW_ID)
	test $(NEW_ID) -gt 32767
	switch #(status)
		case 0:
			put 32767 $(NEW_ID)
			break
	endswitch
	setval newid string $(NEW_ID)
	job chklist
endproc:
proc: exec_end
	buzzer $(main)
	close $(onrun)
	switch $(mapped)
		case on:
			job bgdone
			break
		case off:
			put on $(opened)
			break
	endswitch
	put 102 $(menu_no)
endproc:
proc: unmap
	switch #(menu_no)
		case 1:
			unmap $(nonstand)
			break
		case 2:
			unmap $(confirm)
			break
		case 10:
			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:
			raise $(nonstand)
			map $(nonstand)
			break
		case 2:
			raise $(confirm)
			map $(confirm)
			break
		case 10:
			move $(err)
			raise $(err)
			map $(err)
			break
		case 101:
			move $(onrun)
			raise $(onrun)
			map $(onrun)
			break
		case 102:
			switch $(opened)
				case on:
					job bgdone
					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 2:
			move $(confirm)
			break
		case 10:
			move $(err)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 2:
			raise $(confirm)
			break
		case 10:
			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
			break
		case 0x100:
			put $(error_user) < $(ERR_LIST)
			put '|U|u$(error_user)ṽz|fBNgA' $(confirm_msg1)
			put '쐬ł܂łB' $(confirm_msg2)
			put '|U|̓o^͊Ă܂B' $(confirm_msg3)
			$(n_end) = sub $(commonPath)/error3 ++48++48
			break
		case 0x200:
			put $(error_user) < $(ERR_LIST)
			put '|U|u$(error_user)v̍Ɗ쐬A' $(confirm_msg1)
			put 'G|܂B' $(confirm_msg2)
			put '|U|̓o^͊Ă܂B' $(confirm_msg3)
			$(n_end) = sub $(commonPath)/error3 ++48++48
			break
		case 0x300:
			put $(error_user) < $(ERR_LIST)
			put '|U|u$(error_user)v NEWS Desk 쐬A' $(confirm_msg1)
			put 'G|܂B' $(confirm_msg2)
			put '|U|̓o^͊Ă܂B' $(confirm_msg3)
			$(n_end) = sub $(commonPath)/error3 ++48++48
			break
	endswitch
	trap $(n_end) n_end
endproc:
proc: n_end
	put off $(ONRUN)
	put on $(CHANGE_USER)
	put 0 $(menu_no)
	job close
endproc:
proc: nonstand_end
	put 0 $(menu_no)
endproc:
proc: err
	put 10 $(menu_no)
	switch #(err_no)
		case 1:
			put '|U|w肵ĉB' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 2:
			put '|U|ɂ͏̉pi-_. ܂ށjA' $(confirm_msg1)
			put 'ѐŎw肵ĉB' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 3:
			put '|U|hcɂ 0-32767 ̒lw肵ĉB' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 4:
			put '|U|u$(NEW_NAME)v͊ɎgpĂ܂B' $(confirm_msg1)
			put 'ʂ̃|U|w肵ĂB' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 5:
			put '|U|hcu$(NEW_ID)v͊ɎgpĂ܂B' $(confirm_msg1)
			put 'ʂ̃|U|hcw肵ĉB' $(confirm_msg2)
			
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 6:
			put '|U|u$(NEW_NAME)v͊ɗ\񂳂Ă܂B' $(confirm_msg1)
			put 'ʂ̃|U|w肵ĂB' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 7:
			put '|U|hcu$(NEW_ID)v͊ɗ\񂳂Ă܂B' $(confirm_msg1)
			put 'ʂ̃|U|hcw肵ĉB' $(confirm_msg2)
			
			$(err) = sub $(commonPath)/error2 ++48++48
	endswitch
	buzzer
	trap $(err) err_end
endproc:
proc: err_end
	put 0 $(menu_no)
endproc:
