[image] Split image_strip_suffix() out from image_extract()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-08-29 13:08:27 +01:00
parent 748cab7745
commit 49404bfea9
3 changed files with 22 additions and 5 deletions

View File

@@ -172,6 +172,25 @@ int image_set_name ( struct image *image, const char *name ) {
return 0;
}
/**
* Strip dot suffix from image name, if present
*
* @v image Image
* @ret sep Position of old dot separator, or NULL
*/
char * image_strip_suffix ( struct image *image ) {
char *dot;
/* Locate and strip suffix, if present */
if ( image->name &&
( ( dot = strrchr ( image->name, '.' ) ) != NULL ) ) {
*dot = '\0';
return dot;
}
return NULL;
}
/**
* Set image command line
*