@@ -181,17 +181,29 @@ export fn fprintf(stream: *FILE, format: [*:0]const u8, ...) c_int {
181
181
182
182
export fn sprintf (str : [* :0 ]u8 , format : [* :0 ]const u8 , ... ) c_int {
183
183
debug ("TODO: sprintf: format={s}" , .{format });
184
- _ = memcpy (str , format , strlen (format ));
185
- str [strlen (format )] = 0 ;
184
+ if (strcmp (format , "L.%u" ) == 0 ) {
185
+ const s = "L.0" ;
186
+ _ = memcpy (str , s , strlen (s ));
187
+ str [strlen (s )] = 0 ;
188
+ } else {
189
+ _ = memcpy (str , format , strlen (format ));
190
+ str [strlen (format )] = 0 ;
191
+ }
186
192
debug ("TODO: sprintf: return str={s}" , .{str });
187
193
return @intCast (strlen (str ));
188
194
}
189
195
190
196
export fn snprintf (str : [* :0 ]u8 , size : size_t , format : [* :0 ]const u8 , ... ) c_int {
191
197
debug ("TODO: snprintf: size={}, format={s}" , .{ size , format });
192
198
// TODO: Catch overflow
193
- _ = memcpy (str , format , strlen (format ));
194
- str [strlen (format )] = 0 ;
199
+ if (strcmp (format , ".rela%s" ) == 0 ) {
200
+ const s = ".rela.text" ;
201
+ _ = memcpy (str , s , strlen (s ));
202
+ str [strlen (s )] = 0 ;
203
+ } else {
204
+ _ = memcpy (str , format , strlen (format ));
205
+ str [strlen (format )] = 0 ;
206
+ }
195
207
debug ("TODO: snprintf: return str={s}" , .{str });
196
208
return @intCast (strlen (str ));
197
209
}
0 commit comments