8 BEG, /* beginning of entry */
10 AN, /* database serial number */
11 AS, /* author (one at a time) */
13 AW, /* award_awardee */
15 CA, /* cast: character_actor */
16 CN, /* cinematography */
18 CR, /* miscellaneous job_name */
19 DE, /* topic keyword */
22 MP, /* MPAA rating (R, PG, etc.) */
24 PR, /* producer and for ...*/
25 PS, /* producer (repeats info in PR) */
26 RA, /* rating (letter) */
27 RD, /* release date */
28 RT, /* running time */
29 RV, /* review citation */
30 ST, /* production or release company (repeats info in PR) */
31 TI, /* title[; original foreign title] */
32 TX, /* paragraph of descriptive text */
33 VD, /* video information (format_time_company; or "Not Avail.") */
34 NTAG /* number of tags */
37 /* Assoc tables must be sorted on first field */
39 static char *tagtab[] = {
68 static char *mget(int, char *, char *, char **);
70 static void moutall(int, char *, char *);
72 static void moutall2(int, char *, char *);
75 movieprintentry(Entry ent, int cmd)
77 char *p, *e, *ps, *pe, *pn;
83 Bwrite(bout, ps, pe-ps);
86 p = mget(TI, ps, pe, &e);
95 p = mget(RD, ps, pe, &e);
97 outchars("Released: ");
101 p = mget(CO, ps, pe, &e);
108 p = mget(RT, ps, pe, &e);
112 outchars("Running time: ");
116 p = mget(MP, ps, pe, &e);
123 p = mget(BW, ps, pe, &e);
127 if(*p == 'c' || *p == 'C')
137 p = mget(VD, ps, pe, &e);
143 p = mget(AU, ps, pe, &e);
146 moutall2(AU, ps, pe);
149 p = mget(DR, ps, pe, &e);
151 outchars("Director: ");
155 p = mget(PR, ps, pe, &e);
157 outchars("Producer: ");
161 p = mget(CN, ps, pe, &e);
163 outchars("Cinematograpy: ");
167 p = mget(CR, ps, pe, &e);
169 outchars("Other Credits: ");
170 moutall2(CR, ps, pe);
173 p = mget(CA, ps, pe, &e);
176 moutall2(CA, ps, pe);
179 p = mget(AW, ps, pe, &e);
181 outchars("Awards: ");
182 moutall2(AW, ps, pe);
185 p = mget(NT, ps, pe, &e);
190 p = mget(AB, ps, pe, &e);
197 while((p = mget(TX, pn, pe, &pn)) != 0) {
206 movienextoff(long fromoff)
211 a = Bseek(bdict, fromoff, 0);
215 p = Brdline(bdict, '\n');
218 if(p[0] == '$' && p[1] == '$')
219 return (Boffset(bdict)-Blinelen(bdict));
227 Bprint(bout, "No key\n");
231 * write a comma-separated list of all tag values between b and e
235 moutall(int tag, char *b, char *e)
242 while((p = mget(tag, pn, e, &pn)) != 0) {
251 * like moutall, but values are expected to have form:
253 * and we are to output 'field2 (field1)' for each
254 * (sometimes field1 has underscores, so search from end)
257 moutall2(int tag, char *b, char *e)
259 char *p, *pn, *us, *q;
264 while((p = mget(tag, pn, e, &pn)) != 0) {
268 for(q = pn-1; q >= p; q--)
275 * Hack to fix cast list Himself/Herself
277 if(strncmp(us+1, "Himself", 7) == 0 ||
278 strncmp(us+1, "Herself", 7) == 0) {
296 * Starting from b, find next line beginning with tagtab[tag].
297 * Don't go past e, but assume *e==0.
298 * Return pointer to beginning of value (after tag), and set
299 * eptr to point at newline that ends the value
302 mget(int tag, char *b, char *e, char **eptr)
306 if(tag < 0 || tag >= NTAG)
318 if(p[0] == t[0] && p[1] == t[1])