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
		defaultButton		set
	endres:
	ditem: name_label
		res:
			itemType	bitmap
			label		'ݥ̾'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: name
		res:
			itemType	text
			fromHoriz	name_label
			vertDistance	#(fWidth)
			horizDistance	4
			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: id_label
		res:
			itemType	bitmap
			fromVert	name_label
			label		'ɣġ'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: id
		res:
			itemType	numtext
			fromVert	name_label
			fromHoriz	id_label
			vertDistance	#(fWidth)
			horizDistance	4
			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: exec
		res:
			itemType	button
			fromHoriz	name
			label		' ѡ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(NEW_NAME1)
				case '':
					break
				default:
					put 2 $(err_no)
					job err
					quit
			endswitch
			switch $(USER_NAME)
				case $(NEW_NAME):
					break
				default:
					switch $(NEW_NAME)
						case '':
							put 1 $(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
					break
			endswitch
			switch #(USER_ID)
				case #(NEW_ID):
					break
				default:
					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
					break
			endswitch
			switch $(CHANGE_NONS)
				case off:
					job curnons
					break
				case on:
					switch $(NEW_NAME)
						case $(NONS_NAME):
							break
						default:
							put 2 $(menu_no)
							put ݥݾѹ塢ݥ̾ѹޤ $(confirm_msg1)
							put ݥݾѹ̵ˤޤޤ $(confirm_msg2)
							$(confirm) = sub $(commonPath)/confirm3 ++48++48
							trap $(confirm) confirm
							buzzer
							quit
					endswitch
			endswitch
			job chgproc1
		endact:
	endditem:
	ditem: reset
		res:
			itemType	button
			fromVert	exec
			fromHoriz	name
			label		'  '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(get_curnons)
				case on:
					job curnons
			endswitch
			job reset
		endact:
	endditem:
	ditem: nons
		res:
			itemType	button
			fromVert	reset
			fromHoriz	name
			label		ݥݾѹ
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			put 1 $(menu_no)
			switch $(get_curnons)
				case off:
					put on $(get_curnons)
					job curnons
					break
				case on:
					switch $(NEW_NAME)
						case $(NONS_NAME):
							break
						default:
							job curnons
							break
					endswitch
			endswitch
			$(nonstand) = sub $(menu)/nonstand ++48++48
			trap $(nonstand) nonstand_end
		endact:
	endditem:
enddialog:
proc: pre
	global $(NONS_GID)
	global $(NONS_HOME)
	global $(NONS_SHELL)
	global $(NONS_POPDESK)
	global $(CHANGE_NONS)
	global $(NEW_NAME)
	global $(NEW_HOMEDIR)
	put on $(mapped)
	put off $(opened)
	put off $(get_curnons)
	put off $(CHANGE_NONS)
	put 0 $(NEW_HOMEDIR)
	put 0 $(menu_no)
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 $(home)
			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)
endproc:
proc: open
	job reset
endproc:
proc: reset
	put $(USER_NAME) $(NEW_NAME)
	put $(USER_ID) $(NEW_ID)
	setval name string $(NEW_NAME)
	setval id string $(NEW_ID)
endproc:
proc: curnons
	put $(NEW_NAME) $(NONS_NAME)
	$(bin)/Spw_check -ugds $(USER_NAME)
	put $(stdout)@0 $(NONS_GID)
	put $(stdout)@1 $(NONS_HOME)
	put $(stdout)@2 $(NONS_SHELL)
	$(bin)/Sbasename $(NONS_HOME)
	switch $(stdout)
		case $(USER_NAME):
			$(bin)/Sprename $(NONS_HOME)
			put $(stdout)/$(NONS_NAME) $(NONS_HOME)
			break
	endswitch
	put $(NONS_HOME) $(DEF_HOME)
	$(etc)/User/Spopenv.sh check $(USER_NAME)
	switch #(status)
		case 0:
			put on $(NONS_POPDESK)
			break
		default:
			put off $(NONS_POPDESK)
			break
	endswitch
endproc:
proc: chgproc1
	switch $(USER_ENV)
		case off:
			job chgproc2
			quit
	endswitch
	switch $(NONS_HOME)
		case $(DEF_HOME):
			break
		default:
			$(etc)/Common/Smkdir.sh -e / $(NONS_HOME)
			switch #(status)
				case 0:
					put 2 $(menu_no)
					$(home) = sub $(menu)/home_exist ++48++48
					trap $(home) home_end
					quit
			endswitch
			break
	endswitch
	job chgproc2
endproc:
proc: chgproc2
	put on $(ONRUN)
	put 101 $(menu_no)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	$(pid) = bg $(etc)/User/Spasswd.sh chg $(USER_NAME) $(NEW_NAME) $(NEW_ID) $(USER_ENV) $(NONS_GID) $(NONS_HOME) $(NONS_SHELL) $(NONS_POPDESK) $(NEW_HOMEDIR) $(MAIL_MODE)
	$(bgstat) = trap $(pid) exec_end
endproc:
proc: confirm
	put 0 $(menu_no)
	switch $(answer)
		case cancel:
			quit
	endswitch
	job curnons
	job chgproc1
endproc:
proc: home_end
	put 0 $(menu_no)
	switch #(NEW_HOMEDIR)
		case 0:
			quit
	endswitch
	job chgproc2
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 $(home)
			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 $(home)
			map $(home)
			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 10:
			move $(err)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		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
			put on $(CHANGE_USER)
			break
		case 0x100:
			put 'ۡݥǥ쥯ȥ꤬ǤޤǤ' $(confirm_msg1)
			put 'ݥݤѹϤޤǤ' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			break
		case 0x200:
			put 'ۡݥǥ쥯ȥΥԡ桢ݤȯޤ' $(confirm_msg1)
			put 'ݥݤѹϤޤǤ' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			break
	endswitch
	trap $(n_end) n_end
endproc:
proc: n_end
	put off $(ONRUN)
	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 'ݥ̾ꤷƲ' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 2:
			put 'ݥ̾ˤϾʸαѻ-_. ޤˡ' $(confirm_msg1)
			put 'ӿǻꤷƲ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 3:
			put 'ݥݣɣĤˤ 0-32767 ͤꤷƲ' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 4:
			put 'ݥ̾$(NEW_NAME)פϴ˻ѤƤޤ' $(confirm_msg1)
			put '̤Υݥ̾ꤷƤ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 5:
			put 'ݥݣɣġ$(NEW_ID)פϴ˻ѤƤޤ' $(confirm_msg1)
			put '̤ΥݥݣɣĤꤷƲ' $(confirm_msg2)
			
			$(err) = sub $(commonPath)/error2 ++48++48
			break
	endswitch
	buzzer
	trap $(err) err_end
endproc:
proc: err_end
	put 0 $(menu_no)
endproc:
