Blame src/regression/scanf-nullbyte-char.c

Szabolcs Nagy cfa23c
// commit: ef5507867b59d19f21437970e87b5d0415c07b2e 2013-06-22
Szabolcs Nagy cfa23c
// scanf should not append null byte after scanning %c
Szabolcs Nagy cfa23c
#include <stdio.h>
Szabolcs Nagy cfa23c
#include "test.h"
Szabolcs Nagy cfa23c
Szabolcs Nagy cfa23c
int main(void)
Szabolcs Nagy cfa23c
{
Szabolcs Nagy cfa23c
	char dst[] = { 'a', 'a' }; 
Szabolcs Nagy 18e284
	char src[] = { 'b', 'b', 0 };
Szabolcs Nagy cfa23c
Szabolcs Nagy cfa23c
	if (sscanf(src, "%c", dst) != 1)
Szabolcs Nagy cfa23c
		t_error("sscanf %%c failed\n");
Szabolcs Nagy cfa23c
	if (dst[1] != 'a')
Szabolcs Nagy cfa23c
		t_error("scanf clobbered the char buffer for %%c conversion\n");
Szabolcs Nagy cfa23c
	return t_status;
Szabolcs Nagy cfa23c
}