mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
LibC: Implement getprogname and setprogname
This commit is contained in:
parent
a3b4e43dd8
commit
cd970928a0
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