Index: branches/azimutz/Chazileon/i386/libsaio/nvidia.c =================================================================== --- branches/azimutz/Chazileon/i386/libsaio/nvidia.c (revision 432) +++ branches/azimutz/Chazileon/i386/libsaio/nvidia.c (revision 433) @@ -291,7 +291,7 @@ { 0x10DE0614, "GeForce 9800 GT" }, { 0x10DE0615, "GeForce GTS 250" }, { 0x10DE0617, "GeForce 9800M GTX" }, - { 0x10DE0618, "GeForce GTX 260M" }, + { 0x10DE0618, "GeForce GTX 260M" }, { 0x10DE061A, "Quadro FX 3700" }, { 0x10DE061C, "Quadro FX 3600M" }, { 0x10DE061D, "Quadro FX 2800M" }, @@ -323,6 +323,10 @@ { 0x10DE065A, "Quadro FX 1700M" }, { 0x10DE065B, "GeForce 9400 GT" }, { 0x10DE065C, "Quadro FX 770M" }, + { 0x10DE06C0, "GeForce GTX 480" }, + { 0x10DE06C4, "GeForce GTX 465" }, + { 0x10DE06CA, "GeForce GTX 480M" }, + { 0x10DE06CD, "GeForce GTX 470" }, { 0x10DE06E0, "GeForce 9300 GE" }, { 0x10DE06E1, "GeForce 9300 GS" }, { 0x10DE06E4, "GeForce 8400 GS" }, @@ -337,6 +341,7 @@ { 0x10DE06F9, "Quadro FX 370 LP" }, { 0x10DE06FA, "Quadro NVS 450" }, { 0x10DE06FD, "Quadro NVS 295" }, + { 0x10DE086C, "GeForce 9300/nForce 730i" }, { 0x10DE087D, "ION 9400M" }, { 0x10DE087E, "ION LE" }, { 0x10DE0A20, "GeForce GT220" }, @@ -355,10 +360,6 @@ { 0x10DE0CA8, "GeForce GTS 260M" }, { 0x10DE0CA9, "GeForce GTS 250M" }, { 0x10DE0CA3, "GeForce GT240" }, - { 0x10DE06C0, "GeForce GTX 480" }, - { 0x10DE06CD, "GeForce GTX 470" }, - { 0x10DE06C4, "GeForce GTX 465" }, - { 0x10DE06CA, "GeForce GTX 480M" }, { 0x10DE0E22, "GeForce GTX 460" }, { 0x10DE0E24, "GeForce GTX 460" }, { 0x10DE06D1, "Tesla C2050" }, // TODO: sub-device id: 0x0771 Index: branches/azimutz/Chazileon/i386/libsaio/disk.c =================================================================== --- branches/azimutz/Chazileon/i386/libsaio/disk.c (revision 432) +++ branches/azimutz/Chazileon/i386/libsaio/disk.c (revision 433) @@ -1606,8 +1606,15 @@ */ if ( (newBVR->flags & kBVFlagForeignBoot) ) { - if(val && matchVolumeToString(newBVR, val, true)) - newBVR->visible = false; + char *start, *next = val; + long len = 0; + do + { + start = strbreak(next, &next, &len); + if(len && matchVolumeToString(newBVR, start, len) ) + newBVR->visible = false; + } + while ( next && *next ); } /* @@ -1689,73 +1696,47 @@ //========================================================================== -static char * matchStrings(const char * str1, const char * str2, bool matchPartial) +bool matchVolumeToString( BVRef bvr, const char* match, long matchLen) { - char * ret = NULL; - - if (matchPartial) - ret = strstr(str1, str2); - else if (!strcmp(str1, str2)) - ret = (char *)str1; - - if(ret) - ret += strlen(str2); - - return ret; -} - -char * matchVolumeToString(BVRef bvr, const char * match, bool matchPartial) -{ char testStr[128]; - char tempStr[128]; - char * ret = NULL; - int len = 0; - - *tempStr = '\0'; - + if ( !bvr || !match || !*match) - return NULL; - - if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 - || !(bvr->flags & (kBVFlagSystemVolume|kBVFlagForeignBoot)) ) - return NULL; - - // Try to match hd(x,y) first. - sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no); - if (ret = matchStrings(match, testStr, matchPartial)) - return ret; - - // Try to match volume UUID. - if ( bvr->fs_getuuid && !(bvr->fs_getuuid(bvr, testStr)) ) - { - if (ret = matchStrings(match, testStr, matchPartial)) - return ret; - } - - // Try to match volume label (always quoted). - if (bvr->description) - { - // Gather volume label into tempStr. - bvr->description(bvr, tempStr, sizeof(tempStr) - 1); - len = strlen(tempStr); - if (len == 0) - return NULL; - - sprintf(testStr, "\"%s\"", tempStr); - if (ret = matchStrings(match, testStr, matchPartial)) - return ret; - } - - return NULL; + return 0; + + if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 ) + return 0; + + // Try to match hd(x,y) first. + sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no); + if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + return true; + + // Try to match volume UUID. + if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0) + { + if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + return true; + } + + // Try to match volume label (always quoted). + if ( bvr->description ) + { + bvr->description(bvr, testStr, sizeof(testStr)-1); + if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + return true; + } + + return false; } -/* If Rename Partition has defined an alias, then extract it for description purpose */ -bool getVolumeLabelAlias( BVRef bvr, char* str, long strMaxLen) +/* If Rename Partition has defined an alias, then extract it for description purpose + * The format for the rename string is the following: + * hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ... + */ + +bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen) { - /* The format for the rename string is the following: - * hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ... - */ - char *aliasList, *next; + char *aliasList, *entryStart, *entryNext; if ( !str || strMaxLen <= 0) return false; @@ -1763,61 +1744,39 @@ aliasList = XMLDecode(getStringForKey(kRenamePartitionKey, &bootInfo->bootConfig)); if ( !aliasList ) return false; - - next = aliasList; - while ( next && *next ) + + for ( entryStart = entryNext = aliasList; + entryNext && *entryNext; + entryStart = entryNext ) { - char *start, *aliasStart, *aliasEnd; - char *ret; + char *volStart, *volEnd, *aliasStart; + long volLen, aliasLen; - start = aliasStart = (char*)matchVolumeToString(bvr, next, true); - if ( !start || !*start ) - break; - - /* Find and delimit the current entry's end */ - next = strstr(start, ";"); - if ( next ) + // Delimit current entry + entryNext = strchr(entryStart, ';'); + if ( entryNext ) { - /* Not enough characters for a successful match: we'd need at least - * one space and another char. before the semicolon - */ - if ( next-start < 2 ) { - next++; - continue; - } - - *next = '\0'; - next++; + *entryNext = '\0'; + entryNext++; } - /* Check for at least one space, but ignore the rest of them */ - while ( isspace(*aliasStart) ) - aliasStart++; - if ( start == aliasStart ) + volStart = strbreak(entryStart, &volEnd, &volLen); + if(!volLen) continue; - - switch ( *aliasStart ) - { - case '\0': - break; - case '"': - /* If a starting quote is found, skip it, then find the ending one, - * and replace it for a string terminator. - */ - aliasStart++; - aliasEnd = strstr(aliasStart, "\""); - if ( !aliasEnd || aliasStart == aliasEnd ) - break; - - *aliasEnd = '\0'; - default: - ret = strncpy(str, aliasStart, strMaxLen); - free(aliasList); - - return ret != 0; + + aliasStart = strbreak(volEnd, 0, &aliasLen); + if(!aliasLen) + continue; + + if ( matchVolumeToString(bvr, volStart, volLen) ) + { + strncpy(str, aliasStart, min(strMaxLen, aliasLen)); + free(aliasList); + + return true; } } - + free(aliasList); return false; } @@ -1846,8 +1805,7 @@ /* See if a partition rename is preferred */ if(getVolumeLabelAlias(bvr, p, strMaxLen)) { - verbose("Renamed: %s\n", p); - strncpy(bvr->label, p, sizeof(bvr->label) - 1); + //verbose("Renamed: %s\n", p); Azi:remove?? return; // we're done here no need to seek for real name } @@ -1873,7 +1831,7 @@ } // Set the devices label - strncpy(bvr->label, p, sizeof(bvr->label)-1); + sprintf(bvr->label, p); } //========================================================================== Index: branches/azimutz/Chazileon/i386/libsaio/disk.h =================================================================== --- branches/azimutz/Chazileon/i386/libsaio/disk.h (revision 432) +++ branches/azimutz/Chazileon/i386/libsaio/disk.h (revision 433) @@ -9,6 +9,6 @@ #ifndef __LIBSAIO_DISK_H #define __LIBSAIO_DISK_H -char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial); +bool matchVolumeToString( BVRef bvr, const char* match, long strMaxLen); #endif /* __LIBSAIO_DISK_H */ \ No newline at end of file Index: branches/azimutz/Chazileon/i386/boot2/options.c =================================================================== --- branches/azimutz/Chazileon/i386/boot2/options.c (revision 432) +++ branches/azimutz/Chazileon/i386/boot2/options.c (revision 433) @@ -117,7 +117,7 @@ position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) ); char dummy[80]; - getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true ); + getBootVolumeDescription( gBootVolume, dummy, 80, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); @@ -787,7 +787,7 @@ strlcpy(prompt, val, cnt); } else { name = malloc(80); - getBootVolumeDescription(gBootVolume, name, sizeof(name) - 1, false); + getBootVolumeDescription(gBootVolume, name, 80, false); prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); @@ -864,7 +864,7 @@ // Associate a menu item for each BVRef. for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) { if (bvr->visible) { - getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[0].name) - 1, true); + getBootVolumeDescription(bvr, menuItems[i].name, 80, true); menuItems[i].param = (void *) bvr; if (bvr == menuBVR) { selectIndex = i; Index: branches/azimutz/Chazileon/i386/libsa/libsa.h =================================================================== --- branches/azimutz/Chazileon/i386/libsa/libsa.h (revision 432) +++ branches/azimutz/Chazileon/i386/libsa/libsa.h (revision 433) @@ -107,6 +107,9 @@ extern int strncasecmp(const char * s1, const char * s2, size_t n); #endif +extern char * strchr(const char *str, int c); +extern char * strbreak(const char *str, char **next, long *len); + extern uint8_t checksum8( void * start, unsigned int length ); /* Index: branches/azimutz/Chazileon/i386/libsa/string.c =================================================================== --- branches/azimutz/Chazileon/i386/libsa/string.c (revision 432) +++ branches/azimutz/Chazileon/i386/libsa/string.c (revision 433) @@ -257,6 +257,55 @@ } #endif +char* strchr(const char *str, int c) +{ + do + { + if(*str == c) + return (char*)str; + } + while(*(str++)); + + return 0; +} + +char* strbreak(const char *str, char **next, long *len) +{ + char *start = (char*)str, *end; + bool quoted = false; + + if ( !start || !len ) + return 0; + + *len = 0; + + while ( isspace(*start) ) + start++; + + if (*start == '"') + { + start++; + + end = strchr(start, '"'); + if(end) + quoted = true; + else + end = strchr(start, '\0'); + } + else + { + for ( end = start; *end && !isspace(*end); end++ ) + {} + } + + *len = end - start; + + if(next) + *next = quoted ? end+1 : end; + + return start; +} + /* COPYRIGHT NOTICE: checksum8 from AppleSMBIOS */ uint8_t checksum8( void * start, unsigned int length ) { Index: branches/azimutz/CleanCut/i386/libsaio/nvidia.c =================================================================== --- branches/azimutz/CleanCut/i386/libsaio/nvidia.c (revision 432) +++ branches/azimutz/CleanCut/i386/libsaio/nvidia.c (revision 433) @@ -291,7 +291,7 @@ { 0x10DE0614, "GeForce 9800 GT" }, { 0x10DE0615, "GeForce GTS 250" }, { 0x10DE0617, "GeForce 9800M GTX" }, - { 0x10DE0618, "GeForce GTX 260M" }, + { 0x10DE0618, "GeForce GTX 260M" }, { 0x10DE061A, "Quadro FX 3700" }, { 0x10DE061C, "Quadro FX 3600M" }, { 0x10DE061D, "Quadro FX 2800M" }, @@ -323,6 +323,10 @@ { 0x10DE065A, "Quadro FX 1700M" }, { 0x10DE065B, "GeForce 9400 GT" }, { 0x10DE065C, "Quadro FX 770M" }, + { 0x10DE06C0, "GeForce GTX 480" }, + { 0x10DE06C4, "GeForce GTX 465" }, + { 0x10DE06CA, "GeForce GTX 480M" }, + { 0x10DE06CD, "GeForce GTX 470" }, { 0x10DE06E0, "GeForce 9300 GE" }, { 0x10DE06E1, "GeForce 9300 GS" }, { 0x10DE06E4, "GeForce 8400 GS" }, @@ -337,6 +341,7 @@ { 0x10DE06F9, "Quadro FX 370 LP" }, { 0x10DE06FA, "Quadro NVS 450" }, { 0x10DE06FD, "Quadro NVS 295" }, + { 0x10DE086C, "GeForce 9300/nForce 730i" }, { 0x10DE087D, "ION 9400M" }, { 0x10DE087E, "ION LE" }, { 0x10DE0A20, "GeForce GT220" }, @@ -355,10 +360,6 @@ { 0x10DE0CA8, "GeForce GTS 260M" }, { 0x10DE0CA9, "GeForce GTS 250M" }, { 0x10DE0CA3, "GeForce GT240" }, - { 0x10DE06C0, "GeForce GTX 480" }, - { 0x10DE06CD, "GeForce GTX 470" }, - { 0x10DE06C4, "GeForce GTX 465" }, - { 0x10DE06CA, "GeForce GTX 480M" }, { 0x10DE0E22, "GeForce GTX 460" }, { 0x10DE0E24, "GeForce GTX 460" }, { 0x10DE06D1, "Tesla C2050" }, // TODO: sub-device id: 0x0771 Index: branches/azimutz/CleanCut/i386/libsaio/disk.c =================================================================== --- branches/azimutz/CleanCut/i386/libsaio/disk.c (revision 432) +++ branches/azimutz/CleanCut/i386/libsaio/disk.c (revision 433) @@ -1606,8 +1606,15 @@ */ if ( (newBVR->flags & kBVFlagForeignBoot) ) { - if(val && matchVolumeToString(newBVR, val, true)) - newBVR->visible = false; + char *start, *next = val; + long len = 0; + do + { + start = strbreak(next, &next, &len); + if(len && matchVolumeToString(newBVR, start, len) ) + newBVR->visible = false; + } + while ( next && *next ); } /* @@ -1689,73 +1696,47 @@ //========================================================================== -static char * matchStrings(const char * str1, const char * str2, bool matchPartial) +bool matchVolumeToString( BVRef bvr, const char* match, long matchLen) { - char * ret = NULL; - - if (matchPartial) - ret = strstr(str1, str2); - else if (!strcmp(str1, str2)) - ret = (char *)str1; - - if(ret) - ret += strlen(str2); - - return ret; -} - -char * matchVolumeToString(BVRef bvr, const char * match, bool matchPartial) -{ char testStr[128]; - char tempStr[128]; - char * ret = NULL; - int len = 0; - - *tempStr = '\0'; - + if ( !bvr || !match || !*match) - return NULL; - - if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 - || !(bvr->flags & (kBVFlagSystemVolume|kBVFlagForeignBoot)) ) - return NULL; - - // Try to match hd(x,y) first. - sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no); - if (ret = matchStrings(match, testStr, matchPartial)) - return ret; - - // Try to match volume UUID. - if ( bvr->fs_getuuid && !(bvr->fs_getuuid(bvr, testStr)) ) - { - if (ret = matchStrings(match, testStr, matchPartial)) - return ret; - } - - // Try to match volume label (always quoted). - if (bvr->description) - { - // Gather volume label into tempStr. - bvr->description(bvr, tempStr, sizeof(tempStr) - 1); - len = strlen(tempStr); - if (len == 0) - return NULL; - - sprintf(testStr, "\"%s\"", tempStr); - if (ret = matchStrings(match, testStr, matchPartial)) - return ret; - } - - return NULL; + return 0; + + if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 ) + return 0; + + // Try to match hd(x,y) first. + sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no); + if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + return true; + + // Try to match volume UUID. + if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0) + { + if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + return true; + } + + // Try to match volume label (always quoted). + if ( bvr->description ) + { + bvr->description(bvr, testStr, sizeof(testStr)-1); + if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + return true; + } + + return false; } -/* If Rename Partition has defined an alias, then extract it for description purpose */ -bool getVolumeLabelAlias( BVRef bvr, char* str, long strMaxLen) +/* If Rename Partition has defined an alias, then extract it for description purpose + * The format for the rename string is the following: + * hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ... + */ + +bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen) { - /* The format for the rename string is the following: - * hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ... - */ - char *aliasList, *next; + char *aliasList, *entryStart, *entryNext; if ( !str || strMaxLen <= 0) return false; @@ -1763,61 +1744,39 @@ aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->bootConfig)); if ( !aliasList ) return false; - - next = aliasList; - while ( next && *next ) + + for ( entryStart = entryNext = aliasList; + entryNext && *entryNext; + entryStart = entryNext ) { - char *start, *aliasStart, *aliasEnd; - char *ret; + char *volStart, *volEnd, *aliasStart; + long volLen, aliasLen; - start = aliasStart = (char*)matchVolumeToString(bvr, next, true); - if ( !start || !*start ) - break; - - /* Find and delimit the current entry's end */ - next = strstr(start, ";"); - if ( next ) + // Delimit current entry + entryNext = strchr(entryStart, ';'); + if ( entryNext ) { - /* Not enough characters for a successful match: we'd need at least - * one space and another char. before the semicolon - */ - if ( next-start < 2 ) { - next++; - continue; - } - - *next = '\0'; - next++; + *entryNext = '\0'; + entryNext++; } - /* Check for at least one space, but ignore the rest of them */ - while ( isspace(*aliasStart) ) - aliasStart++; - if ( start == aliasStart ) + volStart = strbreak(entryStart, &volEnd, &volLen); + if(!volLen) continue; - - switch ( *aliasStart ) - { - case '\0': - break; - case '"': - /* If a starting quote is found, skip it, then find the ending one, - * and replace it for a string terminator. - */ - aliasStart++; - aliasEnd = strstr(aliasStart, "\""); - if ( !aliasEnd || aliasStart == aliasEnd ) - break; - - *aliasEnd = '\0'; - default: - ret = strncpy(str, aliasStart, strMaxLen); - free(aliasList); - - return ret != 0; + + aliasStart = strbreak(volEnd, 0, &aliasLen); + if(!aliasLen) + continue; + + if ( matchVolumeToString(bvr, volStart, volLen) ) + { + strncpy(str, aliasStart, min(strMaxLen, aliasLen)); + free(aliasList); + + return true; } } - + free(aliasList); return false; } @@ -1846,8 +1805,7 @@ /* See if a partition rename is preferred */ if(getVolumeLabelAlias(bvr, p, strMaxLen)) { - verbose("Renamed: %s\n", p); - strncpy(bvr->label, p, sizeof(bvr->label) - 1); + strncpy(bvr->label, p, strMaxLen); return; // we're done here no need to seek for real name } @@ -1873,7 +1831,7 @@ } // Set the devices label - strncpy(bvr->label, p, sizeof(bvr->label)-1); + sprintf(bvr->label, p); } //========================================================================== Index: branches/azimutz/CleanCut/i386/libsaio/disk.h =================================================================== --- branches/azimutz/CleanCut/i386/libsaio/disk.h (revision 432) +++ branches/azimutz/CleanCut/i386/libsaio/disk.h (revision 433) @@ -9,6 +9,6 @@ #ifndef __LIBSAIO_DISK_H #define __LIBSAIO_DISK_H -char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial); +bool matchVolumeToString( BVRef bvr, const char* match, long strMaxLen); #endif /* __LIBSAIO_DISK_H */ \ No newline at end of file Index: branches/azimutz/CleanCut/i386/boot2/options.c =================================================================== --- branches/azimutz/CleanCut/i386/boot2/options.c (revision 432) +++ branches/azimutz/CleanCut/i386/boot2/options.c (revision 433) @@ -113,7 +113,7 @@ position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) ); char dummy[80]; - getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true ); + getBootVolumeDescription( gBootVolume, dummy, 80, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); @@ -783,7 +783,7 @@ strlcpy(prompt, val, cnt); } else { name = malloc(80); - getBootVolumeDescription(gBootVolume, name, sizeof(name) - 1, false); + getBootVolumeDescription(gBootVolume, name, 80, false); prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); @@ -860,7 +860,7 @@ // Associate a menu item for each BVRef. for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) { if (bvr->visible) { - getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[0].name) - 1, true); + getBootVolumeDescription(bvr, menuItems[i].name, 80, true); menuItems[i].param = (void *) bvr; if (bvr == menuBVR) { selectIndex = i; Index: branches/azimutz/CleanCut/i386/libsa/libsa.h =================================================================== --- branches/azimutz/CleanCut/i386/libsa/libsa.h (revision 432) +++ branches/azimutz/CleanCut/i386/libsa/libsa.h (revision 433) @@ -107,6 +107,9 @@ extern int strncasecmp(const char * s1, const char * s2, size_t n); #endif +extern char * strchr(const char *str, int c); +extern char * strbreak(const char *str, char **next, long *len); + extern uint8_t checksum8( void * start, unsigned int length ); /* Index: branches/azimutz/CleanCut/i386/libsa/string.c =================================================================== --- branches/azimutz/CleanCut/i386/libsa/string.c (revision 432) +++ branches/azimutz/CleanCut/i386/libsa/string.c (revision 433) @@ -257,6 +257,55 @@ } #endif +char* strchr(const char *str, int c) +{ + do + { + if(*str == c) + return (char*)str; + } + while(*(str++)); + + return 0; +} + +char* strbreak(const char *str, char **next, long *len) +{ + char *start = (char*)str, *end; + bool quoted = false; + + if ( !start || !len ) + return 0; + + *len = 0; + + while ( isspace(*start) ) + start++; + + if (*start == '"') + { + start++; + + end = strchr(start, '"'); + if(end) + quoted = true; + else + end = strchr(start, '\0'); + } + else + { + for ( end = start; *end && !isspace(*end); end++ ) + {} + } + + *len = end - start; + + if(next) + *next = quoted ? end+1 : end; + + return start; +} + /* COPYRIGHT NOTICE: checksum8 from AppleSMBIOS */ uint8_t checksum8( void * start, unsigned int length ) {