Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit098c63c

Browse files
committed
Porting efforts... :)
1 parentee00b75 commit098c63c

File tree

1 file changed

+41
-37
lines changed

1 file changed

+41
-37
lines changed

‎src/backend/port/snprintf.c

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@
3131
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3232
* SUCH DAMAGE.
3333
*/
34-
34+
#if0
3535
# include"sendmail.h"
3636
# include"pathnames.h"
37+
#endif
38+
39+
# include"postgres.h"
40+
41+
# include<stdarg.h>
42+
# defineVA_LOCAL_DECL va_list args;
43+
# defineVA_START(f) va_start(args, f)
44+
# defineVA_END va_end(args)
45+
3746
# include<sys/ioctl.h>
3847
# include<sys/param.h>
3948

@@ -59,50 +68,43 @@
5968
* causing nast effects.
6069
**************************************************************/
6170

62-
/*static char _id[] = "$Id: snprintf.c,v 1.4 1998/09/04 14:34:23 scrappy Exp $";*/
63-
staticvoiddopr();
71+
/*static char _id[] = "$Id: snprintf.c,v 1.5 1998/09/10 04:11:52 vadim Exp $";*/
6472
staticchar*end;
6573
staticintSnprfOverflow;
6674

67-
/* VARARGS3 */
75+
intsnprintf(char*str,size_tcount,constchar*fmt, ...);
76+
intvsnprintf(char*str,size_tcount,constchar*fmt, ...);
77+
staticvoiddopr (char*buffer,constchar*format, ... );
78+
6879
int
69-
# ifdef__STDC__
7080
snprintf(char*str,size_tcount,constchar*fmt, ...)
71-
# else
72-
snprintf(str,count,fmt,va_alist)
73-
char*str;
74-
size_tcount;
75-
constchar*fmt;
76-
va_dcl
77-
#endif
7881
{
7982
intlen;
8083
VA_LOCAL_DECL
8184

8285
VA_START(fmt);
83-
len=vsnprintf(str,count,fmt,ap);
86+
len=vsnprintf(str,count,fmt,args);
8487
VA_END;
8588
returnlen;
8689
}
8790

8891

89-
# ifndefluna2
9092
int
91-
vsnprintf(str,count,fmt,args)
92-
char*str;
93-
size_tcount;
94-
constchar*fmt;
95-
va_listargs;
93+
vsnprintf(char*str,size_tcount,constchar*fmt, ...)
9694
{
95+
VA_LOCAL_DECL
96+
97+
VA_START(fmt);
9798
str[0]=0;
9899
end=str+count-1;
99100
SnprfOverflow=0;
100-
dopr(str,fmt,args);
101+
dopr(str,fmt,args);
101102
if (count>0)
102103
end[0]=0;
103-
if (SnprfOverflow&&tTd(57,2))
104-
printf("\nvsnprintf overflow, len = %d, str = %s",
105-
count,shortenstring(str,203));
104+
if (SnprfOverflow)
105+
elog(NOTICE,"vsnprintf overflow, len = %d, str = %s",
106+
count,str);
107+
VA_END;
106108
returnstrlen(str);
107109
}
108110

@@ -117,20 +119,20 @@ static char *output;
117119
staticvoiddopr_outch__P((intc ));
118120

119121
staticvoid
120-
dopr(buffer,format,args )
121-
char*buffer;
122-
constchar*format;
123-
va_listargs;
122+
dopr (char*buffer,constchar*format, ... )
124123
{
125-
intch;
126-
longvalue;
127-
intlongflag=0;
128-
intpointflag=0;
129-
intmaxwidth=0;
130-
char*strvalue;
131-
intljust;
132-
intlen;
133-
intzpad;
124+
intch;
125+
longvalue;
126+
intlongflag=0;
127+
intpointflag=0;
128+
intmaxwidth=0;
129+
char*strvalue;
130+
intljust;
131+
intlen;
132+
intzpad;
133+
VA_LOCAL_DECL
134+
135+
VA_START(format);
134136

135137
output=buffer;
136138
while( (ch=*format++) ){
@@ -143,6 +145,7 @@ dopr( buffer, format, args )
143145
switch(ch ){
144146
case0:
145147
dostr("**end of format**" ,0);
148+
VA_END;
146149
return;
147150
case'-':ljust=1; gotonextch;
148151
case'0':/* set zero padding if len not set */
@@ -222,6 +225,7 @@ dopr( buffer, format, args )
222225
}
223226
}
224227
*output=0;
228+
VA_END;
225229
}
226230

227231
staticvoid
@@ -340,4 +344,4 @@ dopr_outch( c )
340344
SnprfOverflow++;
341345
}
342346

343-
# endif/* !luna2 */
347+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp