Skip to content

Printf 01 - #300

Merged
stsp merged 2 commits into
dosemu2:masterfrom
andrewbird:printf-01
Jul 11, 2026
Merged

Printf 01#300
stsp merged 2 commits into
dosemu2:masterfrom
andrewbird:printf-01

Conversation

@andrewbird

@andrewbird andrewbird commented Jul 9, 2026

Copy link
Copy Markdown
Member

First draft of using a printf replacement, and added enhancements to support %P and %Fs.

@andrewbird andrewbird mentioned this pull request Jul 9, 2026
Comment thread kernel/prf-old.c Outdated
Comment thread fdpp/thunks_priv.h
Comment thread kernel/stb_sprintf.h Outdated
@stsp

stsp commented Jul 9, 2026

Copy link
Copy Markdown
Member

It would be good to split into
2 PR, although as you wish.

1/ Import stb_sprintf.h from https://github.com/nothings/stb at
   commit 31c1ad3745 under the licence choice of MIT.

2/ Markup stb_sprintf.h, with our choice of licence at the top,
   so it's prominent and clear which applies in our case.

3/ Remove old prf.c

4/ Create new prf.c to import the new stb_sprintf.h and wrap various
   functions.
@stsp

stsp commented Jul 10, 2026

Copy link
Copy Markdown
Member

LGTM.

@andrewbird
andrewbird marked this pull request as ready for review July 10, 2026 20:26
@andrewbird
andrewbird marked this pull request as draft July 10, 2026 22:27
@andrewbird

Copy link
Copy Markdown
Member Author

Seems to be a problem with zero padding with %P, old code prints '0090:00b7', new '90:00B7'

@andrewbird

Copy link
Copy Markdown
Member Author

Okay, I have a fix for the field width.

Next question I had to choose upper or lower case hex for %P. I chose upper, but it seems the old implementation was lower. Which would you like upper or lower?

@stsp

stsp commented Jul 11, 2026

Copy link
Copy Markdown
Member

I don't mind.
So if old was lower, feel free to
mimic that.

@andrewbird

Copy link
Copy Markdown
Member Author

I think I'll split this PR into printf and debug parts, so just the first two patches for this PR, okay?

@andrewbird
andrewbird marked this pull request as ready for review July 11, 2026 08:22
@stsp

stsp commented Jul 11, 2026

Copy link
Copy Markdown
Member

Of course the split is okey.

@andrewbird

Copy link
Copy Markdown
Member Author

Okay, so just the two patches now for printf replacement. I fixed the field width and made the values lowercase hex. The output log compares very well with master, with only the host pointers and random FLOPPY messages differing.

@stsp
stsp merged commit e00e886 into dosemu2:master Jul 11, 2026
2 checks passed
@stsp

stsp commented Jul 11, 2026

Copy link
Copy Markdown
Member

Thanks!
This is a great work that improves
reliability and security.

@andrewbird
andrewbird deleted the printf-01 branch July 11, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants