summaryrefslogtreecommitdiff
path: root/usr.bin/pcc
diff options
context:
space:
mode:
authorStefan Kempf <stefan@cvs.openbsd.org>2007-11-10 22:11:23 +0000
committerStefan Kempf <stefan@cvs.openbsd.org>2007-11-10 22:11:23 +0000
commitc2c4f740efb53d8e3a2c87779660764a71a49dc0 (patch)
tree1cefb684c9deb254f240912079116fb3359dc57c /usr.bin/pcc
parent1b590215e6c6490a915ccc04cb7c3683dadc1c37 (diff)
Pull from master repo:
Get rid of ifdef'd out code. Replace nodup() call with equivalent code at its only invocation. ok ragge@, otto@
Diffstat (limited to 'usr.bin/pcc')
-rw-r--r--usr.bin/pcc/cc/cc.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/usr.bin/pcc/cc/cc.c b/usr.bin/pcc/cc/cc.c
index d4648524640..6f5d153fffc 100644
--- a/usr.bin/pcc/cc/cc.c
+++ b/usr.bin/pcc/cc/cc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cc.c,v 1.10 2007/11/02 21:07:52 millert Exp $ */
+/* $OpenBSD: cc.c,v 1.11 2007/11/10 22:11:22 stefan Exp $ */
/*
* Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
*
@@ -85,7 +85,6 @@ int getsuf(char *);
int main(int, char *[]);
void error(char *, ...);
void errorx(int, char *, ...);
-int nodup(char **, char *);
int callsys(char [], char *[]);
int cunlink(char *);
void dexit(int);
@@ -341,7 +340,13 @@ main(int argc, char *argv[])
}
t = setsuf(t, 'o');
}
- if (nodup(llist, t)) {
+
+ /* Check for duplicate .o files. */
+ for (j = getsuf(t) == 'o' ? 0 : nl; j < nl; j++) {
+ if (strcmp(llist[j], t) == 0)
+ break;
+ }
+ if (j == nl) {
llist[nl++] = t;
if (nl >= MAXLIB)
{
@@ -360,17 +365,6 @@ main(int argc, char *argv[])
errorx(8, "-o given with -c || -E || -S and more than one file");
if (outfile && clist[0] && strcmp(outfile, clist[0]) == 0)
errorx(8, "output file will be clobbered");
-#if 0
- for(i=0, j=0; i<nc; i++) {
- if((c=getsuf(clist[i]))=='c' || c=='S') {
- j++;
- break;
- }
- }
- if (j==0 && Eflag)
- errorx(8, "no file to be preprocessed");
-#endif
-
if (gflag) Oflag = 0;
#if 0
if (proflag)
@@ -741,26 +735,6 @@ copy(char *as)
}
int
-nodup(char **l, char *os)
-{
- register char *t, *s;
- register int c;
-
- s = os;
- if (getsuf(s) != 'o')
- return(1);
- while((t = *l++)) {
- while((c = *s++))
- if (c != *t++)
- break;
- if (*t=='\0' && c=='\0')
- return(0);
- s = os;
- }
- return(1);
-}
-
-int
cunlink(char *f)
{
if (f==0 || Xflag)