DSMCC
17.9.0
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Typedefs
tools
bin
outdeps.c
1
/* Output the two static dependancy files: .E and .Q */
2
/* These are later included in *.P files by sunrise
3
* make script immediately after compilation */
4
#include <stdio.h>
5
#include <stdlib.h>
6
#include <string.h>
7
#include <fcntl.h>
8
9
int
main(
int
argc,
char
*argv[])
10
{
11
FILE *out;
12
int
flen;
13
char
*tag, *fnm, *pch, *qch, sch;
14
if
(argc < 3)
15
{
16
fprintf(stderr,
"Usage:\n\t%s <source name tag> <E output file> ...\n"
, argv[0]);
17
return
-1;
18
}
19
else
20
{
21
tag = argv[1];
22
fnm = argv[2];
23
flen = strlen(fnm);
24
out = fopen(fnm,
"w+"
);
25
if
(out == NULL)
26
{
27
fprintf(stderr,
"failed to open file %s\n"
, fnm);
28
return
-2;
29
}
30
else
31
{
32
fprintf(out,
"ODEFS_%s:="
, tag);
33
for
(flen = 3; flen != argc; flen++)
34
{
35
fnm = argv[flen];
36
pch = strchr(fnm,
'\"'
);
37
if
(pch == NULL)
38
{
39
fprintf(out,
" %s"
, fnm);
40
}
41
else
42
{
43
qch = strchr(pch + 1,
'\"'
);
44
if
(qch == NULL)
45
{
46
fprintf(out,
" %s"
, fnm);
47
}
48
else
49
{
50
*pch = 0;
51
fprintf(out,
" %s\'\""
, fnm);
52
qch++;
53
if
(*qch == 0)
54
{
55
fprintf(out,
"%s\'"
, pch + 1);
56
}
57
else
58
{
59
sch = *qch;
60
*qch = 0;
61
fprintf(out,
"%s\'"
, pch + 1);
62
*qch = sch;
63
fprintf(out,
"%s"
, qch);
64
}
65
}
66
}
67
}
68
fprintf(out,
"\n"
);
69
fclose(out);
70
}
71
return
0;
72
}
73
}
74
Generated on Tue Sep 19 2017 17:09:56 for DSMCC by
1.8.6