aboutsummaryrefslogtreecommitdiff
path: root/src/fstring.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-11-30 16:02:04 +0000
committerMike Buland <eichlan@xagasoft.com>2007-11-30 16:02:04 +0000
commit4d0a7466320e54f45f413efef09ef8e6ad21bb3e (patch)
tree8b2d7d6dc4454b44aa23e189bf46dcee968964c3 /src/fstring.h
parented402db706488ab910b7c810684379cc2d7b7662 (diff)
downloadlibbu++-4d0a7466320e54f45f413efef09ef8e6ad21bb3e.tar.gz
libbu++-4d0a7466320e54f45f413efef09ef8e6ad21bb3e.tar.bz2
libbu++-4d0a7466320e54f45f413efef09ef8e6ad21bb3e.tar.xz
libbu++-4d0a7466320e54f45f413efef09ef8e6ad21bb3e.zip
Added some helpers to fstring, and fixed a bug in Bu::Process, it wasn't closing
the pipes properly, resulting in the child process going defunct and not dying, it also wasn't buffering properly, it now collects as much data as it can before returning from a read operation.
Diffstat (limited to 'src/fstring.h')
-rw-r--r--src/fstring.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h
index 666480c..82e8b34 100644
--- a/src/fstring.h
+++ b/src/fstring.h
@@ -731,6 +731,39 @@ namespace Bu
731 } 731 }
732 return -1; 732 return -1;
733 } 733 }
734
735 /**
736 * Find the index of the first occurrance of cChar
737 *@param sText (const chr *) The string to search for.
738 *@returns (long) The index of the first occurrance. -1 for not found.
739 */
740 long find( long iStart, const chr cChar ) const
741 {
742 flatten();
743 for( long j = iStart; j < pFirst->nLength; j++ )
744 {
745 if( pFirst->pData[j] == cChar )
746 return j;
747 }
748 return -1;
749 }
750
751 /**
752 * Find the index of the first occurrance of sText
753 *@param cChar (const chr) The character to search for.
754 *@returns (long) The index of the first occurrance. -1 for not found.
755 */
756 long find( long iStart, const chr *sText ) const
757 {
758 long nTLen = strlen( sText );
759 flatten();
760 for( long j = iStart; j < pFirst->nLength-nTLen; j++ )
761 {
762 if( !strncmp( sText, pFirst->pData+j, nTLen ) )
763 return j;
764 }
765 return -1;
766 }
734 767
735 /** 768 /**
736 * Do a reverse search for (sText) 769 * Do a reverse search for (sText)