Skip to content

feat(libc): implement strsep - #2187

Closed
AchrafReyani wants to merge 1 commit into
boykopovar:mainfrom
AchrafReyani:feat/libc-strsep
Closed

AchrafReyani wants to merge 1 commit into
boykopovar:mainfrom
AchrafReyani:feat/libc-strsep

Conversation

@AchrafReyani

Copy link
Copy Markdown
Contributor

What

Exports strsep with FreeBSD's semantics (lib/libc/string/strsep.c):

  • It returns the token at *stringp, ending at the first delimiter.
  • The delimiter is overwritten with NUL, and *stringp advances past it.
  • Empty fields are returned, unlike strtok.
  • When no delimiter is left, *stringp becomes NULL; with *stringp == NULL it returns NULL.

Title: PPSA99169 RetroArch imports it from libSceLibcInternal (resolved through libc.prx), per the #1578 audit. I haven't run the title.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Release, -DBUILD_TESTING=ON:

  • New checks in guest_string_tests, next to the strtok cases:
    • a leading empty field and an empty middle field (",a,,b;c" with ",;");
    • the cursor after each call and NULL after the last token;
    • NULL once exhausted;
    • an empty delimiter set returns the whole string;
    • an empty string returns "" and then NULL.
  • Mutation check: delegating to strtok_r, which skips empty fields, makes guest_strings fail.
  • cmake --build build --target libs: the patched libc.prx exports cJWGxiQPmDQ.
  • tools/check_conventions.py passes, and tools/pr_overlap.py --branch reports no overlap. The function is placed away from the lines feat(libc): implement stpcpy #1812, feat(libc): implement __inet_aton #1848 and feat(libc): implement __inet_addr #1972 change.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

Split at the first delimiter like FreeBSD's strsep: empty fields are
returned, and the cursor becomes null after the last token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Progress report (d70b899 → 804674f)

📈 System libraries: 84.7% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libc strsep_nid_postfix

@github-actions github-actions Bot added the libc label Oct 9, 2026
@AchrafReyani

Copy link
Copy Markdown
Contributor Author

Full Linux and Windows builds and tests for this head (804674f2), using the project's Build workflow. I can't start the upstream manual run, so I ran the same build.yml in my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into current main (d70b8998):

Job Result
linux success; full build, ctest: 516/516 passed
windows success; full build, ctest: 507/507 passed
relinker (Linux, Windows, macOS) success

Run: https://github.com/AchrafReyani/AnyPS5/actions/runs/37921802565

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Same as #2167, for strsep.

ycbuzi pushed a commit to ycbuzi/AnyPS5 that referenced this pull request Oct 10, 2026
Harvested from upstream (closed unmerged); library completion 2882/3258 -> 2883/3259.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011krDVCnnMQPaEFEqCDnKmA
@babyhuey

Copy link
Copy Markdown
Contributor

@AchrafReyani strsep is now a title's next stop on main. With execvp (#2827) merged, VLC (PPSA85300) on main 06da117 reports this on Linux (catalog build, sce_module/libc.prx unwrapped as #2605 requires):

app.elf: symbol lookup error: app.elf: undefined symbol: cJWGxiQPmDQ

This head (804674f) merges cleanly onto 06da117, guest_strings passes 5/5 (--repeat until-fail:5), and VLC then stops at nanf (DZU+K1wozGI).

@AchrafReyani

Copy link
Copy Markdown
Contributor Author

Thanks @babyhuey, resubmitted as #3192, rebased onto current main with your stop.

@AchrafReyani AchrafReyani mentioned this pull request Oct 11, 2026
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants