1570af302Sopenharmony_ci// commit: 5efc6af4ebb9d50eb978d0338835544fdfea0396 2011-04-25 2570af302Sopenharmony_ci// scanf misreports bytes consumed when EOF is hit (or null for sscanf) 3570af302Sopenharmony_ci#include <stdio.h> 4570af302Sopenharmony_ci#include "test.h" 5570af302Sopenharmony_ci 6570af302Sopenharmony_ciint main(void) 7570af302Sopenharmony_ci{ 8570af302Sopenharmony_ci char buf[] = { 'a', 'a', 0 }; 9570af302Sopenharmony_ci char dest[3]; 10570af302Sopenharmony_ci int read_count; 11570af302Sopenharmony_ci int n; 12570af302Sopenharmony_ci 13570af302Sopenharmony_ci n = sscanf(buf, "%s%n", dest, &read_count); 14570af302Sopenharmony_ci if(n != 1) 15570af302Sopenharmony_ci t_error("sscanf matched 1 input items but returned %d\n", n); 16570af302Sopenharmony_ci if(read_count != 2) 17570af302Sopenharmony_ci t_error("sscanf consumed 2 bytes but reported %d\n", read_count); 18570af302Sopenharmony_ci return t_status; 19570af302Sopenharmony_ci} 20