mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-23 10:50:49 +00:00
LibC: Implement getprogname and setprogname
This commit is contained in:
parent
a3b4e43dd8
commit
cd970928a0
Notes:
sideshowbarker
2024-07-18 17:10:00 +09:00
Author: https://github.com/timschumi
Commit: cd970928a0
Pull-request: https://github.com/SerenityOS/serenity/pull/7537
2 changed files with 21 additions and 0 deletions
|
@ -373,6 +373,25 @@ int putenv(char* new_var)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const char* __progname = NULL;
|
||||
|
||||
const char* getprogname()
|
||||
{
|
||||
return __progname;
|
||||
}
|
||||
|
||||
void setprogname(const char* progname)
|
||||
{
|
||||
for (int i = strlen(progname) - 1; i >= 0; i--) {
|
||||
if (progname[i] == '/') {
|
||||
__progname = progname + i + 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
__progname = progname;
|
||||
}
|
||||
|
||||
double strtod(const char* str, char** endptr)
|
||||
{
|
||||
// Parse spaces, sign, and base
|
||||
|
|
|
@ -31,6 +31,8 @@ int putenv(char*);
|
|||
int unsetenv(const char*);
|
||||
int clearenv(void);
|
||||
int setenv(const char* name, const char* value, int overwrite);
|
||||
const char* getprogname();
|
||||
void setprogname(const char*);
|
||||
int atoi(const char*);
|
||||
long atol(const char*);
|
||||
long long atoll(const char*);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue