comparison ifctf-part-lib/geda-symbols/fixpinseq.c @ 0:cd92449fdb51

initial import of ueda and ifctf-part-lib from ifctfvax CVS
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 20 Jul 2015 00:24:37 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cd92449fdb51
1 #include <sys/param.h>
2 #include <stdio.h>
3
4 main(argc, argv)
5 char **argv;
6 {
7 char *infile, outfile[MAXPATHLEN];
8 FILE *inf, *of;
9 char line[1024];
10 int pinnum;
11
12 if (argc != 2) {
13 fprintf(stderr, "usage: %s symfile\n", argv[0]);
14 exit(1);
15 }
16 infile = argv[1];
17 inf = fopen(infile, "r");
18 if (!inf) {
19 perror(infile);
20 exit(1);
21 }
22 strcpy(outfile, infile);
23 strcat(outfile, ".fix");
24 of = fopen(outfile, "w");
25 if (!of) {
26 perror(outfile);
27 exit(1);
28 }
29
30 while (fgets(line, sizeof line, inf)) {
31 if (!strncmp(line, "pinnumber=", 10))
32 pinnum = atoi(line + 10);
33 else if (!strncmp(line, "pinseq=", 7))
34 sprintf(line, "pinseq=%d\n", pinnum);
35 fputs(line, of);
36 }
37 fclose(inf);
38 fclose(of);
39 exit(0);
40 }