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

Function askname_done

win/X11/winX.c:1820–1848  ·  view source on GitHub ↗

Callback for askname dialog widget. */ ARGSUSED */

Source from the content-addressed store, hash-verified

1818/* Callback for askname dialog widget. */
1819/* ARGSUSED */
1820static void
1821askname_done(Widget w, XtPointer client_data, XtPointer call_data)
1822{
1823 unsigned len;
1824 char *s;
1825 Widget dialog = (Widget) client_data;
1826
1827 nhUse(w);
1828 nhUse(call_data);
1829
1830 s = (char *) GetDialogResponse(dialog);
1831
1832 len = strlen(s);
1833 if (len == 0) {
1834 X11_nhbell();
1835 return;
1836 }
1837
1838 /* Truncate name if necessary */
1839 if (len >= sizeof svp.plname - 1)
1840 len = sizeof svp.plname - 1;
1841
1842 (void) strncpy(svp.plname, s, len);
1843 svp.plname[len] = '\0';
1844 XtFree(s);
1845
1846 nh_XtPopdown(XtParent(dialog));
1847 exit_x_event = TRUE;
1848}
1849
1850/* ask player for character's name to replace generic name "player" (or other
1851 values; see config.h) after 'nethack -u player' or OPTIONS=name:player */

Callers

nothing calls this directly

Calls 3

GetDialogResponseFunction · 0.85
X11_nhbellFunction · 0.85
nh_XtPopdownFunction · 0.85

Tested by

no test coverage detected