for ( argp = argv+1 ; *argp ; argp++ ) {
if ( **argp == '-' ) {
opt = *argp + 1;
if ( !*opt )
usage();
while ( *opt ) {
switch ( *opt ) {
case 's': /* Use "safe, slow and stupid" code */
stupid = 1;
break;
case 'r': /* RAID mode */
raid_mode = 1;
break;
case 'f': /* Force install */
force = 1;
break;
case 'm': /* Install MBR */
mbr = 1;
break;
case 'a': /* Mark this partition active */
setactive = 1;
break;
case 'd':
if ( argp[1] )
subdir = *++argp;
break;
default:
usage();
break;
}
opt++;
}
} else {
if ( bootsecfile )
usage();
else if ( drive )
bootsecfile = *argp;
else
drive = *argp;
}
}
另类设置程序参数
命令行参数解析
最新推荐文章于 2025-09-28 09:11:50 发布
2216

被折叠的 条评论
为什么被折叠?



