Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20060713100947

Diff

Diff from 1.47 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/cc/cc/cc.c

Annotated File View

ragge
1.47
1 /*      $Id: cc.c,v 1.47 2006/07/13 10:09:47 ragge Exp $        */
ragge
1.3
2 /*
3  * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * Redistributions of source code and documentation must retain the above
10  * copyright notice, this list of conditions and the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditionsand the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * All advertising materials mentioning features or use of this software
15  * must display the following acknowledgement:
16  *      This product includes software developed or owned by Caldera
17  *      International, Inc.
18  * Neither the name of Caldera International, Inc. nor the names of other
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23  * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27  * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
ragge
1.2
35
ragge
1.1
36 /*
ragge
1.3
37  * Front-end to the C compiler.
ragge
1.18
38  *
39  * Brief description of its syntax:
40  * - Files that end with .c are passed via cpp->ccom->as->ld
41  * - Files that end with .s are passed as->ld
42  * - Files that end with .o are passed directly to ld
43  * - Multiple files may be given on the command line.
44  * - Unrecognized options are all sent directly to ld.
45  * -c or -S cannot be combined with -o if multiple files are given.
46  *
47  * This file should be rewritten readable.
ragge
1.1
48  */
ragge
1.9
49 #include <sys/types.h>
ragge
1.36
50 #include <sys/wait.h>
ragge
1.2
51
ragge
1.1
52 #include <stdio.h>
53 #include <ctype.h>
54 #include <signal.h>
ragge
1.4
55 #include <string.h>
56 #include <fcntl.h>
57 #include <unistd.h>
58 #include <stdlib.h>
ragge
1.36
59 #include <stdarg.h>
60 #include <libgen.h>
pj
1.38
61 #include <errno.h>
ragge
1.24
62
ragge
1.39
63 #include "../../config.h"
64
ragge
1.24
65 #include "ccconfig.h"
ragge
1.3
66 /* C command */
ragge
1.1
67
ragge
1.20
68 #define MKS(x) _MKS(x)
69 #define _MKS(x) #x
70
71 /*
72  * Many specific definitions, should be declared elsewhere.
73  */
74 #define STDINC    "/usr/include"
75
ragge
1.3
76 #define SBSIZE 10000
ragge
1.12
77 #define MAXINC 100
ragge
1.3
78 #define MAXFIL 100
ragge
1.12
79 #define MAXLIB 10000
ragge
1.14
80 #define MAXAV  10000
ragge
1.3
81 #define MAXOPT 100
82 char    *tmp3;
83 char    *tmp4;
ragge
1.1
84 char    *outfile;
pj
1.31
85 char *copy(char *as),*setsuf(char *aschar ch);
ragge
1.4
86 int getsuf(char []);
87 int main(intchar *[]);
ragge
1.36
88 void error(char *, ...);
89 void errorx(int evalchar *, ...);
ragge
1.4
90 int nodup(char **, char *);
91 int callsys(char [], char *[]);
92 int cunlink(char *);
ragge
1.36
93 void dexit(int eval);
ragge
1.4
94 void idexit(int);
pj
1.30
95 char *gettmp();
ragge
1.14
96 char    *av[MAXAV];
ragge
1.3
97 char    *clist[MAXFIL];
98 char    *llist[MAXLIB];
ragge
1.4
99 char    alist[20];
ragge
1.43
100 char    *xlist[100];
101 int     xnum;
102 int     dflag;
ragge
1.3
103 int     pflag;
104 int     sflag;
105 int     cflag;
106 int     eflag;
107 int     gflag;
ragge
1.5
108 int     vflag;
ragge
1.7
109 int     tflag;
ragge
1.8
110 int     Eflag;
ragge
1.4
111 int     Oflag;
ragge
1.3
112 int     proflag;
ragge
1.1
113 int     exfail;
ragge
1.10
114 int     Xflag;
ragge
1.14
115 int     nostartfilesBstatic;
ragge
1.20
116 int     nostdinc;
ragge
1.43
117 int     onlyas;
ragge
1.14
118
ragge
1.23
119 char    *pass0 = LIBEXECDIR "/ccom";
120 char    *passp = LIBEXECDIR "/cpp";
ragge
1.47
121 char    *Bflag;
ragge
1.20
122 char    *sysinc;
ragge
1.25
123 char *cppadd[] = CPPADD;
124 char *dynlinker[] = DYNLINKER;
125 char *crt0file = CRT0FILE;
126 char *startfiles[] = STARTFILES;
127 char *endfiles[] = ENDFILES;
128 char *cppmdadd[] = CPPMDADD;
ragge
1.1
129
ragge
1.4
130 int
pj
1.26
131 main(int argcchar *argv[])
132 {
ragge
1.15
133         char *t, *u;
ragge
1.1
134         char *assource;
ragge
1.3
135         char **pv, *ptemp[MAXOPT], **pvt;
ragge
1.36
136         int ncnlijcnxona;
ragge
1.3
137
ragge
1.36
138         i = nc = nl = nxo = 0;
ragge
1.3
139         pv = ptemp;
140         while(++i < argc) {
ragge
1.18
141                 if (argv[i][0] == '-')
142                 switch (argv[i][1]) {
ragge
1.3
143                 default:
144                         goto passa;
ragge
1.22
145
ragge
1.47
146                 case 'B'/* other search paths for binaries */
147                         Bflag = &argv[i][2];
ragge
1.22
148                         break;
149
ragge
1.10
150                 case 'X':
151                         Xflag++;
152                         break;
ragge
1.15
153                 case 'W'/* Ignore (most of) W-flags */
154                         if (strncmp(argv[i], "-Wl,"4) == 0) {
155                                 /* options to the linker */
156                                 t = &argv[i][4];
157                                 while ((u = strchr(t','))) {
158                                         *u++ = 0;
159                                         llist[nl++] = t;
160                                         t = u;
161                                 }
162                                 llist[nl++] = t;
163                         }
164                         break;
165
ragge
1.6
166                 case 'f'/* Ignore -ffreestanding */
167                         break;
ragge
1.14
168
ragge
1.25
169                 case 'g'/* create debug output */
170                         gflag++;
171                         break;
172
ragge
1.20
173                 case 'i':
174                         if (strcmp(argv[i], "-isystem") == 0) {
175                                 sysinc = argv[++i];
176                         } else
177                                 goto passa;
178                         break;
179
ragge
1.14
180                 case 'n'/* handle -n flags */
181                         if (strcmp(argv[i], "-nostdinc") == 0)
ragge
1.20
182                                 nostdinc++;
ragge
1.14
183                         else if (strcmp(argv[i], "-nostartfiles") == 0)
184                                 nostartfiles = 1;
185                         else
186                                 goto passa;
187                         break;
188
ragge
1.7
189                 case 'x':
ragge
1.43
190                         xlist[xnum++] = argv[i];
ragge
1.7
191                         break;
192                 case 't':
193                         tflag++;
194                         break;
ragge
1.1
195                 case 'S':
196                         sflag++;
197                         cflag++;
ragge
1.3
198                         break;
ragge
1.1
199                 case 'o':
ragge
1.18
200                         if (outfile)
ragge
1.36
201                                 errorx(8"too many -o");
ragge
1.18
202                         outfile = argv[++i];
ragge
1.3
203                         break;
ragge
1.1
204                 case 'O':
ragge
1.4
205                         Oflag++;
ragge
1.3
206                         break;
ragge
1.1
207                 case 'p':
208                         proflag++;
ragge
1.3
209                         break;
ragge
1.1
210                 case 'E':
ragge
1.8
211                         Eflag++;
212                         break;
ragge
1.1
213                 case 'P':
214                         pflag++;
ragge
1.3
215                         *pv++ = argv[i];
ragge
1.1
216                 case 'c':
217                         cflag++;
ragge
1.3
218                         break;
219
ragge
1.24
220 #if 0
ragge
1.3
221                 case '2':
222                         if(argv[i][2] == '\0')
223                                 pref = "/lib/crt2.o";
224                         else {
225                                 pref = "/lib/crt20.o";
226                         }
227                         break;
ragge
1.24
228 #endif
ragge
1.1
229                 case 'D':
230                 case 'I':
231                 case 'U':
232                 case 'C':
ragge
1.20
233                         *pv++ = argv[i];
ragge
1.3
234                         if (pv >= ptemp+MAXOPT)
235                                 {
ragge
1.36
236                                 error("Too many DIUC options");
ragge
1.3
237                                 --pv;
238                                 }
239                         break;
240
ragge
1.1
241                 case 'd':
ragge
1.3
242                         dflag++;
ragge
1.4
243                         strncpy(alistargv[i], 19);
ragge
1.3
244                         break;
ragge
1.5
245                 case 'v':
ragge
1.39
246                         printf("%s\n"VERSSTR);
ragge
1.5
247                         vflag++;
248                         break;
ragge
1.14
249
250                 case 's':
251                         if (strcmp(argv[i], "-static") == 0)
252                                 Bstatic = 1;
253                         else
254                                 goto passa;
255                         break;
ragge
1.3
256                 } else {
257                 passa:
258                         t = argv[i];
ragge
1.11
259                         if (*argv[i] == '-' && argv[i][1] == 'L')
260                                 ;
261                         else if((c=getsuf(t))=='c' || c=='s'|| Eflag) {
ragge
1.3
262                                 clist[nc++] = t;
263                                 if (nc>=MAXFIL)
264                                         {
ragge
1.36
265                                         error("Too many source files");
ragge
1.3
266                                         exit(1);
267                                         }
268                                 t = setsuf(t'o');
269                         }
270                         if (nodup(llistt)) {
271                                 llist[nl++] = t;
272                                 if (nl >= MAXLIB)
273                                         {
ragge
1.36
274                                         error("Too many object/library files");
ragge
1.3
275                                         exit(1);
276                                         }
277                                 if (getsuf(t)=='o')
278                                         nxo++;
ragge
1.1
279                         }
280                 }
281         }
ragge
1.18
282         /* Sanity checking */
283         if (nc == 0 && nl == 0)
ragge
1.36
284                 errorx(8"no input files");
ragge
1.18
285         if (outfile && (cflag || sflag) && nc > 1)
ragge
1.36
286                 errorx(8"-o given with -c || -S and more than one file");
ragge
1.19
287         if (outfile && clist[0] && strcmp(outfileclist[0]) == 0)
ragge
1.36
288                 errorx(8"output file will be clobbered");
ragge
1.18
289
ragge
1.4
290         if (gflagOflag = 0;
ragge
1.24
291 #if 0
292         if (proflag)
ragge
1.3
293                 pref = "/lib/mcrt0.o";
ragge
1.24
294 #endif
ragge
1.3
295         if(nc==0)
296                 goto nocom;
297         if (pflag==0) {
pj
1.30
298                 tmp3 = gettmp();
299                 tmp4 = gettmp();
ragge
1.1
300         }
ragge
1.3
301         if (signal(SIGINTSIG_IGN) != SIG_IGN/* interrupt */
ragge
1.1
302                 signal(SIGINTidexit);
ragge
1.3
303         if (signal(SIGTERMSIG_IGN) != SIG_IGN)        /* terminate */
ragge
1.1
304                 signal(SIGTERMidexit);
ragge
1.3
305         pvt = pv;
ragge
1.1
306         for (i=0i<nci++) {
ragge
1.18
307                 /*
308                  * C preprocessor
309                  */
ragge
1.37
310                 if (nc>1 && !Eflag)
ragge
1.1
311                         printf("%s:\n"clist[i]);
ragge
1.43
312                 onlyas = 0;
pj
1.32
313                 assource = tmp3;
ragge
1.3
314                 if (getsuf(clist[i])=='s') {
ragge
1.1
315                         assource = clist[i];
ragge
1.43
316                         onlyas = 1;
317                         goto assemble;
318                 } else if (getsuf(clist[i])=='S') {
319                         assource = clist[i];
320                         onlyas = 1;
pj
1.32
321                 }
ragge
1.1
322                 if (pflag)
323                         tmp4 = setsuf(clist[i], 'i');
ragge
1.5
324                 na = 0;
325                 av[na++] = "cpp";
ragge
1.20
326                 av[na++] = "-D__PCC__=" MKS(PCC_MAJOR);
ragge
1.40
327                 av[na++] = "-D__PCC_MINOR__=" MKS(PCC_MINOR);
328                 av[na++] = "-D__PCC_MINORMINOR__=" MKS(PCC_MINORMINOR);
ragge
1.20
329                 if (!nostdinc)
ragge
1.21
330                         av[na++] = "-S"av[na++] = STDINC;
ragge
1.20
331                 if (sysinc)
332                         av[na++] = "-S"av[na++] = sysinc;
ragge
1.5
333                 for (j = 0cppadd[j]; j++)
334                         av[na++] = cppadd[j];
ragge
1.24
335                 for (j = 0cppmdadd[j]; j++)
336                         av[na++] = cppmdadd[j];
ragge
1.7
337                 if (tflag)
ragge
1.20
338                         av[na++] = "-t";
ragge
1.7
339                 for(pv=ptemppv <pvtpv++)
340                         av[na++] = *pv;
ragge
1.5
341                 av[na++] = clist[i];
ragge
1.20
342                 if (!Eflag)
343                         av[na++] = tmp4;
ragge
1.3
344                 av[na++]=0;
345                 if (callsys(passpav))
346                         {exfail++; eflag++;}
ragge
1.11
347                 if (Eflag)
ragge
1.37
348                         continue;
ragge
1.43
349                 if (onlyas)
ragge
1.7
350                         goto assemble;
ragge
1.18
351
352                 /*
353                  * C compiler
354                  */
ragge
1.25
355                 na = 0;
356                 av[na++]= "ccom";
357                 if (gflag)
358                         av[na++] = "-g";
ragge
1.44
359                 if (Oflag) {
360                         av[na++] = "-xtemps";
361                 }
ragge
1.45
362                 for (j = 0j < xnumj++)
363                         av[na++] = xlist[j];
ragge
1.25
364                 av[na++] = tmp4;
ragge
1.3
365                 if (pflag || exfail)
366                         {
ragge
1.1
367                         cflag++;
368                         continue;
ragge
1.3
369                         }
ragge
1.16
370                 if(sflag) {
371                         if (outfile)
372                                 assource = tmp3 = outfile;
373                         else
374                                 assource = tmp3 = setsuf(clist[i], 's');
375                 }
ragge
1.25
376                 av[na++] = tmp3;
377 #if 0
ragge
1.3
378                 if (proflag) {
379                         av[3] = "-XP";
380                         av[4] = 0;
381                 } else
382                         av[3] = 0;
ragge
1.25
383 #endif
384                 av[na++] = NULL;
ragge
1.3
385                 if (callsys(pass0av)) {
ragge
1.1
386                         cflag++;
387                         eflag++;
388                         continue;
389                 }
390                 if (sflag)
391                         continue;
ragge
1.18
392
393                 /*
394                  * Assembler
395                  */
ragge
1.1
396         assemble:
ragge
1.3
397                 av[0] = "as";
398                 av[1] = "-o";
ragge
1.18
399                 if (outfile && cflag)
400                         av[2] = outfile;
401                 else
402                         av[2] = setsuf(clist[i], 'o');
ragge
1.43
403                 av[3] = onlyas ? tmp4 : assource;
ragge
1.3
404                 if (dflag) {
405                         av[4] = alist;
406                         av[5] = 0;
407                 } else
408                         av[4] = 0;
ragge
1.21
409                 if (callsys("/bin/as"av)) {
ragge
1.1
410                         cflag++;
411                         eflag++;
ragge
1.7
412                         cunlink(tmp4);
ragge
1.1
413                         continue;
414                 }
ragge
1.7
415                 cunlink(tmp4);
ragge
1.1
416         }
ragge
1.18
417
ragge
1.37
418         if (Eflag)
419                 dexit(eflag);
420
ragge
1.18
421         /*
422          * Linker
423          */
ragge
1.1
424 nocom:
425         if (cflag==0 && nl!=0) {
ragge
1.6
426                 j = 0;
427                 av[j++] = "ld";
428                 av[j++] = "-X";
429                 av[j++] = "-d";
430                 av[j++] = "-e";
431                 av[j++] = "__start";
ragge
1.14
432                 if (Bstatic == 0) { /* Dynamic linkage */
ragge
1.24
433                         for (i = 0dynlinker[i]; i++)
434                                 av[j++] = dynlinker[i];
ragge
1.14
435                 }
ragge
1.1
436                 if (outfile) {
ragge
1.3
437                         av[j++] = "-o";
438                         av[j++] = outfile;
439                 }
ragge
1.14
440                 if (!nostartfiles) {
ragge
1.24
441                         av[j++] = crt0file;
442                         for (i = 0startfiles[i]; i++)
443                                 av[j++] = startfiles[i];
ragge
1.14
444                 }
ragge
1.24
445                 i = 0;
ragge
1.14
446                 while(i<nl) {
ragge
1.3
447                         av[j++] = llist[i++];
ragge
1.14
448                         if (j >= MAXAV)
ragge
1.36
449                                 error("Too many ld options");
ragge
1.14
450                 }
ragge
1.11
451 #if 0
ragge
1.3
452                 if (gflag)
453                         av[j++] = "-lg";
ragge
1.11
454 #endif
ragge
1.6
455                 av[j++] = "-lc";
ragge
1.14
456                 if (!nostartfiles) {
ragge
1.24
457                         for (i = 0endfiles[i]; i++)
458                                 av[j++] = endfiles[i];
ragge
1.14
459                 }
ragge
1.3
460                 av[j++] = 0;
461                 eflag |= callsys("/bin/ld"av);
ragge
1.1
462                 if (nc==1 && nxo==1 && eflag==0)
ragge
1.3
463                         cunlink(setsuf(clist[0], 'o'));
ragge
1.46
464                 else if (nc > 0 && eflag == 0) {
465                         /* remove .o files XXX ugly */
466                         for (i = 0i < nci++)
467                                 cunlink(setsuf(clist[i], 'o'));
468                 }
ragge
1.1
469         }
ragge
1.36
470         dexit(eflag);
ragge
1.4
471         return 0;
ragge
1.1
472 }
473
ragge
1.36
474 /*
475  * exit and cleanup after interrupt.
476  */
ragge
1.4
477 void
478 idexit(int arg)
ragge
1.1
479 {
ragge
1.36
480         dexit(100);
ragge
1.1
481 }
482
ragge
1.36
483 /*
484  * exit and cleanup.
485  */
ragge
1.4
486 void
ragge
1.36
487 dexit(int eval)
ragge
1.1
488 {
ragge
1.10
489         if (!pflag && !Xflag) {
ragge
1.1
490                 if (sflag==0)
491                         cunlink(tmp3);
492                 cunlink(tmp4);
493         }
ragge
1.36
494         exit(eval);
ragge
1.1
495 }
496
ragge
1.36
497 static void
498 ccerror(char *sva_list ap)
ragge
1.1
499 {
ragge
1.36
500         vfprintf(Eflag ? stderr : stdoutsap);
ragge
1.8
501         putc('\n'Eflagstderr : stdout);
ragge
1.1
502         exfail++;
503         cflag++;
504         eflag++;
505 }
506
ragge
1.36
507 /*
508  * complain a bit.
509  */
510 void
511 error(char *s, ...)
512 {
513         va_list ap;
514
515         va_start(aps);
516         ccerror(sap);
517         va_end(ap);
518 }
519
520 /*
521  * complain a bit and then exit.
522  */
ragge
1.18
523 void
ragge
1.36
524 errorx(int evalchar *s, ...)
ragge
1.18
525 {
ragge
1.36
526         va_list ap;
527
528         va_start(aps);
529         ccerror(sap);
530         va_end(ap);
531         dexit(eval);
ragge
1.18
532 }
ragge
1.3
533
ragge
1.4
534 int
ragge
1.3
535 getsuf(as)
536 char as[];
ragge
1.1
537 {
538         register char *s;
539
ragge
1.4
540         if ((s = strrchr(as'.')) && s[1] != '\0' && s[2] == '\0')
541                 return s[1];
ragge
1.3
542         return(0);
ragge
1.1
543 }
544
ragge
1.36
545 /*
546  * Get basename of string s and change its suffix to ch.
547  */
ragge
1.1
548 char *
ragge
1.36
549 setsuf(char *schar ch)
ragge
1.1
550 {
ragge
1.36
551         s = copy(basename(s));
pj
1.31
552         s[strlen(s) - 1] = ch;
ragge
1.36
553         return(s);
ragge
1.1
554 }
555
ragge
1.4
556 int
ragge
1.3
557 callsys(fv)
558 char f[], *v[]; {
ragge
1.1
559         int tstatus;
ragge
1.4
560         char *s;
ragge
1.5
561
562         if (vflag) {
ragge
1.41
563                 fprintf(stderr"%s "f);
564                 for (t = 1v[t]; t++)
ragge
1.6
565                         fprintf(stderr"%s "v[t]);
566                 fprintf(stderr"\n");
ragge
1.5
567         }
ragge
1.1
568
ragge
1.3
569         if ((t=fork())==0) {
ragge
1.47
570                 if (Bflag) {
571                         char *a = malloc(strlen(Bflag) + 8);
572                         if ((s = strrchr(f'/'))) {
573                                 strcpy(aBflag);
574                                 strcat(as);
575                                 execv(av);
576                         }
577                 }
ragge
1.1
578                 execv(fv);
ragge
1.4
579                 if ((s = strrchr(f'/')))
580                         execvp(s+1v);
ragge
1.1
581                 printf("Can't find %s\n"f);
ragge
1.3
582                 exit(100);
583         } else
584                 if (t == -1) {
585                         printf("Try again\n");
586                         return(100);
587                 }
588         while(t!=wait(&status));
ragge
1.1
589         if ((t=(status&0377)) != 0 && t!=14) {
ragge
1.3
590                 if (t!=2)               /* interrupt */
ragge
1.36
591                         errorx(8"Fatal error in %s"f);
592                 dexit(eflag);
ragge
1.1
593         }
ragge
1.3
594         return((status>>8) & 0377);
ragge
1.1
595 }
596
ragge
1.3
597 char *
pj
1.28
598 copy(char *as)
ragge
1.3
599 {
pj
1.28
600         char *p;
601
ragge
1.36
602         if ((p = strdup(as)) == NULL)
603                 errorx(8"no space for file names");
ragge
1.3
604
pj
1.28
605         return p;
ragge
1.3
606 }
607
ragge
1.4
608 int
ragge
1.3
609 nodup(los)
610 char **l, *os;
ragge
1.1
611 {
612         register char *t, *s;
613         register int c;
614
615         s = os;
616         if (getsuf(s) != 'o')
ragge
1.3
617                 return(1);
ragge
1.4
618         while((t = *l++)) {
619                 while((c = *s++))
ragge
1.1
620                         if (c != *t++)
621                                 break;
ragge
1.3
622                 if (*t=='\0' && c=='\0')
623                         return(0);
ragge
1.1
624                 s = os;
625         }
ragge
1.3
626         return(1);
ragge
1.1
627 }
628
ragge
1.4
629 int
ragge
1.3
630 cunlink(f)
631 char *f;
ragge
1.1
632 {
ragge
1.13
633         if (f==0 || Xflag)
ragge
1.3
634                 return(0);
635         return(unlink(f));
ragge
1.1
636 }
pj
1.30
637
638 char *
639 gettmp()
640 {
641         char *sfn = strdup("/tmp/ctm.XXXXXX");
642         int fd = -1;
643
644         if ((fd = mkstemp(sfn)) == -1) {
645                 fprintf(stderr"%s: %s\n"sfnstrerror(errno));
646                 exit(8);
647         }
648         close(fd);
649
650         return sfn;
651 }
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-30 15:56 +0200