mirror of
https://github.com/louisrubet/rpn
synced 2025-01-05 11:01:52 +01:00
version and uname are now real strings
This commit is contained in:
parent
d958280b0c
commit
0d7afaa9a8
1 changed files with 38 additions and 2 deletions
|
@ -98,10 +98,46 @@ void sci()
|
||||||
|
|
||||||
void rpn_version()
|
void rpn_version()
|
||||||
{
|
{
|
||||||
cout << version << endl;
|
int naked_entry_len;
|
||||||
|
int obj_len;
|
||||||
|
ostring* str;
|
||||||
|
|
||||||
|
// entry length without prefix / postfix
|
||||||
|
naked_entry_len = (int)strlen(version);
|
||||||
|
|
||||||
|
// total object length
|
||||||
|
obj_len = sizeof(ostring)+naked_entry_len+1;
|
||||||
|
|
||||||
|
// allocate object
|
||||||
|
str = (ostring*)malloc(obj_len);
|
||||||
|
|
||||||
|
// set it
|
||||||
|
str->set(version, naked_entry_len);
|
||||||
|
|
||||||
|
// push in stack
|
||||||
|
_stack->push_back(str, str->size(), cmd_string);
|
||||||
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpn_uname()
|
void rpn_uname()
|
||||||
{
|
{
|
||||||
cout << uname << endl;
|
int naked_entry_len;
|
||||||
|
int obj_len;
|
||||||
|
ostring* str;
|
||||||
|
|
||||||
|
// entry length without prefix / postfix
|
||||||
|
naked_entry_len = (int)strlen(uname);
|
||||||
|
|
||||||
|
// total object length
|
||||||
|
obj_len = sizeof(ostring)+naked_entry_len+1;
|
||||||
|
|
||||||
|
// allocate object
|
||||||
|
str = (ostring*)malloc(obj_len);
|
||||||
|
|
||||||
|
// set it
|
||||||
|
str->set(uname, naked_entry_len);
|
||||||
|
|
||||||
|
// push in stack
|
||||||
|
_stack->push_back(str, str->size(), cmd_string);
|
||||||
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue