Skip to content
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

Change wtoPrintf3 to use va_list #407

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions c/zos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,8 @@ void wtoMessage(const char *message){
}

#define WTO_MAX_SIZE 126
void wtoPrintf3(const char *formatString, ...) {
void wtoPrintf3(const char *formatString, va_list arg) {
char text[WTO_MAX_SIZE+1]; /* Allow for trailing null character */
va_list argPointer;
int cnt;

for (int pass=0; pass<2; pass++){
Expand All @@ -1515,9 +1514,7 @@ void wtoPrintf3(const char *formatString, ...) {
to every successful request.
*/

va_start(argPointer,formatString);
cnt = vsnprintf(text,sizeof(text),formatString,argPointer);
va_end(argPointer);
cnt = vsnprintf(text,sizeof(text),formatString,arg);

if (cnt<0){
if (pass==0)
Expand Down
8 changes: 7 additions & 1 deletion h/zos.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
#ifndef __ZOS__
#define __ZOS__ 1

#ifdef METTLE
#include <metal/stdarg.h>
#else
#include <stdarg.h>
#endif

#ifndef __LONGNAME__

#define extractPSW EXTRPSW
Expand Down Expand Up @@ -1538,7 +1544,7 @@ int dsabIsOMVS(DSAB *dsab);

void wtoMessage(const char *message);

void wtoPrintf3(const char *formatString, ...);
void wtoPrintf3(const char *formatString, va_list arg);

int locate(char *dsn, int *volserCount, char *firstVolser);

Expand Down
Loading