gengetopt-to-shell.pl

来自「Path MPICH-V for MPICH the MPI Implement」· PL 代码 · 共 45 行

PL
45
字号
#!/usr/bin/perl -wopen(GGO, "<$ARGV[0]") or die "could not open $ARGV[0] : $!\n";print "#!/bin/sh\n";print "\n";print "case \$arg in\n";$help="";while(<GGO>){    $line = $_;    next if($line =~ /\"n-procs\"/);    if(($opt, $commentary) = ($line =~ /^option +\"([^\"]*)\" +. +\"([^\"]*)\" +flag/) )    {	print "    -chv-$opt)\n";	print "       chvOptions=\"\$chvOptions --$opt\"\n";	$opt =~ s/-/_/g;	print "       chv_$opt=\"1\"\n";	print "       device_knows_arg=1\n";	print "    ;;\n";	$help .= "  -chv-$opt\n    $commentary\n";    } elsif( ($opt, $commentary, $typestr) = ($line =~ /^option +\"([^\"]*)\" +. +\"([^\"]*)\".*typestr=\"([^\"]*)\"/) )    {	print "    -chv-$opt)\n";	print "       chvOptions=\"\$chvOptions --$opt=\\\"\$1\\\"\"\n";	$opt =~ s/-/_/g;	print "       chv_$opt=\"\$1\"\n";	print "       shift;\n";	print "       device_knows_arg=1\n";	print "    ;;\n";	$help .= "  -chv-$opt <$typestr>\n    $commentary\n";    } } print "    -usage | --usage)\n";print "cat <<EOF\n";print "  Special Options for ch_v device\n";print "$help\n";print "EOF\n";print "esac\n";close(GGO);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?