๋ค์๊ณผ ๊ฐ์ ์ค์ ๋ฃ์ผ๋ฉด :
set LANG zh_CN.UTF-8
.config / fish / config.fish๋ก
๋ช
๋ น์ด ์๋ชป๋๋ฉด ์ด๋ค ๋ฌธ์๋ ์ญ์ ํ ์ ์์ต๋๋ค.
์๋ฅผ ๋ค๋ฉด :
๋ช
๋ น 'cat'์ 'e'๋ฅผ ์ญ์ ํ๊ณ ์ถ์ต๋๋ค.
ํ์ง๋ง ์ด๋ค ์บ๋ฆญํฐ๋ ์ญ์ ํ ์ ์์ต๋๋ค
2.2.0 ๋ฏธ๋ง์ ๊ด์ฐฎ์ต๋๋ค.
๋ฌผ๊ณ ๊ธฐ ๋ฒ์ : ๋ฌผ๊ณ ๊ธฐ, ๋ฒ์ 2.3.0
์ด์ ์ฒด์ : DragonFly testdf.com 4.4-RELEASE DragonFly v4.4.1.18.gc5db8-RELEASE # 0 : Thu Jan 28 15:02:10 CST 2016 [email protected] : / usr / obj / usr / src / sys / lhmwzy x86_64
ํฐ๋ฏธ๋ ๋๋ ํฐ๋ฏธ๋ ์๋ฎฌ๋ ์ดํฐ : xterm
์ด๋ค ํค๋ฅผ ๋๋ฅด์ญ๋๊น? ์ญํ ํค์ด?
์ด๊ฒ์ด ์ฌ์ค์ด๋ฉด bind -k backspace
๋ฅผ ์คํํ์ฌ ์ค์ ๋์ด ์๋์ง ํ์ธํ ๋ค์ ์๋ฅผ ๋ค์ด script
(๋๋ bash๋ฅผ ์คํํ๊ณ ctrl + v๋ฅผ ๋๋ฆ)๋ฅผ ์คํํ๊ณ ํค๋ฅผ ๋๋ฌ ์ํ์ค๋ฅผ ์ฐพ์ต๋๋ค. ์ ์กํฉ๋๋ค. (์คํฌ๋ฆฝํธ๋ ๊ธฐ๋ณธ์ ์ผ๋ก ํด๋น ์ธ์
์ ์ ์ฒด ์ถ๋ ฅ์ ํ์ฌ ๋๋ ํ ๋ฆฌ์ "typescript"๋ผ๋ ํ์ผ์ ๋ฃ์ต๋๋ค). Xterm์ "cH"๋ฅผ ๋ณด๋ด์ผํฉ๋๋ค. ์ด๋ค ๋ฌผ๊ณ ๊ธฐ๊ฐ ๋ฐฑ ์คํ์ด์ค๋ก ์ ํํด์ผํ๋์ง (terminfo๋ฅผ ํตํด _needs_ $ TERM์ ์ค์ ํด์ผํฉ๋๋ค).
๋ฏธ๋์ ๋ฌผ๊ณ ๊ธฐ ๋ฒ์ ์ "fish_key_reader"๋ผ๋ ์์ ๋์ฐ๋ฏธ ํ๋ก๊ทธ๋จ์ ์ฌ์ฉํ์ฌ ์ด๊ฒ์ ๋ค์ ์ฝ๊ฒ ๋ง๋ค ๊ฒ์ ๋๋ค.
$ TERM์ ๋ฌด์์ผ๋ก ์ค์ ๋์ด ์์ต๋๊น? "xterm"?
ํค๋ ๋ฐฑ ์คํ์ด์ค์
๋๋ค.
์ ์๊ฒ ์ฐํธ๋ฌผ์ ๋ณด๋ด ์ฃผ์๋ฉด ์ ์์์ ์ ๊ทผ ํ ์ ์๋๋กํ๊ฒ ์ต๋๋ค. ์ด์ ๋ฅผ ์๋ ค ๋๋ฆฌ๊ฒ ์ต๋๋ค.
ํค๋ ๋ฐฑ ์คํ์ด์ค์ ๋๋ค.
ํค์ ๋ ์ด๋ธ์ ๋ณด๋ด๋ ๋ฌธ์ ์ํ์ค๋ฅผ ์๋ ค์ฃผ์ง ์์ต๋๋ค. git ์ ์ฅ์์์ ๊ฐ์ ธ์จ ์์ค์์ fish๋ฅผ ์ค์นํ ์ ์์ต๋๊น? make fish_key_reader
๋ค์์ ./fish_key_reader
๋ฅผ ์
๋ ฅ ํ ์ ์์ผ๋ฉด ๋ฐฑ ์คํ์ด์ค ํค๋ฅผ ๋๋ฆ
๋๋ค. xxd
๋๋ od -tx1z
๋ฅผ ์คํํ ์์๋ ๊ฒฝ์ฐ ๋ฐฑ ์คํ์ด์ค ํค์ [ctrl-D]๋ฅผ ์ฐจ๋ก๋ก ๋๋ฅด์ญ์์ค. ๋ํ bind -k backspace
ํ๊ณ ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ฃผ์ธ์. echo $TERM
๋ ์คํํฉ๋๋ค.
์ฐ๋ฆฌ๋ ์ฑ
์ ์ด์ ์ ์ค๊ตญ์ด๋ฅผ ์ฝ์ง ์๊ธฐ ๋๋ฌธ์ ์์คํ
์ ๋ก๊ทธ์ธํ์ง ์๋ ๊ฒ์ด ์ข์ต๋๋ค. ๋ฐ๋ผ์ set LANG zh_CN.UTF-8
์ (๋) ์์
ํ๊ธฐ ์ด๋ ค์ธ ๊ฒ์
๋๋ค.
./fish_key_reader
999999 usec dec : 8 hex : 8 char : b (์ผ๋ช
cH)
์ฐธ๊ณ : ๋ฐ์ธ๋ ํค ์ด๋ฆ "๋ฐฑ ์คํ์ด์ค"์ ๋ํ ์ํ์ค๋ฅผ ํ์ธํ์ต๋๋ค.
bind -k ๋ฐฑ ์คํ์ด์ค
bind : '๋ฐฑ ์คํ์ด์ค'ํค์ ๋ํ ๋ฐ์ธ๋ฉ์ด ์์ต๋๋ค.
์์ฝ $ TERM
xterm
bind : '๋ฐฑ ์คํ์ด์ค'ํค์ ๋ํ ๋ฐ์ธ๋ฉ์ด ์์ต๋๋ค.
์ข์์, ๊ทธ๊ฒ ๋น์ ๋ฌธ์ ์ ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ๋งํด์ผํฉ๋๋ค.
bind -k backspace backward-delete-char
์ด๊ฒ์ด LANG ๋ณ์ ์ค์ ๊ณผ ์ด๋ป๊ฒ ๊ด๋ จ์ด ์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ์ด๋ป๊ฒ ๋ ๊ธฐ๋ณธ ํค ๋ฐ์ธ๋ฉ์ ์ฌ์ ์ํ์ต๋๋ค. _ ~ / .config / fish / _ ** ํ์ผ์์ "bind"๋ผ๋ ๋จ์ด๊ฐ ์ธ๊ธ ๋ ๊ฒ์ ๊ฒ์ํฉ๋๋ค. ๋ํ ํ๋ฌ๊ทธ์ธ ๊ด๋ฆฌ์ (์ : fisherman ๋๋ oh-my-fish)๋ฅผ ์ฌ์ฉ ์ค์ด๊ฑฐ๋์ด ๋ฌธ์ ์ ๊ด๋ จ์ด์์ ์์๋ ๋ค๋ฅธ ํ์ฌ ์คํฌ๋ฆฝํธ๋ฅผ ์ค์น ํ์ต๋๊น?
ํ์ธ.
~ / .config / fish /์๋ 3 ๊ฐ์ ํ์ผ ๋ง ์์ต๋๋ค
cat config.fish
set LANG zh_CN.UTF-8
cat fishd.lhmtestdf.com
# This file is automatically generated by the fish.
# Do NOT edit it directly, your changes will be overwritten.
SET __fish_init_1_50_0:\x1d
SET __fish_init_2_3_0:\x1d
SET fish_color_autosuggestion:555\x1eyellow
SET fish_color_command:005fd7\x1epurple
SET fish_color_comment:red
SET fish_color_cwd:green
SET fish_color_cwd_root:red
SET fish_color_end:green
SET fish_color_error:red\x1e\x2d\x2dbold
SET fish_color_escape:cyan
SET fish_color_history_current:cyan
SET fish_color_host:normal
SET fish_color_match:cyan
SET fish_color_normal:normal
SET fish_color_operator:cyan
SET fish_color_param:00afff\x1ecyan
SET fish_color_quote:brown
SET fish_color_redirection:normal
SET fish_color_search_match:\x2d\x2dbackground\x3dpurple
SET fish_color_selection:\x2d\x2dbackground\x3dpurple
SET fish_color_user:green
SET fish_color_valid_path:\x2d\x2dunderline
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell\x0aType\x20\x1b\x5b32mhelp\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20for\x20instructions\x20on\x20how\x20to\x20use\x20fish
SET fish_key_bindings:fish_default_key_bindings
SET fish_pager_color_completion:normal
SET fish_pager_color_description:555\x1eyellow
SET fish_pager_color_prefix:cyan
SET fish_pager_color_progress:cyan
๋ฌผ๊ณ ๊ธฐ -2.2.0์์
๋ช
๋ น bind ์ถ๋ ฅ :
bind '' self-insert
bind \n execute
bind \ck kill-line
bind \cy yank
bind \t complete
bind \e\n commandline\ -i\ \\n
bind \e\[A up-or-search
bind \e\[B down-or-search
bind -k down down-or-search
bind -k up up-or-search
bind \e\[C forward-char
bind \e\[D backward-char
bind -k right forward-char
bind -k left backward-char
bind -k dc delete-char
bind -k backspace backward-delete-char
bind backward-delete-char
bind \e\[H beginning-of-line
bind \e\[F end-of-line
bind \e\[1\~ beginning-of-line
bind \e\[4\~ end-of-line
bind -k home beginning-of-line
bind -k end end-of-line
bind -k sdc backward-delete-char
bind \e\eOC nextd-or-forward-word
bind \e\eOD prevd-or-backward-word
bind \e\e\[C nextd-or-forward-word
bind \e\e\[D prevd-or-backward-word
bind \eO3C nextd-or-forward-word
bind \eO3D prevd-or-backward-word
bind \e\[3C nextd-or-forward-word
bind \e\[3D prevd-or-backward-word
bind \e\[1\;3C nextd-or-forward-word
bind \e\[1\;3D prevd-or-backward-word
bind \e\eOA history-token-search-backward
bind \e\eOB history-token-search-forward
bind \e\e\[A history-token-search-backward
bind \e\e\[B history-token-search-forward
bind \eO3A history-token-search-backward
bind \eO3B history-token-search-forward
bind \e\[3A history-token-search-backward
bind \e\[3B history-token-search-forward
bind \e\[1\;3A history-token-search-backward
bind \e\[1\;3B history-token-search-forward
bind \ca beginning-of-line
bind \ce end-of-line
bind \ey yank-pop
bind \cw backward-kill-path-component
bind \cp history-search-backward
bind \cn history-search-forward
bind \cf forward-char
bind \cb backward-char
bind \ct transpose-chars
bind \et transpose-words
bind \eu upcase-word
bind \ec capitalize-word
bind \ backward-kill-word
bind \eb backward-word
bind \ef forward-word
bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word
bind \e\[1\;9A history-token-search-backward
bind \e\[1\;9B history-token-search-forward
bind \e\[1\;9C forward-word
bind \e\[1\;9D backward-word
bind \e. history-token-search-backward
bind -k ppage beginning-of-history
bind -k npage end-of-history
bind \e\< beginning-of-buffer
bind \e\> end-of-buffer
bind \el __fish_list_current_token
bind \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end'
bind \cl 'clear; commandline -f repaint'
bind \cc 'commandline ""'
bind \cu backward-kill-line
bind \ed kill-word
bind \cd delete-or-exit
bind -k f1 __fish_man_page
bind \eh __fish_man_page
bind \ep __fish_paginate
bind -k btab complete-and-search
bind \e cancel
bind \e\[I 'begin;end'
bind \e\[O 'begin;end'
๊ทธ๋ฌ๋ fish-2.3.0์์ ๋ช ๋ น bind ์ถ๋ ฅ :
bind '' self-insert
bind \n execute
bind \r execute
bind \t complete
bind \cc 'commandline ""'
bind \cd exit
bind \ce bind
๋ฌผ๊ณ ๊ธฐ 2.3.0์ ์ด๋ป๊ฒ ์ค์น ํ์ต๋๊น? ์ฌ์ฉ์ ๊ณต๊ฐ ์คํฌ๋ฆฝํธ๋ฅผ ์ฐพ์ ์์๋ ๋ฌผ๊ณ ๊ธฐ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์คํ์ค์ธ ๊ฒ ๊ฐ์ต๋๋ค.
์ถ์ฒ์์
git clone
autoconf
configure
gmake
gmake install
์ข์, ํฉ๋ฆฌ์ ์ผ๋ก ๋ณด์ธ๋ค. ๋ค์ ๋ช ๋ น์ ๋ฌด์์ ์ถ๋ ฅํฉ๋๊น?
echo $__fish_active_key_bindings
echo $fish_function_path
ํจ์ ๊ฒฝ๋ก ๋๋ ํ ๋ฆฌ ์ค ํ๋์ _fish_default_key_bindings.fish_๊ฐ ์์ต๋๊น (์ผ๋ฐ์ ์ผ๋ก ๋์ด๋ ๋ง์ง๋ง ๋๋ ํ ๋ฆฌ)? functions fish_default_key_bindings
์ด ๋ฌด์์ ์ถ๋ ฅํ๋์ง ๊ถ๊ธํฉ๋๋ค. ํด๋น ์ถ๋ ฅ์ ๋ณต์ฌํ์ฌ ๋ถ์ฌ ๋ฃ์ง ๋ง์ญ์์ค. ๊ทธ๋ฌ๋ _fish_default_key_bindings.fish_ ํ์ผ์์๋ ๊ฒ๊ณผ ์ผ์นํด์ผํฉ๋๋ค. ๋ํ ํค ๋ฐ์ธ๋ฉ์ ์ผ๋ฐ์ ์ผ๋ก ํจ์ ๊ฒฝ๋ก var์ ๋์ด๋ ๋๋ ํ ๋ฆฌ ์ค ํ๋์ ์์ด์ผํ๋ ___ fish_config_interactive.fish_ ์คํฌ๋ฆฝํธ์ ์ํด ์ค์ ๋ฉ๋๋ค.
.config / fish / config.fish๋ฅผ ์ญ์ ํ๋ฉด ๋ชจ๋ ๊ฒ์ด ์ ์คํ๋ฉ๋๋ค.
ํ์ง๋ง set LANG zh_CN.UTF-8
๋ฌธ์์ด์ .config / fish / config.fish ๋๋ /usr/local/etc/fish/config.fish์ ๋ฃ์ผ๋ฉด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
echo $__fish_active_key_bindings
์๋ฌด๊ฒ๋ ์ถ๋ ฅํ์ง ์์ต๋๋ค.
echo $fish_function_path
์ถ๋ ฅ :
/home/lhm/.config/fish/functions /usr/local/etc/fish/functions /usr/local/share/fish/vendor_functions.d /usr/local/share/fish/functions
.config / fish / config.fish๋ฅผ ์ญ์ ํ๊ฑฐ๋ /usr/local/etc/fish/config.fish์ ๋ชจ๋ ์ค์ ์ฃผ์์ ๋ฌ๋ฉด ์ถ๋ ฅ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
echo $__fish_active_key_bindings
์ถ๋ ฅ :
fish_default_key_bindings
echo $fish_function_path
์ถ๋ ฅ :
/home/lhm/.config/fish/functions /usr/local/etc/fish/functions /usr/local/share/fish/vendor_functions.d /usr/local/share/fish/functions
fish_default_key_bindings.fish
ํ์ผ์ /usr/local/share/fish/functions/fish_default_key_bindings.fish์ ์์ต๋๋ค.
๋ฌผ๊ณ ๊ธฐ๊ฐ ํค ๋ฐ์ธ๋ฉ์ ์ค์ ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ด๋ __fish_config_interactive
(๋ฐ์ธ๋ฉ ์ค์ ํฌํจ)๊ฐ ์คํ๋์ง ์์๊ฑฐ๋ (์ฒซ ๋ฒ์งธ ํ๋กฌํํธ ๋ฐ๋ก ์์ ์์ด์ผ ํจ) $ fish_key_bindings๊ฐ ๋น์ด ์๊ธฐ ๋๋ฌธ์
๋๋ค (๊ฐ์ด ๋ค์๊ณผ ๊ฐ์ผ๋ฉด ๊ธฐ๋ณธ ๋ฐ์ธ๋ฉ์ผ๋ก ๋๋๋ ค ์ผํฉ๋๋ค. ์ ํจํ์ง).
$ LANG ์ค์ ์ ์ํด ํธ๋ฆฌ๊ฑฐ๋๋ ๊ฒ์ผ๋ก ๋ณด์ด๋ฏ๋ก ์ธ์ฝ๋ฉ ๋ฌธ์ ๋ฅผ ๊ฐ๋ฆฌ ํต๋๋ค.
github๊ฐ ์ธ์ฝ๋ฉ์ ์์ ํ๋ ๋ฐ ๋์์ด๋๋์ง ํ์คํ์ง ์๊ธฐ ๋๋ฌธ์ ๋ชจ๋ ๊ตฌ์ฑ ํ์ผ๊ณผ fishd ํ์ผ์ ๊นจ๋ํ ํํ๋ก ๋ฉ์ง ์ ์์ต๋๋ค. ๋ํ config.fish์์ ์ค์ ํ์ง ์์ ๊ฒฝ์ฐ $ LANG ๊ฐ์ ์ผ๋ง์ ๋๊น? (ASCII์ ํธํ๋์ด์ผํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์ฐ๋ฆฌ๊ฐ ์ฐ๋ฆฌ ์์ ์ ํ์ผ์ ์ฝ์ ์๋ ์๋ค๊ณ ์๊ฐํ์ง๋ง ๋น์ ์ ๊ฒฐ์ฝ ์ ์ ์์ต๋๋ค)
_config.fish_์ set LANG zh_CN.UTF-8
์ (๋ฅผ) ์ถ๊ฐํ์ง๋ง ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์์์ต๋๋ค. @faho๊ฐ ๋งํ๋ฏ์ด ์ด๊ฒ์ ๋ฌธ์ ์ธ์ฝ๋ฉ ๋ฌธ์ ์ฒ๋ผ ๋ณด์
๋๋ค. ํนํ ๋ฌผ๊ณ ๊ธฐ ํ์ผ์ UTF-8๋ก ์ธ์ฝ๋ฉ๋์ง ์์ต๋๋ค. file /usr/local/share/fish/functions/__fish_config_interactive.fish
๋ ๋ฌด์์๋ณด๊ณ ํฉ๋๊น? "ASCII ํ
์คํธ"๋ผ๊ณ ํ์๋๋ฉด LANG ์ค์ ์ถ๊ฐ ํ ๋ค์ ๋ค์๊ณผ ๊ฐ์ด ์ ์
ธ์ ์์ํ์ฌ ๋๋ฒ๊น
์ถ๋ ฅ์ ์์งํฉ๋๋ค.
fish -d5
exit
exit
๊ทธ๋ฐ ๋ค์ _typescript_ ํ์ผ์์ด ๋ฌธ์ ์ ์ฒจ๋ถํ์ญ์์ค.
file /usr/local/share/fish/functions/__fish_config_interactive.fish
/usr/local/share/fish/functions/__fish_config_interactive.fish: ASCII text
cat typescript output:
Script started on Mon May 23 07:34:02 2016
@ ~/home/lhm> /usr/local/bin/fish -d5
@ ~/home/lhm> exit
@ ~/home/lhm> exit
๋๋์ฒด? fish -d5
๊ฐ ์ ํ๋กฌํํธ ์ธ์๋ ์ถ๋ ฅ์ ์์ฑํ์ง ์์๋ค๋ ๋ง์
๋๊น? ๋ค์๊ณผ ๊ฐ์ ๋ง์ ์ถ๋ ฅ์ ์ป์์ด์ผํฉ๋๋ค.
fish: Continue job 1, gid 0 (fish_title), COMPLETED, NON-INTERACTIVE
fish: proc::read_try('fish_title')
fish: io_buffer_t::read: blocking read on fd 3
DragonFly๋ https://www.dragonflybsd.org/์ ๋ํ ์ฐธ์กฐ set LANG C
๋๋ set LANG en_US.UTF-8
์ด๋ฉด ์ด๋ป๊ฒ๋ฉ๋๊น?
์, https://www.dragonflybsd.org/ ๋ ํ๋ก์ ํธ ํ ํ์ด์ง์
๋๋ค.
๋๋ ๋ค์๊ณผ ๊ฐ์ ์์ ์์ค์์ ๋น๋ํฉ๋๋ค.
git clone
autoconf
configure
gmake
gmake install
์ค์ ๋ LANG C ๋ง fish -d5
ํ๋๋ก ๋ง๋ค ์ ์์ต๋๋ค.
<2> fish: sourcing /usr/local/share/fish/config.fish
<4> fish: Exec job 'builtin source /usr/local/share/fish/config.fish' with id 1
<4> fish: Exec job 'set -g IFS \n\ \t' with id 2
<3> fish: Skipping fork: no output for internal builtin 'set'
<3> fish: Set status of set -g IFS \n\ \t to 0 using short circuit
<3> fish: Job is constructed
<4> fish: Continue job 2, gid 0 (set -g IFS \n\ \t), COMPLETED, NON-INTERACTIVE
<4> fish: Exec job 'status --is-interactive' with id 2
<3> fish: Skipping fork: no output for internal builtin 'status'
<3> fish: Set status of status --is-interactive to 0 using short circuit
<3> fish: Job is constructed
<4> fish: Continue job 2, gid 0 (status --is-interactive), COMPLETED, NON-INTERACTIVE
<4> fish: Exec job 'not set -q NVIM_LISTEN_ADDRESS' with id 2
<3> fish: Skipping fork: no output for internal builtin 'set'
<3> fish: Set status of not set -q NVIM_LISTEN_ADDRESS to 1 using short circuit
<3> fish: Job is constructed
<4> fish: Continue job 2, gid 0 (not set -q NVIM_LISTEN_ADDRESS), COMPLETED, NON-INTERACTIV
set LANG en_US.UTF-8
๋ set LANG zh_CN.UTF-8
์ ๋์ผํ ๊ฒฐ๊ณผ์ด๋ฉฐ ์
ธ ํ๋กฌํํธ ์ธ์๋ ์ถ๋ ฅ๋์ง ์์ต๋๋ค.
๋ค๋ฅธ DF 4.4 ์์
/usr/local/bin/fish -d5
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
fish-2.2.0์ ์ ์์ ์ผ๋ก ์คํ๋ฉ๋๋ค.
์ข์, fish์ DragonFly ์์ด๋ char ํจ์ ์ฌ์ด์๋ ๋ถ๋ช ํ ๋น ํธํ์ฑ์ด ์๊ฑฐ๋ ํ์์ ๋ฒ๊ทธ๊ฐ ์์ต๋๋ค. ๋ฌผ๊ณ ๊ธฐ๋ฅผ ๋ง๋ค๊ณ ํ ์คํธ ํ ์์๋ DragonFly 4.3 ์์คํ ์ ์ก์ธ์ค ํ ์ ์์ต๋๊น? ํต์ฌ ๋ณ๊ฒฝ ์ธ DragonFly 4.4 ๋ก์ผ์ผ ์ง์์ ๋์ ๋ ๋ณ๊ฒฝ ์ฌํญ์ธ์ง ํ์ธํ์ฌ ์์ํ ์ ์๋ค๋ฉด ์ข์ ๊ฒ์ ๋๋ค.
4.2-RELEASE DragonFly ์์์์ ์ต์ ๋ฌผ๊ณ ๊ธฐ๋ฅผ ํ ์คํธํฉ๋๋ค. ๋ชจ๋ ๊ฒ์ด ์ ์์ ์ผ๋ก ์คํ๋ฉ๋๋ค.
cat .config/fish/config.fish
set -gx LANG zh_CN.UTF-8
locale
LANG="zh_CN.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_ALL=""
/usr/local/bin/fish -v
fish, version 2.3.0-162-g85e701f
uname -a
DragonFly . 4.2-RELEASE DragonFly v4.2.4-RELEASE #6: Sun Aug 9 13:25:14 EDT 2015 [email protected]:/usr/obj/home/justin/release/4_2/sys/X86_64_GENERIC x86_64
์ข์ต๋๋ค. DragonFly ๊ด๋ฆฌ์์๊ฒ ๋ฌธ์ํ์ญ์์ค. ๋๋ ๊ทธ๋ค์ ์ฝ๋์ ๊ฒฐํจ์ด ์๋ค๊ณ ๋งํ๋ ๊ฒ์ด ์๋๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๋ค์ ์ mbrtowc()
๋ฐ wcrtomb()
์ ๊ฐ์ ํจ์๊ฐ ๋ฌผ๊ณ ๊ธฐ๋ฅผ ํธ์ถ ํ ๋ ์์ ๋ ๊ฒฐ๊ณผ๋ฅผ ์ฐ์ถํ์ง ์๋์ง์ ๋ํ ์ค๋ช
์ ๊ฐ์ง๊ณ ์์ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. ์ด ํ๋์ด ๋ฌผ๊ณ ๊ธฐ์๊ฒ๋ง ์ํฅ์ ๋ฏธ์น ๊ฐ๋ฅ์ฑ์ ๊ฑฐ์ ์์ต๋๋ค.
๋๋ ์ด๊ฒ์ ๋ชจ๋ UTF-8 ๋ก์ผ์ผ (์ : en_AU.UTF-8
)๋ก DragonFly BSD 4.5-DEVELOPMENT์์๋ ์ฌํ ํ ์ ์์ต๋๋ค.
๋ฟก ๋นต๋จ
๊ทธ๋์, mbrtowc () ๋ฐ wcrtomb () ํจ์๋ฅผ ํ
์คํธํ๊ธฐ์ํ ํ
์คํธ ์ผ์ด์ค๋ฅผ ์๋ ค์ฃผ์๊ฒ ์ต๋๊น?
์ข์ต๋๋ค. DragonFly ๊ด๋ฆฌ์์๊ฒ ๋ฌธ์ํ์ญ์์ค. ๋๋ ๊ทธ๋ค์ ์ฝ๋์ ๊ฒฐํจ์ด ์๋ค๊ณ ๋งํ๋ ๊ฒ์ด ์๋๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๋ค์ ์ mbrtowc () ๋ฐ wcrtomb ()์ ๊ฐ์ ํจ์๊ฐ ๋ฌผ๊ณ ๊ธฐ๋ฅผ ํธ์ถ ํ ๋ ์์ ๋ ๊ฒฐ๊ณผ๋ฅผ ์ฐ์ถํ์ง ์๋์ง์ ๋ํ ์ค๋ช ์ ๊ฐ์ง๊ณ ์์ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. ์ด ํ๋์ด ๋ฌผ๊ณ ๊ธฐ์๊ฒ๋ง ์ํฅ์ ๋ฏธ์น ๊ฐ๋ฅ์ฑ์ ๊ฑฐ์ ์์ต๋๋ค.
๊ทธ๋์, mbrtowc () ๋ฐ wcrtomb () ํจ์๋ฅผ ํ ์คํธํ๊ธฐ์ํ ํ ์คํธ ์ผ์ด์ค๋ฅผ ์๋ ค์ฃผ์๊ฒ ์ต๋๊น?
๋๋ ์ ์ํ๋ ค๊ณ ํ๋ค
$ gmake fish_tests
$ ./fish_tests convert
๊ทธ๋ฌ๋ ๊ทธ๊ฒ์ ์คํจํ์ง ์์ต๋๋ค. ./fish_tests
๋ฅผ ํตํด ๋ชจ๋ ํ
์คํธ๋ฅผ ์คํํ๋ฉด ์ฌ๋ฌ ํ
์คํธ๊ฐ ์คํจํ์ง๋ง์ด ๋ฌธ์ ๋ฅผ ์ค๋ช
ํ๋ ๊ฒ์ ์์ต๋๋ค.
DragonFly 4.4.3์ ์ค์นํ๊ณ git head์์ ๋ฌผ๊ณ ๊ธฐ๋ฅผ ๋ง๋ค๊ณ ์ค์นํ์ต๋๋ค. ๋ด _config.fish_์์ set -x LANG en_US.UTF-8
๋ก ์์ ์ ์์ํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์๊ธฐ์น ์์ ์ค๋ฅ๊ฐ ๋ง์ด ๋ฐ์ํ์ต๋๋ค.
alias: Name cannot be empty
There is no fish_key_bindings function called: 'fish_default_key_bindings'
Reverting to default bindings
๋น์ฐํ bind
๋ ๊ธฐ๋ณธ ๋ฐ์ธ๋ฉ์ด ์ต์์ด๋ฏ๋ก ํค ๋ฐ์ธ๋ฉ์ด ๊ฑฐ์ ์์ต๋๋ค. locale
๋ช
๋ น์ ๋ช
์ ์ ์ผ๋ก en_US.UTF-8
์ค์ ํ ๋๊น์ง C
๋ณด๊ณ ํ์ต๋๋ค. ์ ์๋ ์๋ํ์ง๋ง ํ์๋ ์๋ํ์ง ์์ต๋๋ค. ์์คํ
๊ธฐ๋ณธ ๋ก์ผ์ผ์ด "en_US.UTF-8"์ด ์๋๋ผ "C"๋ผ๋ ์ฌ์ค์ ๋๋์ต๋๋ค. ์ด๋ DragonFly ๊ฐ๋ฐ์๊ฐ UTF-8 ์ง์์ ๋ฌธ์ ๊ฐ ์์์ ์ธ์ํ๊ณ ์์์ ์๋ฏธํฉ๋๊น?
๋๋ ์ด๊ฒ์ ๋๋ฒ๊น ํ๋ ๋ฐ ๋ ๋ง์ ์๊ฐ์ ํ ์ ํ ์๋ ์๊ณ ํ์ง ์์ ์๋ ์์ต๋๋ค. DragonFly ๊ด๋ฆฌ์๊ฐ์ด ๋ฌธ์ ์ ๋ํ ํต์ฐฐ๋ ฅ์ ์ ๊ณต ํ ๊ฐ๋ฅ์ฑ์ด ๋๊ธฐ ๋๋ฌธ์ ์ฌ๋ฌ๋ถ์ด ์ด์ผ๊ธฐ ํ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
fwprintf
ํ๋ ์ต์ํ์ ํ
์คํธ ์ผ์ด์ค๊ฐ ์์ผ๋ฏ๋ก DragonFly BSD ์ ํ์ ๋ํด ๋ฌผ์ด ๋ณด๊ฒ ์ต๋๋ค.
๋๋ ์ด๋ค ํจ์น๋ฅผ ์ํํ๊ฒ๋์ด ๊ธฐ์ ๊ฒ์ด๋ค.
DragonFly BSD ๋ฉ์ผ ๋ง๋ฆฌ์คํธ์์ Romick์ ๋ค์๊ณผ
ํผ์ฌ ์๋ก ํ์๋ฅผ ์ดํด ๋ณด์๊ณ , ์ ๋ ฅ ์คํธ๋ฆผ์์ ์ง์ ํน์ ๋ฌธ์๋ฅผ ์ฌ์ฉํ์ฌ BRACKET_BEGIN, BRACKET_END, BRACKET_SEP, INTERNAL_SEPARATOR ๋ฑ๊ณผ ๊ฐ์ ๋ค๋ฅธ ํญ๋ชฉ์ ํ์ํ์ต๋๋ค.
๋ฌธ์๊ฐ ์ํ๋ฒณ์ ์ ์ฒด ๊ตฌ์ฑ์ ์ธ ๋ก์ผ์ผ์ ๋ง๋ ๋๊น์ง ๊ด์ฐฎ์ต๋๋ค.
์ ๋ ์ฝ๋ ๋ฒ์๋ 0x0์์ 0x10FFFF์ด๊ณ ๋ฌธ์ INTERNAL_SEPARATOR์ ์ฝ๋๋ 0xFDD7์ ๋๋ค.DragonFly์์ BSD ํจ์ iswalnum ()์ ๋ชจ๋ ๋ก์ผ์ผ์ ๋์์ ํ์ธํ๋ฏ๋ก
์ธ ๊ฐ์ง ์ ํ์ด ์์ต๋๋ค.
1) ์์ ์ iswalnum () ์ฌ์ฉ :diff --git a/src/common.h b/src/common.h index e59dfc0..e8c01c3 100644 --- a/src/common.h +++ b/src/common.h @@ -769,4 +769,8 @@ __attribute__((noinline)) void debug_thread_error(void); /// specified base, return -1. long convert_digit(wchar_t d, int base); +inline int iswalnum(wchar_t chr) { + return((chr >= L'a' && chr <= L'z') || (chr >= L'A' && chr <= L'Z') || iswdigit(chr)); +} + #endif
2) ํน์ ๋ฌธ์์ ๋ ํฐ ๊ฐ์ ์ฌ์ฉํ์ญ์์ค (๋๋ ์ด๊ฒ์ ํ ์คํธํ์ง ์์์ต๋๋ค).
3) ๋ค๋ฅธ ๊ฒ :)
๊ทธ ๊ฐ์ธ์ด ์ ๋ ์ฝ๋์ ๋ํด ์๋ ๊ฒ์ด ์๋์ง ๊ถ๊ธํฉ๋๋ค. ์ด๋ฌํ "ํน์ ๋ฌธ์"๋ ์์ซ์๊ฐ ์๋ ๊ฒ์ผ๋ก ์ ์ ๋ ๊ฐ์ธ ์ฌ์ฉ ์์ญ ๋ฌธ์์
๋๋ค : https://en.wikipedia.org/wiki/Unicode_character_property#General_Category. ๋๋ ์ด๊ฒ์ OS X, Linux ๋ฐ DragonFly์์ ํ
์คํธํ์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ธ ๊ฐ์ง ๋ชจ๋ iswalnum(INTERNAL_SEPARATOR)
๋ํด false๋ฅผ ๋ฐํํฉ๋๋ค. ๋ํ ์ฐ๋ฆฌ๋ ์ด๋ฌํ ํน์ ๋ฌธ์๋ฅผ fwprintf ()์ ๊ฐ์ ํจ์์ ์ ๋ฌํ์ง ์์ผ๋ฏ๋ก ์ด๊ฒ์ด ์ ๊ด๋ จ์ฑ์ด ์๋์ง ์ ์ ์์ต๋๋ค.
์ ๋ง ๋ฉ์ง ์ถ์ ํ ์คํธ ์ผ์ด์ค @zanchey!
DragonflyBSD๋ฅผ ์ด๋ป๊ฒ ์ค์นํ๊ณ ์์ต๋๊น? ์ผ๊ฐ ISO์ 4.4.3 ๋ฆด๋ฆฌ์ค ISO (Virtualbox ์ฌ์ฉ)๋ก ์๋ํ์ง๋ง fwprintf ์ถ์ ํ ์คํธ ์ผ์ด์ค๋ก ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์ ์์์ต๋๋ค.
ํธ์ง : ๋๋ ๋ํ 4.4.3์์ ๋ฌผ๊ณ ๊ธฐ๋ฅผ ๋น๋ํ๊ณ ์ค์นํ ์ ์์๊ณ ์๋ฆผ ํ ์คํธ๋ฅผ ์ ์ธํ๊ณ ํ ์คํธ๋ ํต๊ณผํ์ต๋๋ค.
ํ ์คํธ ์ผ์ด์ค๋ SSH๋ฅผ ํตํด์๋ง ์คํจํ๋ฉฐ VirtualBox์ ์์คํ ์ฝ์์์ ์๋ํฉ๋๋ค.
์ค ์์ฐ. Vagrant๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๊น?
์๋์, ๋จ์ํ VirtualBox 5.0.20์ ๋๋ค.
# 3406์ ์ค๋ณต์ผ๋ก ๋ซ์ ํ ์์ ๊ถ์ ๊ฐ์ ธ๊ฐ ๊ฒ์ ๋๋ค. FreeBSD๋ฅผ ์ค์นํ๊ณ ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์๊ฐ์ ์ฐพ๊ณ ์ฑ๊ณตํ๋ฉด ์ถ๊ฐ๋ก ๋๋ฒ๊ทธ ํ ๊ฒ์ ๋๋ค.
@lhmwzy ์ด๊ฒ์ ์๋ง๋ # 3406๊ณผ ๋์ผํ ๋ฌธ์ ์ผ ๊ฒ์ ๋๋ค. ์ฐธ๊ณ ๋ก ๋๋ ํ์์ ๋ฌธ์ ๋ฅผ ์๋ถํ๊ณ ์ถ์ ํ์ฌ f2246dfb343bea19beb176fb2cc534f85513b2eb๋ฅผ ์ปค๋ฐํ์ต๋๋ค.
๋ด ์ ๋ฐ์ดํธ์์ # 3406 ํธ๊น์ง (์ง๊ธ์ DragonFly BSD๊ฐ ์๋ FreeBSD 12๋ก ์์ ํ๊ณ ์์ต๋๋ค) :
์ฐธ๊ณ ๋ก FreeBSD 12๋ฅผ ์ค์นํ๊ณ ์ด ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์ ์์ต๋๋ค. ํค๊ฐ ์๋ํ์ง ์๋ ์ด์ ๋ ๊ธฐ๋ณธ ํค ๋ฐ์ธ๋ฉ์ด UTF-8 ๋ก์ผ์ผ๋ก ์ค์ ๋์ง ์์๊ธฐ ๋๋ฌธ์ ๋๋ค.
Reverting to default bindings
The function call stack limit has been exceeded. Do you have an accidental infinite loop?
fish: __fish_reload_key_bindings VARIABLE SET fish_key_bindings
^
in event handler: handler for variable 'fish_key_bindings'
alias: Name cannot be empty
์ ๊ฐ์ ๋ค๋ฅธ ์ค๋ฅ๋ ์์ต๋๋ค. ๋ํ git checkout f2246df~
๊ฑด๋ฌผ์ ๋ฌธ์ ๊ฐ ์์์ ํ์ธํ์ต๋๋ค. ๊ทธ ๋ณํ์ ์ ์๋ก์ ์ ์๊ฒ ๋งค์ฐ ๋๋์ต๋๋ค.
ํ๋์ด ๊ฐ๋ผ์ง ์ปค๋ฐ์ ์ฐพ์์ต๋๋ค. ํ์ง๋ง ๊ทธ๊ฒ ๋ฌด์์ด ์๋ชป๋์๋์ง๋ ๋ถ๋ช ํ์ง ์์ต๋๋ค.
๋ณ์นญ๊ณผ ๊ฐ์ ๋ค๋ฅธ ์ค๋ฅ๋ ์์ต๋๋ค. ์ด๋ฆ์ ๋น์ ๋ ์ ์์ต๋๋ค.
@ krader1961 : ์ด๊ฒ์ ๊ฐ์ต๋๋ค . ๋ณ์ ๋ง์๋ ๋ฐ์ดํ๋ ๋น ์ธ์๋ก ํด๊ฒฐ๋ฉ๋๋ค.์ด ์ค๋ฅ๋ ๋ณ์นญ์ด test -z "$name"
์คํจ ํ ๋ ๋ฐ์ํฉ๋๋ค.
@faho , ์, ๋ณ์นญ ํจ์ ์คํจ๋ฅผ ๋๋ฒ๊น ํ๊ณ ๋์ผํ ๊ฒฐ๋ก ์ ๋๋ฌํ์ต๋๋ค. ์ด๊ฒ์ด ์ด๋ฌํ ๋ชจ๋ BSD ์ฆ์์ ์ค๋ช ํ๋ ๊ทธ๋ ์ง ์๋ ํฐ ๋ฐ์ดํ๋ก ๋ฌถ์ธ ๋ฌธ์์ด์ ์ ๋ ์ฝ๋ ์์ฝ ๋ฌธ์ ๋ฒ์์์๋ ๋ด๋ถ ํ ํฐ VARIABLE_EXPAND_SINGLE ์ค ํ๋๋ฅผ ํฌํจํ๊ธฐ ๋๋ฌธ์ ๋ ๊น์ด ํํค ์น๊ธฐ์ ์ข์ ์ฅ์์ฒ๋ผ ๋ณด์ ๋๋ค.
๋ํ ๋๋ฒ๊ทธ ๋ฌธ์ ์ถ๊ฐํ๊ณ ์ฐ๋ฆฌ๊ฐ ์ฌ์ฉํ๋ ๋ชจ๋ isw...()
ํจ์ (์ : iswalnum()
)๋ FreeBSD 12์ ๋ด๋ถ ํ ํฐ์ ๋ํด ์ฌ๋ฐ๋ฅธ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํฉ๋๋ค. ๋ฐ๋ผ์ ๋๊ตฐ๊ฐ๊ฐ @zanchey ์๊ฒ
์ฌ์ค, BSD์ UTF-8 ๋ก์ผ์ผ์ ์ฌ์ฉํ๋ฉด ํฐ ๋ฐ์ดํ๋ก ๋ฌถ์ธ ๋ฌธ์์ด ๋ฌธ์ ๋ด์์ var ํ์ฅ์ ๋งค์ฐ ์ฝ๊ฒ ์ฌํ ํ ์ ์์ต๋๋ค.
$ set wtf b
$ echo a "$wtf" c
a c
$ echo "a $wtf c"
a b c
$ echo "a $wtf"
a
$ echo "$wtf c"
b c
ํฐ ๋ฐ์ดํ๋ก var ์ฐธ์กฐ๋ฅผ ๋๋ผ ๋ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ๋ ๊น์ด ํํค์น ๊ฐ์น๊ฐ ์์ต๋๋ค. ์์ ๋ชจ๋ ์์ ๋ LC_ALL = C์์ ์ ์๋ํฉ๋๋ค.
๋ช ์๊ฐ ์ ์ FreeBSD์์ iswalnum()
์ ๋ต์ ๋ฐํํ๋ค๊ณ ๋งํ์ ๋ ์ ๋ ํ ๋ ธ์ต๋๋ค. setlocale("")
๊ฐ ํธ์ถ๋๊ธฐ ์ ์ ๋๋ฒ๊น
์ถ๋ ฅ์์ โโํด๋น ํจ์๋ฅผ ์ค์๋ก ํธ์ถํ์ต๋๋ค. ์ด๋ฌํ ๋๋ฒ๊ทธ ์ธ์๋ฅผ ์ด๋ํ๋ฉด 0xFDD0์์ ์์ํ๋ 32 ์ฝ๋ ํฌ์ธํธ ๋ธ๋ก์ด iswalnum()
๋ฐ iswgraph()
๊ฐ FreeBSD์์ ์ฌ๋ฐ๋ฅธ ๊ฐ์ธ 0์ด ์๋ 1์ ๋ฐํํ์ง๋ง GNU๊ฐ ์๋ ๊ฒ์ ๋ณด์ฌ์ค๋๋ค. ๋ฐ๋ฉด GNU๋ 0xF600์์ ์์ํ๋ ๊ฐ์ธ์ฉ ๋ฌธ์์ ๋ํด iswgraph()
๋ํด 1์ ์๋ชป ๋ฐํํ์ง๋ง FreeBSD๋ 0์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ฐํํฉ๋๋ค.
๋ฐ๋ผ์ ํ๋ซํผ์ ๊ด๊ณ์์ด ์ฌ๋ฐ๋ฅธ ๋์์ ์ป๊ธฐ ์ํด ํด๋น ํจ์ ์ฃผ๋ณ์ ์์ฒด ๋ํผ๋ฅผ ๊ตฌํํด์ผํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค. ์ต์ํ์ ์ถ๊ฐ ์ฝ๋์ ํผ๋์ค๋ฌ์ด ์ถ์ํ ๋ ์ด์ด๋ฅผ ์ฌ์ฉํ์ฌ์ด๋ฅผ ์ํํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ฝ๊ฐ ์๊ฐํด์ผํฉ๋๋ค.
์ด FreeBSD ๋ฒ๊ทธ๋ฅผ ์ด์์ต๋๋ค. ์ด ๊นจ์ง ๊ตฌํ์ ์ฌ์ ํ ํด๊ฒฐํด์ผํฉ๋๋ค.
์ฐ๋ฆฌ๋ ์ด๋ฏธ ๋ฌผ๊ณ ๊ธฐ ์ฝ๋๋ฅผ ํธ์ถํด์ผํ๋ ํจํด์ ์ค๋ฆฝ ํ fish_wcswidth()
๋ณด๋ค๋ wcswidth()
. ์ฐ๋ฆฌ๋ ๊ทธ๊ฒ์ cppcheck ๊ท์น (_.cppcheck.rule_ ์ฐธ์กฐ)์ผ๋ก ๋ช
์ํ์ต๋๋ค. isw...()
ํจ์ ๊ตฐ์ ๋ํด ๋์ผํ ์์
์ ์ํ ํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด๊ฒ์ด ์ต์ ์ ํด๊ฒฐ์ฑ
์
๋๊น? ํ์คํ ๊ตฌํํ๊ธฐ ๊ฐ์ฅ ์ฌ์ด ๋ฐฉ๋ฒ์
๋๋ค. ๋๊ตฌ์๊ฒ ๋ ๋์ ์๋ฃจ์
์ด ์์ต๋๊น?
์ถ์ , ๋๋ ์ฐ๋ฆฌ๊ฐ ์ง์ํ๋ ํ๋ซํผ ์ค ํ๋์์ ๋ฒ๊ทธ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ฌผ๊ณ ๊ธฐ๋ฅผ ํฅ์์ํค๋ ๊ฒ์ ๋ํด ์ด์ผ๊ธฐํ๊ณ ์๊ธฐ ๋๋ฌธ์์ด ๋ฌธ์ ๋ฅผ "๋ฒ๊ทธ"๊ฐ ์๋ "๊ฐ์ "์ผ๋ก ๋ถ๋ฅํ๊ณ ์ถ์ต๋๋ค. ์? ์๋? ๋ฌด์จ ์๊ด์ด์ผ? :๋ฏธ์:
PPS, iswalnum()
์ ๊ณต ํ ํ๋ซํผ์ ์ฌ์ ์ํ๋ฉด FreeBSD 12์์์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ค๋ ๊ฒ์ ํ์ธํ์ต๋๋ค.
์ด๊ฒ์ ์ฒ๋ฆฌํ๋ ๋ด๊ฐ ์ ํธํ๋ ๋ฐฉ๋ฒ์ ๊ตฌ์ฑ์ ๋์์ ํ์ธํ๊ณ ์ด์ ๊ด๋ จํ์ฌ ํธํ๋์ง ์๋ ๊ฒฝ์ฐ์๋ง ๊ธฐ๋ฅ์ ์ฌ์ ์ํ๋ ๊ฒ์ ๋๋ค.
autoconf ํ ์คํธ์์ ํ๋ซํผ ๊ธฐ๋ฅ์ ์ฌ์ ์ํ์ง ์๊ฒ ์ต๋๋ค. ์ฒซ์งธ, ์ฐ๋ฆฌ๋ ํ ๋ฆด๋ฆฌ์ค์์ ์ฌ๋ฐ๋ฅธ (๋๋ ์๋ชป๋) ๋์์ ๊ฐ์ง ๋ฐฐํฌํ์ ์ธ์คํด์ค๋ฅผ ๋ณด์๊ณ ๋ค์ ๋ฆด๋ฆฌ์ค์์๋ ๋์์ ๋ค์ง ์์ต๋๋ค. ์๋ฅผ ๋ค์ด FreeBSD 10 ์ฉ์ผ๋ก ๋น๋ ๋ ๋ฐ์ด๋๋ฆฌ๋ FreeBSD 12์์ ์ฌ์ ํ ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํด์ผํฉ๋๋ค. autoconf ํ ์คํธ๋ฅผ ๊ธฐ๋ฐ์ผ๋กํ๋ ํ๋์ผ๋ก๋์ด๋ฅผ ์ฒ๋ฆฌ ํ ์ โโ์์ต๋๋ค. ๋์งธ, ๋ฌธ์ ์ ํ ์คํธ๋ ์ฌ๋ฐ๋ฅธ ๋์์ ๋ณด์ฅํ๊ธฐ ์ํด ๋ํํ๊ณ ์ํฅ์๋ฐ๋ ํจ์์ ๋ํ ํธ์ถ์ด ์ค์ํ ์ฑ๋ฅ ๋ฃจํ์ ์์ง ์๋๋ผ๋ ๋งค์ฐ ์ ๋ ดํฉ๋๋ค. ์ ์งธ, ์ฌ์ฉ์๊ฐ ๋ง๋ฒ์ ๋ด๋ถ ์ฌ์ฉ ์ ์ฉ ์ฝ๋ ํฌ์ธํธ (๋ด TODO ๋ชฉ๋ก์ ์์)๋ฅผ ๋ด๋ถ ์ํ์ ์ฃผ์ ํ์ง ๋ชปํ๋๋ก์ด ๋ณ๊ฒฝ ์ฌํญ์ด ๋์ ํ ๋์ฐ๋ฏธ ํจ์ ์ค ํ๋๊ฐ ํ์ํฉ๋๋ค.
๋ํ ์ด์ ์๊ฒฌ์ ๋ค์ ์ง์ ์ ์ผ์ ๋ ๊ธฐ๋ก์ ์ํด ๋ ๋ฐฐํฌํ์ ๋ค์ง ์์ต๋๋ค.
๋ฐ๋ฉด์ GNU๋ ์ฐ๋ฆฌ๊ฐ ์ฌ์ฉํ๋ 0xF600์์ ์์ํ๋ ๊ฐ์ธ์ฉ ๋ฌธ์์ ๋ํด iswgraph ()์ ๋ํด 1์ ์๋ชป ๋ฐํํ์ง๋ง FreeBSD๋ 0์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ฐํํฉ๋๋ค.
์ ๋ ์ฝ๋ FAQ์ ๋ฐ๋ฅด๋ฉด ๊ฐ์ธ ์ฌ์ฉ ์์ญ์ ์ฝ๋ ํฌ์ธํธ๋ ๊ด๋ จ ๊ธ๋ฆฌํ (์ฆ, iswgraph()
๊ฐ ํ๋๋ฅผ ๋ฐํํด์ผ ํจ)๊ฐ์๋ ๊ฒ์ผ๋ก ๋ถ๋ฅ๋์ง๋ง ์์ซ์๊ฐ ์๋๋๋ค (์ฆ, iswalnum()
๋ ์ ๋ก).
์ด ๊ฐ ์ค ํ๋์์ iswalnum ()์ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ๋ autoconf ํ ์คํธ๊ฐ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
ํฌํธ์ FreeBSD ๋ฐ์ด๋๋ฆฌ ํจํค์ง๋ ํ๊ฒ์ด ์๋ ๋ค๋ฅธ libc์ ๋ํด ๋น๋๋์ง ์์ต๋๋ค. ์ด๊ฒ์ ๋ชจ๋ ์ค์ ์๊ฐ ํ ์คํธ๊ฐ ์๋ํ๋ ๋ฐฉ์์ ๊ธฐ์ด๋ฅผ ํ์ฑํฉ๋๋ค.
์ปค๋ฐ๋๋ฉด Linux ๋ฐ OS X์์๋ ๋ถํ์ํ๊ฒ ์์คํ ์ ๊ณต ๊ธฐ๋ฅ์ธ @ krader1961์ด ๋ฌด์๋ฉ๋๋ค.
Fish๋ FreeBSD์ ๊ณต์ libc์ ๋ํด ๋น๋๋๊ณ ๋์ ์ผ๋ก ์ฐ๊ฒฐ๋ฉ๋๋ค.
$ ldd fish
fish:
libncurses.so.8 => /lib/libncurses.so.8 (0x800948000)
libthr.so.3 => /lib/libthr.so.3 (0x800b9c000)
libc++.so.1 => /usr/lib/libc++.so.1 (0x800dc3000)
libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x801082000)
libm.so.5 => /lib/libm.so.5 (0x8012a0000)
libc.so.7 => /lib/libc.so.7 (0x8014cb000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x801885000)
๋ก์ผ์ผ ํ์ ์์คํ ์ ๋์์ด ๋ณ๊ฒฝ๋๋ฉด libc.so ๋ฒ์ ๋ฒํธ๊ฐ ๋ณ๊ฒฝ๋๋ค๋ 100 % ํ์ ์ ๊ฐ์ง๊ณ ๊ณ์ญ๋๊น? ๋๋ ๊ทธ ์ง๋ฌธ์ ํ๊ตฌ ํ ์๊ฐ๋ ์ฑํฅ๋ ์๋ค. ๋๋ ๋ด ์์ ์ด ๋ฌผ๊ณ ๊ธฐ์ ํ๋์ด๋ ์ฑ๋ฅ์ ๋์ ๋๊ฒ ์ํฅ์ ๋ฏธ์น์ง ์๋๋ค๋ ์ ์ ๊ฐ์ํ ๋ ๋ณด์์ ์ ๋๋ค.
๋ก์ผ์ผ ํ์ ์์คํ ์ ๋์์ด ๋ณ๊ฒฝ๋๋ฉด libc.so ๋ฒ์ ๋ฒํธ๊ฐ ๋ณ๊ฒฝ๋๋ค๋ 100 % ํ์ ์ ๊ฐ์ง๊ณ ๊ณ์ญ๋๊น?
"์ฐ๋ฆฌ ๋ฌธ์ ๊ฐ ์๋๋๋ค".
"์ฐ๋ฆฌ ๋ฌธ์ ๊ฐ ์๋๋ค"
๋ฌผ๋ก ๊ทธ๊ฒ์ ์ฐ๋ฆฌ์ ๋ฌธ์ ์
๋๋ค. ์ด๊ฒ์ด ์ฐ๋ฆฌ๊ฐ fish_wcswidth()
๋ฐ ์๋ชป๋ ๊ตฌํ์ ๋ํ ์ ์ฌํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด์๋ ์ด์ ์
๋๋ค.
๋ฒ๊ทธ๋ ctype ํ์ผ์ ์์ฑํ๋ localedef ๋๊ตฌ์ ์์ผ๋ฉฐ Illumos์์ ์์๋์์ต๋๋ค. ์ฌ๊ธฐ์์ DF์ ๊ณ ์ :
https://github.com/DragonFlyBSD/DragonFlyBSD/commit/07ed7d329a83714ec268e2f3ce026bba5a1ac5c2
@jrmarino : ์ ๋ณด ๊ฐ์ฌํฉ๋๋ค! ์ด๊ฒ์ด ์ธ์ ๋ค์ํ OS์ ์ ์ฉ ๋ ์ง ์์ญ๋๊น? DF ๋ณ๊ฒฝ์ด ์ด๋ฏธ ์ฌ์ฉ์์๊ฒ ์ ๋ฌ๋๊ณ ์์ต๋๊น?
FreeBSD์์๋ ์์ ๋์์ต๋๋ค. https://svnweb.freebsd.org/base?view=revision&revision=306782
์นจ๋ก ๊ฐ์ฌํฉ๋๋ค! ๋ฐฉ๊ธ FreeBSD 11.0-RELEASE-p1๋ก ์ ๊ทธ๋ ์ด๋ํ๋๋ฐ ์ด๊ฑด ์ ๋ง ์ง์ฆ๋ฉ๋๋ค. ํจ์น๊ฐ FreeBSD 11.0-RELEASE์ ํตํฉ๋๋์ง ๋๋ ์ธ์ ํตํฉ๋๋์ง ์๊ณ ์์ต๋๊น?
์ฐ๋ฆฌ๋ git head์์ ๋น๋ ๋ ๋ฌผ๊ณ ๊ธฐ์์์ด ๋ฒ๊ทธ๋ฅผ ํด๊ฒฐํฉ๋๋ค. BSD์ git head์์ ๋ฌผ๊ณ ๊ธฐ์ ์ฌ์ ํ ๋ฌธ์ ๊ฐ ์์ผ๋ฉด ์๋ ค์ฃผ์ญ์์ค. ํด๊ฒฐ ๋ฐฉ๋ฒ์ fish 2.3.1 ๋๋ ์ด์ ๋ฆด๋ฆฌ์ค์๋ ์์ง๋ง ํฅํ 2.4.0 ๋ฆด๋ฆฌ์ค์์์ ๊ฒ์ ๋๋ค.
๋ณ๊ฒฝ ์ฌํญ์ ์์ฒด์ ์ผ๋ก ํฌํจ๋์ด ์์ต๋๋ค. ๋ชจ๋ ๊ด๋ฆฌ์๊ฐ ์ฝ๊ฒ ๋ฐฑ ํฌํธ ํ ์ ์์ด์ผํฉ๋๋ค.
์ด๋ฏธ ์ฝ๋ ๊ฒํ ์ค์
๋๋ค.
https://reviews.freebsd.org/D8148
ํฐ.
@shanavar ๋ณ๊ฒฝ ์ฌํญ์ด ๋ค์ ๋ฐฉํด๊ฐ๋๋ฏ๋ก ๋ถ์์ฉ์ด ์๋์ง ํ์ธํ๊ณ ์ถ์ต๋๋ค. ์ผ๋จ ํ์ธ๋๋ฉด 11.0-RELEASE์ ๋ํ ์ ์คํ๋ฅผ ์์ฒญํฉ๋๋ค. ์ฆ, ์ฝ ํ ๋ฌ ์์ ์์ ํ ์ ์์ต๋๋ค.
git์์ Fish๋ฅผ ์ปดํ์ผํ๋ฉด FreeBSD 11.0-RELEASE-p1์์ ์๋ํฉ๋๋ค.
sudo pkg remove fish
sudo pkg install autoconf gmake
git clone [email protected]:fish-shell/fish-shell.git
cd fish-shell
autoconf
./configure
gmake
sudo gmake install
๊ทธ๋ฐ ๋ค์ /usr/local/bin/fish
์ /etc/shells
ํ๊ณ chsh -s fish
๋ฅผ ์คํํ์ฌ ์์ Fish๋ก ๋ณ๊ฒฝํฉ๋๋ค.
๊ทธ๋์ ์ด๋ฌํ ๋ฌธ์ ๋ฅผ ๊ฐ์ง ์ฌ๋์ ๋๋ง์ด ์๋ ์์ต๋๋ค. ์์ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ์ด๊ฒ์ ๋๋ฅผ ๋ฏธ์น๊ฒ ๋ง๋ค์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด FreeBSD ๋ฒ๊ทธ๋ฅผ ์ด์์ต๋๋ค. ์ด ๊นจ์ง ๊ตฌํ์ ์ฌ์ ํ ํด๊ฒฐํด์ผํฉ๋๋ค.