MCPcopy Create free account
hub / github.com/NetHack/NetHack / convert_line

Function convert_line

src/questpgr.c:327–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327staticfn void
328convert_line(char *in_line, char *out_line)
329{
330 char *c, *cc;
331
332 cc = out_line;
333 for (c = in_line; *c; c++) {
334 *cc = 0;
335 switch (*c) {
336 case '\r':
337 case '\n':
338 *(++cc) = 0;
339 return;
340
341 case '%':
342 if (*(c + 1)) {
343 convert_arg(*(++c));
344 switch (*(++c)) {
345 /* insert "a"/"an" prefix */
346 case 'A':
347 Strcat(cc, An(gc.cvt_buf));
348 cc += strlen(cc);
349 continue; /* for */
350 case 'a':
351 Strcat(cc, an(gc.cvt_buf));
352 cc += strlen(cc);
353 continue; /* for */
354
355 /* capitalize */
356 case 'C':
357 gc.cvt_buf[0] = highc(gc.cvt_buf[0]);
358 break;
359
360 /* replace name with pronoun;
361 valid for %d, %l, %n, and %o */
362 case 'h': /* he/she */
363 case 'H': /* He/She */
364 case 'i': /* him/her */
365 case 'I':
366 case 'j': /* his/her */
367 case 'J':
368 if (strchr("dlno", lowc(*(c - 1))))
369 qtext_pronoun(*(c - 1), *c);
370 else
371 --c; /* default action */
372 break;
373
374 /* pluralize */
375 case 'P':
376 gc.cvt_buf[0] = highc(gc.cvt_buf[0]);
377 FALLTHROUGH;
378 /*FALLTHRU*/
379 case 'p':
380 Strcpy(gc.cvt_buf, makeplural(gc.cvt_buf));
381 break;
382
383 /* append possessive suffix */
384 case 'S':

Callers 3

deliver_by_plineFunction · 0.85
deliver_by_windowFunction · 0.85
com_pager_coreFunction · 0.85

Calls 10

convert_argFunction · 0.85
AnFunction · 0.85
anFunction · 0.85
highcFunction · 0.85
qtext_pronounFunction · 0.85
makepluralFunction · 0.85
s_suffixFunction · 0.85
lowcFunction · 0.70
strncmpiFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected