diff options
author | Lukas Larsson <[email protected]> | 2013-08-21 15:21:04 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2013-08-21 15:21:04 +0200 |
commit | b80f30417fce361ebb19a13a471090165b7ad1c8 (patch) | |
tree | a87b8f0b9bcbc782a137f08f2e240d0c4fb887e4 /erts/emulator/beam/utils.c | |
parent | a27e9776c839aa9fed9e71e3d06a33720377e293 (diff) | |
parent | a6e883426efb5b205122e85a4f868647e31206c5 (diff) | |
download | otp-b80f30417fce361ebb19a13a471090165b7ad1c8.tar.gz otp-b80f30417fce361ebb19a13a471090165b7ad1c8.tar.bz2 otp-b80f30417fce361ebb19a13a471090165b7ad1c8.zip |
Merge branch 'lukas/erts/static_nifs/OTP-11258'
* lukas/erts/static_nifs/OTP-11258:
erts: Document --enable-static-nif/driver
erts: Add support for static linked-in drivers
erts: Add option to include nifs statically
Diffstat (limited to 'erts/emulator/beam/utils.c')
-rw-r--r-- | erts/emulator/beam/utils.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c index c71f8f0712..6293286c75 100644 --- a/erts/emulator/beam/utils.c +++ b/erts/emulator/beam/utils.c @@ -4019,6 +4019,27 @@ erts_smp_ensure_later_interval_acqb(erts_interval_t *icp, Uint64 ic) #endif } +const char *erts_basename(const char* path, char* buff) { + /* This function is not compliant with bash basename. Edge cases like "//" + and "/path//" do not work properly. + */ + int i; + int len = strlen(path); + const char *basename = path; + for (i = 0; path[i] != '\0'; i++) { + if (path[i] == '/') { + if (path[i+1] == '\0') { + memcpy(buff,basename,len - (basename-path)); + buff[len - (basename-path)-1] = '\0'; + basename = buff; + break; + } else { basename = path+i;} + } + } + if (basename == path) + return path; + return basename+1; +} /* * A millisecond timestamp without time correction where there's no hrtime |