/* write a string to the console, ignoring errors. */ void sf_puts(const char *str) { Cell args[3], returns[1]; args[0] = (uPtr)g_output; args[1] = (uPtr)str; args[2] = sf_strlen(str); (void)sf_call_firmware("write", 3, 1, args, returns); }
SFInt SFFont_GetStringWidth(UString aStr,SFInt aLength) { SFInt width=0,height=0,i; //TODO LATER : should be replaced if(aLength<0) { aLength=sf_strlen(aStr); } for(i=0;i<aLength;i++) { width+=SFFont_GetCharWidth(aStr[i]); } return width; }
void walk_tree(Package *pkg, const char *type) { char pbuf[256]; int plen; Package *p; int netdevs = 0; if (sf_strncmp(type, "network", 8) == 0) netdevs = 1; for (; pkg != NULL; pkg = sf_peer(pkg)) { plen = sf_getprop(pkg, "device_type", pbuf, sizeof pbuf); if (plen > 0 && sf_strlen(type) < plen && sf_strncmp(pbuf, type, plen) == 0) { sf_package_to_path(pkg, pbuf, sizeof pbuf); dprintf("\t"); dprintf(pbuf); if (netdevs) { /* get the "local-mac-address" property */ plen = sf_getprop(pkg, "local-mac-address", pbuf, sizeof pbuf); if (plen < 0) plen = sf_getprop(pkg, "mac-address", pbuf, sizeof pbuf); if (plen == 6) printmacaddr(pbuf); } dprintf("\r\n"); } p = sf_child(pkg); if (p != NULL) walk_tree(p, type); } }