FreeCalypso > hg > freecalypso-tools
annotate ringtools/fc-ringlist-comp.c @ 1014:961efadd530a default tip
fc-shell TCH DL handler: add support for CSD modes
TCH DL capture mechanism in FC Tourmaline firmware has been extended
to support CSD modes in addition to speech - add the necessary support
on the host tools side.
It needs to be noted that this mechanism in its present state does NOT
provide the debug utility value that was sought: as we learned only
after the code was implemented, TI's DSP has a misfeature in that the
buffer we are reading (a_dd_0[]) is zeroed out when the IDS block
is enabled, i.e., we are reading all zeros and not the real DL bits
we were after. But since the code has already been written, we are
keeping it - perhaps we can do some tests with IDS disabled.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 26 Nov 2024 06:27:43 +0000 |
parents | f442156d31ad |
children |
rev | line source |
---|---|
874
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program compiles a list of ringing tone or message alert tone |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * melodies from ASCII source into the binary format (.mls) that will |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * be uploaded into FreeCalypso device FFS and read by the UI layer |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * of FC phone firmwares. |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdio.h> |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <ctype.h> |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <string.h> |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <strings.h> |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #define MAX_FFS_PATHNAME 19 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #define MAX_FFS_PREFIX 5 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #define MAX_NAME_FIELD 59 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 struct bin_record { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 char ffs_pathname[MAX_FFS_PATHNAME+1]; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 char ui_name[MAX_NAME_FIELD+1]; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 }; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 char *infname, *outfname; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 FILE *inf, *outf; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 char ffs_prefix[MAX_FFS_PREFIX+2]; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 unsigned ffs_prefix_len; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 char linebuf[256]; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 int lineno; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 set_ffs_prefix(prefix_arg) |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 char *prefix_arg; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 char *cp; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 if (prefix_arg[0] != '/') { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 fprintf(stderr, |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 "error: given FFS prefix does not begin with \'/\'\n"); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 ffs_prefix_len = strlen(prefix_arg); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 if (ffs_prefix_len > MAX_FFS_PREFIX) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 fprintf(stderr, "error: given FFS prefix is too long\n"); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 strcpy(ffs_prefix, prefix_arg); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 cp = ffs_prefix + ffs_prefix_len; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 if (cp[-1] != '/') { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 cp[0] = '/'; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 cp[1] = '\0'; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 ffs_prefix_len++; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 enforce_and_strip_newline() |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 char *cp; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 cp = index(linebuf, '\n'); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 if (!cp) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 fprintf(stderr, "%s line %d: too long or missing newline\n", |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 infname, lineno); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 *cp = '\0'; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 emit_record(fname, uname) |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 char *fname, *uname; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 struct bin_record rec; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 strcpy(rec.ffs_pathname, ffs_prefix); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 strncpy(rec.ffs_pathname + ffs_prefix_len, fname, |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 MAX_FFS_PATHNAME + 1 - ffs_prefix_len); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 strncpy(rec.ui_name, uname, MAX_NAME_FIELD + 1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 fwrite(&rec, sizeof rec, 1, outf); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 process_line() |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 char *cp, *fname, *uname; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 cp = linebuf; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 while (isspace(*cp)) |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 cp++; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 if (*cp == '\0' || *cp == '#') |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 return; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 fname = cp; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 while (*cp && !isspace(*cp)) |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 cp++; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 if (!*cp) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 inv: fprintf(stderr, "%s line %d: invalid syntax\n", |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 infname, lineno); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 *cp++ = '\0'; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 while (isspace(*cp)) |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 cp++; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 if (*cp == '\0' || *cp == '#') |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 goto inv; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 uname = cp; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 if (strlen(fname) + ffs_prefix_len > MAX_FFS_PATHNAME) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 fprintf(stderr, "%s line %d: melody filename exceeds limit\n", |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 infname, lineno); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 if (strlen(uname) > MAX_NAME_FIELD) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 fprintf(stderr, "%s line %d: melody UI name exceeds limit\n", |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 infname, lineno); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 emit_record(fname, uname); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 main(argc, argv) |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 char **argv; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 if (argc != 4) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 fprintf(stderr, "usage: %s src-file bin-file ffs-prefix\n", |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 argv[0]); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 if (strcmp(argv[1], "-")) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 infname = argv[1]; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 inf = fopen(infname, "r"); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 if (!inf) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 perror(infname); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 } else { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 infname = "stdin"; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 inf = stdin; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 set_ffs_prefix(argv[3]); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 outfname = argv[2]; |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 outf = fopen(outfname, "w"); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 if (!outf) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 perror(outfname); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 exit(1); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) { |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 enforce_and_strip_newline(); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 process_line(); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 } |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 exit(0); |
f442156d31ad
ringtools: fc-ringlist-comp program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 } |