FreeCalypso > hg > ueda-linux
annotate ifctf-part-lib/geda-symbols/fixpinseq.c @ 125:43ca224e97e2
SC75__ON_Semi.fp added
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 12 Jul 2020 01:15:34 +0000 |
parents | cd92449fdb51 |
children |
rev | line source |
---|---|
0
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include <sys/param.h> |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 #include <stdio.h> |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 main(argc, argv) |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 char **argv; |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 { |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 char *infile, outfile[MAXPATHLEN]; |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 FILE *inf, *of; |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 char line[1024]; |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 int pinnum; |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 if (argc != 2) { |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 fprintf(stderr, "usage: %s symfile\n", argv[0]); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 exit(1); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 } |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 infile = argv[1]; |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 inf = fopen(infile, "r"); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 if (!inf) { |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 perror(infile); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 exit(1); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 } |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 strcpy(outfile, infile); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 strcat(outfile, ".fix"); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 of = fopen(outfile, "w"); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 if (!of) { |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 perror(outfile); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 exit(1); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 } |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 while (fgets(line, sizeof line, inf)) { |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 if (!strncmp(line, "pinnumber=", 10)) |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 pinnum = atoi(line + 10); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 else if (!strncmp(line, "pinseq=", 7)) |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 sprintf(line, "pinseq=%d\n", pinnum); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 fputs(line, of); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 } |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 fclose(inf); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 fclose(of); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 exit(0); |
cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 } |