1
0
mirror of https://github.com/golang/go synced 2024-11-22 02:54:39 -07:00

5a, 6a, 8a, cc: remove old environment variables

Uses of $INCLUDE and $NPROC are left over from Plan 9.
Remove them to avoid causing confusion.

R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4445079
This commit is contained in:
Russ Cox 2011-05-02 11:24:32 -04:00
parent ef94520380
commit a46a311dec
4 changed files with 16 additions and 201 deletions

View File

@ -50,7 +50,7 @@ void
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *p; char *p;
int nout, nproc, i, c; int c;
thechar = '5'; thechar = '5';
thestring = "arm"; thestring = "arm";
@ -94,46 +94,10 @@ main(int argc, char *argv[])
print("usage: %ca [-options] file.s\n", thechar); print("usage: %ca [-options] file.s\n", thechar);
errorexit(); errorexit();
} }
if(argc > 1 && systemtype(Windows)){ if(argc > 1){
print("can't assemble multiple files on windows\n"); print("can't assemble multiple files\n");
errorexit(); errorexit();
} }
if(argc > 1 && !systemtype(Windows)) {
nproc = 1;
if(p = getenv("NPROC"))
nproc = atol(p); /* */
c = 0;
nout = 0;
for(;;) {
Waitmsg *w;
while(nout < nproc && argc > 0) {
i = fork();
if(i < 0) {
fprint(2, "fork: %r\n");
errorexit();
}
if(i == 0) {
print("%s:\n", *argv);
if(assemble(*argv))
errorexit();
exits(0);
}
nout++;
argc--;
argv++;
}
w = wait();
if(w == nil) {
if(c)
errorexit();
exits(0);
}
if(w->msg[0])
c++;
nout--;
}
}
if(assemble(argv[0])) if(assemble(argv[0]))
errorexit(); errorexit();
exits(0); exits(0);
@ -142,7 +106,7 @@ main(int argc, char *argv[])
int int
assemble(char *file) assemble(char *file)
{ {
char *ofile, incfile[20], *p; char *ofile, *p;
int i, of; int i, of;
ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
@ -167,15 +131,6 @@ assemble(char *file)
} else } else
outfile = "/dev/null"; outfile = "/dev/null";
} }
p = getenv("INCLUDE");
if(p) {
setinclude(p);
} else {
if(systemtype(Plan9)) {
sprint(incfile,"/%s/include", thestring);
setinclude(strdup(incfile));
}
}
of = create(outfile, OWRITE, 0664); of = create(outfile, OWRITE, 0664);
if(of < 0) { if(of < 0) {

View File

@ -56,7 +56,7 @@ void
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *p; char *p;
int nout, nproc, i, c; int c;
thechar = '6'; thechar = '6';
thestring = "amd64"; thestring = "amd64";
@ -96,46 +96,10 @@ main(int argc, char *argv[])
print("usage: %ca [-options] file.s\n", thechar); print("usage: %ca [-options] file.s\n", thechar);
errorexit(); errorexit();
} }
if(argc > 1 && systemtype(Windows)){ if(argc > 1){
print("can't assemble multiple files on windows\n"); print("can't assemble multiple files\n");
errorexit(); errorexit();
} }
if(argc > 1 && !systemtype(Windows)) {
nproc = 1;
if(p = getenv("NPROC"))
nproc = atol(p); /* */
c = 0;
nout = 0;
for(;;) {
Waitmsg *w;
while(nout < nproc && argc > 0) {
i = fork();
if(i < 0) {
fprint(2, "fork: %r\n");
errorexit();
}
if(i == 0) {
print("%s:\n", *argv);
if(assemble(*argv))
errorexit();
exits(0);
}
nout++;
argc--;
argv++;
}
w = wait();
if(w == nil) {
if(c)
errorexit();
exits(0);
}
if(w->msg[0])
c++;
nout--;
}
}
if(assemble(argv[0])) if(assemble(argv[0]))
errorexit(); errorexit();
exits(0); exits(0);
@ -144,7 +108,7 @@ main(int argc, char *argv[])
int int
assemble(char *file) assemble(char *file)
{ {
char *ofile, incfile[20], *p; char *ofile, *p;
int i, of; int i, of;
ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
@ -169,15 +133,6 @@ assemble(char *file)
} else } else
outfile = "/dev/null"; outfile = "/dev/null";
} }
p = getenv("INCLUDE");
if(p) {
setinclude(p);
} else {
if(systemtype(Plan9)) {
sprint(incfile,"/%s/include", thestring);
setinclude(strdup(incfile));
}
}
of = create(outfile, OWRITE, 0664); of = create(outfile, OWRITE, 0664);
if(of < 0) { if(of < 0) {

View File

@ -56,7 +56,7 @@ void
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *p; char *p;
int nout, nproc, i, c; int c;
thechar = '8'; thechar = '8';
thestring = "386"; thestring = "386";
@ -96,46 +96,10 @@ main(int argc, char *argv[])
print("usage: %ca [-options] file.s\n", thechar); print("usage: %ca [-options] file.s\n", thechar);
errorexit(); errorexit();
} }
if(argc > 1 && systemtype(Windows)){ if(argc > 1){
print("can't assemble multiple files on windows\n"); print("can't assemble multiple files\n");
errorexit(); errorexit();
} }
if(argc > 1 && !systemtype(Windows)) {
nproc = 1;
if(p = getenv("NPROC"))
nproc = atol(p); /* */
c = 0;
nout = 0;
for(;;) {
Waitmsg *w;
while(nout < nproc && argc > 0) {
i = fork();
if(i < 0) {
fprint(2, "fork: %r\n");
errorexit();
}
if(i == 0) {
print("%s:\n", *argv);
if(assemble(*argv))
errorexit();
exits(0);
}
nout++;
argc--;
argv++;
}
w = wait();
if(w == nil) {
if(c)
errorexit();
exits(0);
}
if(w->msg[0])
c++;
nout--;
}
}
if(assemble(argv[0])) if(assemble(argv[0]))
errorexit(); errorexit();
exits(0); exits(0);
@ -144,7 +108,7 @@ main(int argc, char *argv[])
int int
assemble(char *file) assemble(char *file)
{ {
char *ofile, incfile[20], *p; char *ofile, *p;
int i, of; int i, of;
ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
@ -169,15 +133,6 @@ assemble(char *file)
} else } else
outfile = "/dev/null"; outfile = "/dev/null";
} }
p = getenv("INCLUDE");
if(p) {
setinclude(p);
} else {
if(systemtype(Plan9)) {
sprint(incfile,"/%s/include", thestring);
setinclude(strdup(incfile));
}
}
of = create(outfile, OWRITE, 0664); of = create(outfile, OWRITE, 0664);
if(of < 0) { if(of < 0) {

View File

@ -88,7 +88,7 @@ void
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char **defs, *p; char **defs, *p;
int nproc, nout, i, c, ndef; int c, ndef;
ensuresymb(NSYMB); ensuresymb(NSYMB);
memset(debug, 0, sizeof(debug)); memset(debug, 0, sizeof(debug));
@ -142,51 +142,10 @@ main(int argc, char *argv[])
print("usage: %cc [-options] files\n", thechar); print("usage: %cc [-options] files\n", thechar);
errorexit(); errorexit();
} }
if(argc > 1 && systemtype(Windows)){ if(argc > 1){
print("can't compile multiple files on windows\n"); print("can't compile multiple files\n");
errorexit(); errorexit();
} }
if(argc > 1 && !systemtype(Windows)) {
nproc = 1;
/*
* if we're writing acid to standard output, don't compile
* concurrently, to avoid interleaving output.
*/
if(((!debug['a'] && !debug['q'] && !debug['Q']) || debug['n']) &&
(p = getenv("NPROC")) != nil)
nproc = atol(p); /* */
c = 0;
nout = 0;
for(;;) {
Waitmsg *w;
while(nout < nproc && argc > 0) {
i = fork();
if(i < 0) {
print("cannot create a process\n");
errorexit();
}
if(i == 0) {
fprint(2, "%s:\n", *argv);
if (compile(*argv, defs, ndef))
errorexit();
exits(0);
}
nout++;
argc--;
argv++;
}
w = wait();
if(w == nil) {
if(c)
errorexit();
exits(0);
}
if(w->msg[0])
c++;
nout--;
}
}
if(argc == 0) if(argc == 0)
c = compile("stdin", defs, ndef); c = compile("stdin", defs, ndef);
@ -201,7 +160,7 @@ main(int argc, char *argv[])
int int
compile(char *file, char **defs, int ndef) compile(char *file, char **defs, int ndef)
{ {
char *ofile, incfile[20]; char *ofile;
char *p, **av, opt[256]; char *p, **av, opt[256];
int i, c, fd[2]; int i, c, fd[2];
static int first = 1; static int first = 1;
@ -236,15 +195,6 @@ compile(char *file, char **defs, int ndef)
outfile = "/dev/null"; outfile = "/dev/null";
} }
if(p = getenv("INCLUDE")) {
setinclude(p);
} else {
if(systemtype(Plan9)) {
sprint(incfile, "/%s/include", thestring);
setinclude(strdup(incfile));
setinclude("/sys/include");
}
}
if (first) if (first)
Binit(&diagbuf, 1, OWRITE); Binit(&diagbuf, 1, OWRITE);
/* /*