File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed
Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,39 @@ os_opensuse_setsrc (char *option)
4242
4343 chsrc_yield_source_and_confirm (os_opensuse );
4444
45- /* TODO: 实现 Tumbleweed 换源 */
46- chsrc_run_as_bash_file (RAWSTR_os_openSUSE_leap_in_bash );
45+ while (1 ) {
46+ chsrc_note2 ("请选择你的操作系统为:" );
47+ printf ("%s" , R "(
48+ 1. openSUSE Leap
49+ 2. openSUSE Tumbleweed
50+
51+ == > )" );
52+
53+ int choice = 0 ;
54+
55+ /* 接受到一个数字时返回1,非法为0,流结束为-1 */
56+ if (scanf ("%d" , & choice ) != 1 )
57+ {
58+ /* 清除输入缓冲区 */
59+ int ch ;
60+ while ((ch = getchar ()) != '\n' && ch != EOF );
61+ chsrc_error2 ("输入无效!请输入数字" );
62+ continue ;
63+ }
64+ if (choice == 1 )
65+ {
66+ chsrc_run_as_bash_file (RAWSTR_os_openSUSE_leap_in_bash );
67+ }
68+ if (choice == 2 )
69+ {
70+ chsrc_run_as_bash_file (RAWSTR_os_openSUSE_tumbleweed_in_bash );
71+ break ;
72+ }
73+ else
74+ {
75+ chsrc_error2 ("无效的选择,请输入 1 或 2 " );
76+ }
77+ }
4778
4879 chsrc_determine_chgtype (ChgType_Untested );
4980 chsrc_conclude (& source );
You can’t perform that action at this time.
0 commit comments