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 **);
69 static void moutall(int, char *, char *);
70 static void moutall2(int, char *, char *);
73 movieprintentry(Entry ent, int cmd)
75 char *p, *e, *ps, *pe, *pn;
81 Bwrite(bout, ps, pe-ps);
84 p = mget(TI, ps, pe, &e);
93 p = mget(RD, ps, pe, &e);
95 outchars("Released: ");
99 p = mget(CO, ps, pe, &e);
106 p = mget(RT, ps, pe, &e);
110 outchars("Running time: ");
114 p = mget(MP, ps, pe, &e);
121 p = mget(BW, ps, pe, &e);
125 if(*p == 'c' || *p == 'C')
135 p = mget(VD, ps, pe, &e);
141 p = mget(AU, ps, pe, &e);
144 moutall2(AU, ps, pe);
147 p = mget(DR, ps, pe, &e);
149 outchars("Director: ");
153 p = mget(PR, ps, pe, &e);
155 outchars("Producer: ");
159 p = mget(CN, ps, pe, &e);
161 outchars("Cinematograpy: ");
165 p = mget(CR, ps, pe, &e);
167 outchars("Other Credits: ");
168 moutall2(CR, ps, pe);
171 p = mget(CA, ps, pe, &e);
174 moutall2(CA, ps, pe);
177 p = mget(AW, ps, pe, &e);
179 outchars("Awards: ");
180 moutall2(AW, ps, pe);
183 p = mget(NT, ps, pe, &e);
188 p = mget(AB, ps, pe, &e);
195 while((p = mget(TX, pn, pe, &pn)) != 0) {
204 movienextoff(long fromoff)
209 a = Bseek(bdict, fromoff, 0);
213 p = Brdline(bdict, '\n');
216 if(p[0] == '$' && p[1] == '$')
217 return (Boffset(bdict)-Blinelen(bdict));
225 Bprint(bout, "No key\n");
229 * write a comma-separated list of all tag values between b and e
232 moutall(int tag, char *b, char *e)
239 while((p = mget(tag, pn, e, &pn)) != 0) {
247 * like moutall, but values are expected to have form:
249 * and we are to output 'field2 (field1)' for each
250 * (sometimes field1 has underscores, so search from end)
253 moutall2(int tag, char *b, char *e)
255 char *p, *pn, *us, *q;
260 while((p = mget(tag, pn, e, &pn)) != 0) {
264 for(q = pn-1; q >= p; q--)
271 * Hack to fix cast list Himself/Herself
273 if(strncmp(us+1, "Himself", 7) == 0 ||
274 strncmp(us+1, "Herself", 7) == 0) {
292 * Starting from b, find next line beginning with tagtab[tag].
293 * Don't go past e, but assume *e==0.
294 * Return pointer to beginning of value (after tag), and set
295 * eptr to point at newline that ends the value
298 mget(int tag, char *b, char *e, char **eptr)
302 if(tag < 0 || tag >= NTAG)
314 if(p[0] == t[0] && p[1] == t[1])