Commit 8b7ec38
notlibc.c
@@ -1217,6 +1217,10 @@ Status FileView_from_path( const Str *path, usize claim_amount, usize flags, Fil
return FileView_from_file(&file, claim_amount, flags, out);
}
+StrSlc FileView_as_StrSlc( const FileView *fv ) {
+ return (StrSlc){ .len = fv->filesize, .data = (const u8*)fv->start };
+}
+
Status FileView_extend_file( FileView *fv, usize amount ) {
if( amount > fv->claimed - fv->filesize ) {
return S_FAILURE | ERR_OUT_OF_BOUND;
notlibc.h
@@ -1482,11 +1482,14 @@ Status FileView_from_file( File *file, usize claim_amount, usize flags, FileView
* control over the opening flags use FileView_from_file */
Status FileView_from_path( const Str *path, usize claim_amount, usize flags, FileView *out );
+StrSlc FileView_as_StrSlc( const FileView *fv );
+
/* Extend the file's end by amount */
Status FileView_extend_file( FileView *fv, usize amount );
Status FileView_destroy( FileView *fv );
+
/*=========================== Core functions =================================*/
void terminate(u32 code); /* aka exit */