-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add gethostname implementation #224
Conversation
Oops, psputils.h and psputility.h are not the same thing... |
I did a little test with this and it does work. Here is my testing code. main.c:
CMakeLists.txt:
I'm not sure if we should be using the nickname, though. I think it would probably make more sense to just set it to |
Hmmm, I need to test it. I got the same code working in my project, so I must've made a mistake when copying it to libcglue.c. |
It actually works, I just thought using the nickname is a bit odd and I added the code I used to test to make it a bit easier for others to also review this. |
I wonder what is the shortest and the longest nickname that can be set? And how does it compare to |
I think the limit is 128 characters, but I don't think anyone would actually use a nickname that long. |
Thanks for the PR @tpimh and testing @sharkwouter! I'll also add my review a bit to this one because we're on the same page as my PR #209 and I'll base my judgment on that. |
I was thinking about implementing |
Sure! Feel free to make a separate PR for that. Also, it's much better that every function is separate and corresponds to each object file. Please stick with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great and looks good now, thanks!
int gethostname (char *__name, size_t __len) { | ||
char nickname[_SC_HOST_NAME_MAX]; | ||
memset(nickname, 0, _SC_HOST_NAME_MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this memset looks superfluous, in the worst case if sceUtilityGetSystemParamString requires a valid C string as input, which seems unlikely, nickname[0] = 0;
should be sufficient.
PSP doesn't really has a hostname, however it has a nickname that can serve the same function. Been playing around with PSP networking recently, and the lack of this function was a bit frustrating. This is a very simple replacement function that I came up with.