Don't use '-' in option string to getopt().
@dram reported a build failure in FreeBSD at https://github.com/davidgiven/ack/issues/1#issuecomment-273668299 Linux manual for getopt(3) says: > If the first character of optstring is '-', then each nonoption > argv-element is handled as if it were the argument of an option with > character code 1.... > > The use of '+' and '-' in optstring is a GNU extension. GNU/Linux and OpenBSD handle '-' in this special way, but FreeBSD seems not to. If '-' is not special, then em_ego can't find its input file, so the build must fail. This commit stops using '-' in both em_b and em_ego, but doesn't change mcg. Also fix em_ego -O3 to not act like -O4.
This commit is contained in:
parent
59b3c10563
commit
50a7031007
|
@ -34,12 +34,19 @@ init(char *s, int val)
|
||||||
np->offset = val;
|
np->offset = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
error("Usage: em_b [-w wordsize] [-B modulename] [-i inputfile] [-o outputfile]");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int opt = getopt(argc, argv, "-w:B:i:o:");
|
int opt = getopt(argc, argv, "w:B:i:o:");
|
||||||
if (opt == -1)
|
if (opt == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -66,11 +73,12 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
derfault:
|
default:
|
||||||
error("Usage: em_b [-w wordsize] [-B modulename] [-i inputfile] [-o outputfile]");
|
usage();
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (optind < argc)
|
||||||
|
usage();
|
||||||
|
|
||||||
init("auto", AUTO);
|
init("auto", AUTO);
|
||||||
init("extrn", EXTERN);
|
init("extrn", EXTERN);
|
||||||
|
|
|
@ -346,7 +346,7 @@ int main(int argc, char* argv[])
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int opt = getopt(argc, argv, "-M:P:O:vt");
|
int opt = getopt(argc, argv, "M:P:O:vt");
|
||||||
if (opt == -1)
|
if (opt == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -364,17 +364,14 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int o = atoi(optarg);
|
int o = atoi(optarg);
|
||||||
if (o <= 2)
|
if (o <= 2)
|
||||||
break;
|
Ophase = &O2phases[0];
|
||||||
if (o <= 3)
|
else if (o == 3)
|
||||||
Ophase = &O3phases[0];
|
Ophase = &O3phases[0];
|
||||||
|
else
|
||||||
Ophase = &O4phases[0];
|
Ophase = &O4phases[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1:
|
|
||||||
add_file(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
keeptemps = 1;
|
keeptemps = 1;
|
||||||
goto addopt;
|
goto addopt;
|
||||||
|
@ -390,6 +387,9 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = optind; i < argc; i++)
|
||||||
|
add_file(argv[i]);
|
||||||
|
|
||||||
phase_args[nphase_args] = 0;
|
phase_args[nphase_args] = 0;
|
||||||
if (nuphases)
|
if (nuphases)
|
||||||
Ophase = uphases;
|
Ophase = uphases;
|
||||||
|
|
Loading…
Reference in a new issue