Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20060712122112

Diff

Diff from 1.46 to:

Annotations

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

Annotated File View

ragge
1.46
1 /*      $Id: cc.c,v 1.46 2006/07/12 12:21:12 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.20
121 char    *sysinc;
ragge
1.25
122 char *cppadd[] = CPPADD;
123 char *dynlinker[] = DYNLINKER;
124 char *crt0file = CRT0FILE;
125 char *startfiles[] = STARTFILES;
126 char *endfiles[] = ENDFILES;
127 char *cppmdadd[] = CPPMDADD;
ragge
1.1
128
ragge
1.4
129 int
pj
1.26
130 main(int argcchar *argv[])
131 {
ragge
1.15
132         char *t, *u;
ragge
1.1
133         char *assource;
ragge
1.3
134         char **pv, *ptemp[MAXOPT], **pvt;
ragge
1.36
135         int ncnlijcnxona;
ragge
1.3
136
ragge
1.36
137         i = nc = nl = nxo = 0;
ragge
1.3
138         pv = ptemp;
139         while(++i < argc) {
ragge
1.18
140                 if (argv[i][0] == '-')
141                 switch (argv[i][1]) {
ragge
1.3
142                 default:
143                         goto passa;
ragge
1.22
144
145                 case 'B'/* other search paths for binaries XXX support? */
146                         break;
147
ragge
1.10
148                 case 'X':
149                         Xflag++;
150                         break;
ragge
1.15
151                 case 'W'/* Ignore (most of) W-flags */
152                         if (strncmp(argv[i], "-Wl,"4) == 0) {
153                                 /* options to the linker */
154                                 t = &argv[i][4];
155                                 while ((u = strchr(t','))) {
156                                         *u++ = 0;
157                                         llist[nl++] = t;
158                                         t = u;
159                                 }
160                                 llist[nl++] = t;
161                         }
162                         break;
163
ragge
1.6
164                 case 'f'/* Ignore -ffreestanding */
165                         break;
ragge
1.14
166
ragge
1.25
167                 case 'g'/* create debug output */
168                         gflag++;
169                         break;
170
ragge
1.20
171                 case 'i':
172                         if (strcmp(argv[i], "-isystem") == 0) {
173                                 sysinc = argv[++i];
174                         } else
175                                 goto passa;
176                         break;
177
ragge
1.14
178                 case 'n'/* handle -n flags */
179                         if (strcmp(argv[i], "-nostdinc") == 0)
ragge
1.20
180                                 nostdinc++;
ragge
1.14
181                         else if (strcmp(argv[i], "-nostartfiles") == 0)
182                                 nostartfiles = 1;
183                         else
184                                 goto passa;
185                         break;
186
ragge
1.7
187                 case 'x':
ragge
1.43
188                         xlist[xnum++] = argv[i];
ragge
1.7
189                         break;
190                 case 't':
191                         tflag++;
192                         break;
ragge
1.1
193                 case 'S':
194                         sflag++;
195                         cflag++;
ragge
1.3
196                         break;
ragge
1.1
197                 case 'o':
ragge
1.18
198                         if (outfile)
ragge
1.36
199                                 errorx(8"too many -o");
ragge
1.18
200                         outfile = argv[++i];
ragge
1.3
201                         break;
ragge
1.1
202                 case 'O':
ragge
1.4
203                         Oflag++;
ragge
1.3
204                         break;
ragge
1.1
205                 case 'p':
206                         proflag++;
ragge
1.3
207                         break;
ragge
1.1
208                 case 'E':
ragge
1.8
209                         Eflag++;
210                         break;
ragge
1.1
211                 case 'P':
212                         pflag++;
ragge
1.3
213                         *pv++ = argv[i];
ragge
1.1
214                 case 'c':
215                         cflag++;
ragge
1.3
216                         break;
217
ragge
1.24
218 #if 0
ragge
1.3
219                 case '2':
220                         if(argv[i][2] == '\0')
221                                 pref = "/lib/crt2.o";
222                         else {
223                                 pref = "/lib/crt20.o";
224                         }
225                         break;
ragge
1.24
226 #endif
ragge
1.1
227                 case 'D':
228                 case 'I':
229                 case 'U':
230                 case 'C':
ragge
1.20
231                         *pv++ = argv[i];
ragge
1.3
232                         if (pv >= ptemp+MAXOPT)
233                                 {
ragge
1.36
234                                 error("Too many DIUC options");
ragge
1.3
235                                 --pv;
236                                 }
237                         break;
238
ragge
1.1
239                 case 'd':
ragge
1.3
240                         dflag++;
ragge
1.4
241                         strncpy(alistargv[i], 19);
ragge
1.3
242                         break;
ragge
1.5
243                 case 'v':
ragge
1.39
244                         printf("%s\n"VERSSTR);
ragge
1.5
245                         vflag++;
246                         break;
ragge
1.14
247
248                 case 's':
249                         if (strcmp(argv[i], "-static") == 0)
250                                 Bstatic = 1;
251                         else
252                                 goto passa;
253                         break;
ragge
1.3
254                 } else {
255                 passa:
256                         t = argv[i];
ragge
1.11
257                         if (*argv[i] == '-' && argv[i][1] == 'L')
258                                 ;
259                         else if((c=getsuf(t))=='c' || c=='s'|| Eflag) {
ragge
1.3
260                                 clist[nc++] = t;
261                                 if (nc>=MAXFIL)
262                                         {
ragge
1.36
263                                         error("Too many source files");
ragge
1.3
264                                         exit(1);
265                                         }
266                                 t = setsuf(t'o');
267                         }
268                         if (nodup(llistt)) {
269                                 llist[nl++] = t;
270                                 if (nl >= MAXLIB)
271                                         {
ragge
1.36
272                                         error("Too many object/library files");
ragge
1.3
273                                         exit(1);
274                                         }
275                                 if (getsuf(t)=='o')
276                                         nxo++;
ragge
1.1
277                         }
278                 }
279         }
ragge
1.18
280         /* Sanity checking */
281         if (nc == 0 && nl == 0)
ragge
1.36
282                 errorx(8"no input files");
ragge
1.18
283         if (outfile && (cflag || sflag) && nc > 1)
ragge
1.36
284                 errorx(8"-o given with -c || -S and more than one file");
ragge
1.19
285         if (outfile && clist[0] && strcmp(outfileclist[0]) == 0)
ragge
1.36
286                 errorx(8"output file will be clobbered");
ragge
1.18
287
ragge
1.4
288         if (gflagOflag = 0;
ragge
1.24
289 #if 0
290         if (proflag)
ragge
1.3
291                 pref = "/lib/mcrt0.o";
ragge
1.24
292 #endif
ragge
1.3
293         if(nc==0)
294                 goto nocom;
295         if (pflag==0) {
pj
1.30
296                 tmp3 = gettmp();
297                 tmp4 = gettmp();
ragge
1.1
298         }
ragge
1.3
299         if (signal(SIGINTSIG_IGN) != SIG_IGN/* interrupt */
ragge
1.1
300                 signal(SIGINTidexit);
ragge
1.3
301         if (signal(SIGTERMSIG_IGN) != SIG_IGN)        /* terminate */
ragge
1.1
302                 signal(SIGTERMidexit);
ragge
1.3
303         pvt = pv;
ragge
1.1
304         for (i=0i<nci++) {
ragge
1.18
305                 /*
306                  * C preprocessor
307                  */
ragge
1.37
308                 if (nc>1 && !Eflag)
ragge
1.1
309                         printf("%s:\n"clist[i]);
ragge
1.43
310                 onlyas = 0;
pj
1.32
311                 assource = tmp3;
ragge
1.3
312                 if (getsuf(clist[i])=='s') {
ragge
1.1
313                         assource = clist[i];
ragge
1.43
314                         onlyas = 1;
315                         goto assemble;
316                 } else if (getsuf(clist[i])=='S') {
317                         assource = clist[i];
318                         onlyas = 1;
pj
1.32
319                 }
ragge
1.1
320                 if (pflag)
321                         tmp4 = setsuf(clist[i], 'i');
ragge
1.5
322                 na = 0;
323                 av[na++] = "cpp";
ragge
1.20
324                 av[na++] = "-D__PCC__=" MKS(PCC_MAJOR);
ragge
1.40
325                 av[na++] = "-D__PCC_MINOR__=" MKS(PCC_MINOR);
326                 av[na++] = "-D__PCC_MINORMINOR__=" MKS(PCC_MINORMINOR);
ragge
1.20
327                 if (!nostdinc)
ragge
1.21
328                         av[na++] = "-S"av[na++] = STDINC;
ragge
1.20
329                 if (sysinc)
330                         av[na++] = "-S"av[na++] = sysinc;
ragge
1.5
331                 for (j = 0cppadd[j]; j++)
332                         av[na++] = cppadd[j];
ragge
1.24
333                 for (j = 0cppmdadd[j]; j++)
334                         av[na++] = cppmdadd[j];
ragge
1.7
335                 if (tflag)
ragge
1.20
336                         av[na++] = "-t";
ragge
1.7
337                 for(pv=ptemppv <pvtpv++)
338                         av[na++] = *pv;
ragge
1.5
339                 av[na++] = clist[i];
ragge
1.20
340                 if (!Eflag)
341                         av[na++] = tmp4;
ragge
1.3
342                 av[na++]=0;
343                 if (callsys(passpav))
344                         {exfail++; eflag++;}
ragge
1.11
345                 if (Eflag)
ragge
1.37
346                         continue;
ragge
1.43
347                 if (onlyas)
ragge
1.7
348                         goto assemble;
ragge
1.18
349
350                 /*
351                  * C compiler
352                  */
ragge
1.25
353                 na = 0;
354                 av[na++]= "ccom";
355                 if (gflag)
356                         av[na++] = "-g";
ragge
1.44
357                 if (Oflag) {
358                         av[na++] = "-xtemps";
359                 }
ragge
1.45
360                 for (j = 0j < xnumj++)
361                         av[na++] = xlist[j];
ragge
1.25
362                 av[na++] = tmp4;
ragge
1.3
363                 if (pflag || exfail)
364                         {
ragge
1.1
365                         cflag++;
366                         continue;
ragge
1.3
367                         }
ragge
1.16
368                 if(sflag) {
369                         if (outfile)
370                                 assource = tmp3 = outfile;
371                         else
372                                 assource = tmp3 = setsuf(clist[i], 's');
373                 }
ragge
1.25
374                 av[na++] = tmp3;
375 #if 0
ragge
1.3
376                 if (proflag) {
377                         av[3] = "-XP";
378                         av[4] = 0;
379                 } else
380                         av[3] = 0;
ragge
1.25
381 #endif
382                 av[na++] = NULL;
ragge
1.3
383                 if (callsys(pass0av)) {
ragge
1.1
384                         cflag++;
385                         eflag++;
386                         continue;
387                 }
388                 if (sflag)
389                         continue;
ragge
1.18
390
391                 /*
392                  * Assembler
393                  */
ragge
1.1
394         assemble:
ragge
1.3
395                 av[0] = "as";
396                 av[1] = "-o";
ragge
1.18
397                 if (outfile && cflag)
398                         av[2] = outfile;
399                 else
400                         av[2] = setsuf(clist[i], 'o');
ragge
1.43
401                 av[3] = onlyas ? tmp4 : assource;
ragge
1.3
402                 if (dflag) {
403                         av[4] = alist;
404                         av[5] = 0;
405                 } else
406                         av[4] = 0;
ragge
1.21
407                 if (callsys("/bin/as"av)) {
ragge
1.1
408                         cflag++;
409                         eflag++;
ragge
1.7
410                         cunlink(tmp4);
ragge
1.1
411                         continue;
412                 }
ragge
1.7
413                 cunlink(tmp4);
ragge
1.1
414         }
ragge
1.18
415
ragge
1.37
416         if (Eflag)
417                 dexit(eflag);
418
ragge
1.18
419         /*
420          * Linker
421          */
ragge
1.1
422 nocom:
423         if (cflag==0 && nl!=0) {
ragge
1.6
424                 j = 0;
425                 av[j++] = "ld";
426                 av[j++] = "-X";
427                 av[j++] = "-d";
428                 av[j++] = "-e";
429                 av[j++] = "__start";
ragge
1.14
430                 if (Bstatic == 0) { /* Dynamic linkage */
ragge
1.24
431                         for (i = 0dynlinker[i]; i++)
432                                 av[j++] = dynlinker[i];
ragge
1.14
433                 }
ragge
1.1
434                 if (outfile) {
ragge
1.3
435                         av[j++] = "-o";
436                         av[j++] = outfile;
437                 }
ragge
1.14
438                 if (!nostartfiles) {
ragge
1.24
439                         av[j++] = crt0file;
440                         for (i = 0startfiles[i]; i++)
441                                 av[j++] = startfiles[i];
ragge
1.14
442                 }
ragge
1.24
443                 i = 0;
ragge
1.14
444                 while(i<nl) {
ragge
1.3
445                         av[j++] = llist[i++];
ragge
1.14
446                         if (j >= MAXAV)
ragge
1.36
447                                 error("Too many ld options");
ragge
1.14
448                 }
ragge
1.11
449 #if 0
ragge
1.3
450                 if (gflag)
451                         av[j++] = "-lg";
ragge
1.11
452 #endif
ragge
1.6
453                 av[j++] = "-lc";
ragge
1.14
454                 if (!nostartfiles) {
ragge
1.24
455                         for (i = 0endfiles[i]; i++)
456                                 av[j++] = endfiles[i];
ragge
1.14
457                 }
ragge
1.3
458                 av[j++] = 0;
459                 eflag |= callsys("/bin/ld"av);
ragge
1.1
460                 if (nc==1 && nxo==1 && eflag==0)
ragge
1.3
461                         cunlink(setsuf(clist[0], 'o'));
ragge
1.46
462                 else if (nc > 0 && eflag == 0) {
463                         /* remove .o files XXX ugly */
464                         for (i = 0i < nci++)
465                                 cunlink(setsuf(clist[i], 'o'));
466                 }
ragge
1.1
467         }
ragge
1.36
468         dexit(eflag);
ragge
1.4
469         return 0;
ragge
1.1
470 }
471
ragge
1.36
472 /*
473  * exit and cleanup after interrupt.
474  */
ragge
1.4
475 void
476 idexit(int arg)
ragge
1.1
477 {
ragge
1.36
478         dexit(100);
ragge
1.1
479 }
480
ragge
1.36
481 /*
482  * exit and cleanup.
483  */
ragge
1.4
484 void
ragge
1.36
485 dexit(int eval)
ragge
1.1
486 {
ragge
1.10
487         if (!pflag && !Xflag) {
ragge
1.1
488                 if (sflag==0)
489                         cunlink(tmp3);
490                 cunlink(tmp4);
491         }
ragge
1.36
492         exit(eval);
ragge
1.1
493 }
494
ragge
1.36
495 static void
496 ccerror(char *sva_list ap)
ragge
1.1
497 {
ragge
1.36
498         vfprintf(Eflag ? stderr : stdoutsap);
ragge
1.8
499         putc('\n'Eflagstderr : stdout);
ragge
1.1
500         exfail++;
501         cflag++;
502         eflag++;
503 }
504
ragge
1.36
505 /*
506  * complain a bit.
507  */
508 void
509 error(char *s, ...)
510 {
511         va_list ap;
512
513         va_start(aps);
514         ccerror(sap);
515         va_end(ap);
516 }
517
518 /*
519  * complain a bit and then exit.
520  */
ragge
1.18
521 void
ragge
1.36
522 errorx(int evalchar *s, ...)
ragge
1.18
523 {
ragge
1.36
524         va_list ap;
525
526         va_start(aps);
527         ccerror(sap);
528         va_end(ap);
529         dexit(eval);
ragge
1.18
530 }
ragge
1.3
531
ragge
1.4
532 int
ragge
1.3
533 getsuf(as)
534 char as[];
ragge
1.1
535 {
536         register char *s;
537
ragge
1.4
538         if ((s = strrchr(as'.')) && s[1] != '\0' && s[2] == '\0')
539                 return s[1];
ragge
1.3
540         return(0);
ragge
1.1
541 }
542
ragge
1.36
543 /*
544  * Get basename of string s and change its suffix to ch.
545  */
ragge
1.1
546 char *
ragge
1.36
547 setsuf(char *schar ch)
ragge
1.1
548 {
ragge
1.36
549         s = copy(basename(s));
pj
1.31
550         s[strlen(s) - 1] = ch;
ragge
1.36
551         return(s);
ragge
1.1
552 }
553
ragge
1.4
554 int
ragge
1.3
555 callsys(fv)
556 char f[], *v[]; {
ragge
1.1
557         int tstatus;
ragge
1.4
558         char *s;
ragge
1.5
559
560         if (vflag) {
ragge
1.41
561                 fprintf(stderr"%s "f);
562                 for (t = 1v[t]; t++)
ragge
1.6
563                         fprintf(stderr"%s "v[t]);
564                 fprintf(stderr"\n");
ragge
1.5
565         }
ragge
1.1
566
ragge
1.3
567         if ((t=fork())==0) {
ragge
1.1
568                 execv(fv);
ragge
1.4
569                 if ((s = strrchr(f'/')))
570                         execvp(s+1v);
ragge
1.1
571                 printf("Can't find %s\n"f);
ragge
1.3
572                 exit(100);
573         } else
574                 if (t == -1) {
575                         printf("Try again\n");
576                         return(100);
577                 }
578         while(t!=wait(&status));
ragge
1.1
579         if ((t=(status&0377)) != 0 && t!=14) {
ragge
1.3
580                 if (t!=2)               /* interrupt */
ragge
1.36
581                         errorx(8"Fatal error in %s"f);
582                 dexit(eflag);
ragge
1.1
583         }
ragge
1.3
584         return((status>>8) & 0377);
ragge
1.1
585 }
586
ragge
1.3
587 char *
pj
1.28
588 copy(char *as)
ragge
1.3
589 {
pj
1.28
590         char *p;
591
ragge
1.36
592         if ((p = strdup(as)) == NULL)
593                 errorx(8"no space for file names");
ragge
1.3
594
pj
1.28
595         return p;
ragge
1.3
596 }
597
ragge
1.4
598 int
ragge
1.3
599 nodup(los)
600 char **l, *os;
ragge
1.1
601 {
602         register char *t, *s;
603         register int c;
604
605         s = os;
606         if (getsuf(s) != 'o')
ragge
1.3
607                 return(1);
ragge
1.4
608         while((t = *l++)) {
609                 while((c = *s++))
ragge
1.1
610                         if (c != *t++)
611                                 break;
ragge
1.3
612                 if (*t=='\0' && c=='\0')
613                         return(0);
ragge
1.1
614                 s = os;
615         }
ragge
1.3
616         return(1);
ragge
1.1
617 }
618
ragge
1.4
619 int
ragge
1.3
620 cunlink(f)
621 char *f;
ragge
1.1
622 {
ragge
1.13
623         if (f==0 || Xflag)
ragge
1.3
624                 return(0);
625         return(unlink(f));
ragge
1.1
626 }
pj
1.30
627
628 char *
629 gettmp()
630 {
631         char *sfn = strdup("/tmp/ctm.XXXXXX");
632         int fd = -1;
633
634         if ((fd = mkstemp(sfn)) == -1) {
635                 fprintf(stderr"%s: %s\n"sfnstrerror(errno));
636                 exit(8);
637         }
638         close(fd);
639
640         return sfn;
641 }
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-08-31 02:16 +0200