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

Function anything_to_s

src/botl.c:1885–1926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1883}
1884
1885staticfn char *
1886anything_to_s(char *buf, anything *a, int anytype)
1887{
1888 if (!buf)
1889 return (char *) 0;
1890
1891 switch (anytype) {
1892 case ANY_ULONG:
1893 Sprintf(buf, "%lu", a->a_ulong);
1894 break;
1895 case ANY_MASK32:
1896 Sprintf(buf, "%lx", a->a_ulong);
1897 break;
1898 case ANY_LONG:
1899 Sprintf(buf, "%ld", a->a_long);
1900 break;
1901 case ANY_INT:
1902 Sprintf(buf, "%d", a->a_int);
1903 break;
1904 case ANY_UINT:
1905 Sprintf(buf, "%u", a->a_uint);
1906 break;
1907 case ANY_IPTR:
1908 Sprintf(buf, "%d", *a->a_iptr);
1909 break;
1910 case ANY_LPTR:
1911 Sprintf(buf, "%ld", *a->a_lptr);
1912 break;
1913 case ANY_ULPTR:
1914 Sprintf(buf, "%lu", *a->a_ulptr);
1915 break;
1916 case ANY_UPTR:
1917 Sprintf(buf, "%u", *a->a_uptr);
1918 break;
1919 case ANY_STR: /* do nothing */
1920 ;
1921 break;
1922 default:
1923 buf[0] = '\0';
1924 }
1925 return buf;
1926}
1927
1928#ifdef STATUS_HILITES
1929staticfn void

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected