Skip to content

Add stpncpy implementation#6

Merged
sachintu47 merged 1 commit into
zopen2from
add_stpncpy
May 15, 2026
Merged

Add stpncpy implementation#6
sachintu47 merged 1 commit into
zopen2from
add_stpncpy

Conversation

@sachintu47
Copy link
Copy Markdown
Member

@sachintu47 sachintu47 commented May 14, 2026

Add stpncpy implementation

@sachintu47 sachintu47 requested a review from sabi789 May 14, 2026 12:14
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

@sachintu47 sachintu47 marked this pull request as ready for review May 14, 2026 12:16
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 14, 2026

🤖 Augment PR Summary

Summary: This PR adds a z/OS implementation of stpncpy to provide GNU-style bounded string copy support.

Changes:

  • Exposes stpncpy(char*, const char*, size_t) in include/string.h
  • Implements stpncpy in src/zos-string.c using strnlen, memcpy, and NUL-padding
  • Adds GoogleTest coverage for short-source padding, truncation, exact-length, and n==0 cases

Technical Notes: The implementation returns dest + len when padded and dest + n when truncated, matching typical stpncpy semantics.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/zos-string.c Outdated
Comment thread test/test-strings.cc Outdated
Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/zos-string.c Outdated
Comment thread test/test-strings.cc Outdated
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread test/test-strings.cc Outdated
@sachintu47
Copy link
Copy Markdown
Member Author

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

Copy link
Copy Markdown
Member

@sabi789 sabi789 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sachintu47 sachintu47 merged commit 9e7af0a into zopen2 May 15, 2026
1 of 2 checks passed
@sachintu47 sachintu47 deleted the add_stpncpy branch May 15, 2026 13:18
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