I don't think it does what the programmer intended. I suspect it was supposed to be something like
Code:
scanf("%31[^\r\n]%*[\t\n\v\f\r ]", rule[i])
assuming rule[i] has space for at least 32 chars (31 plus the trailing '\0').
scanf("%s[^\n]%*c", rule[i]) means:
%s Read a string up to the next whitespace, hoping that the buffer is long enough
[^\n] Expect [ followed by a ^ followed by any amount of whitespace, including none, then ]
%*c Consume one character of input, but don't save it anywhere
On the other hand, scanf("%31[^\r\n]%*[\t\n\v\f\r ]", string) means:
%31[^\r\n] Read up to 31 characters (not newlines, CR or LF)
%*[\t\n\v\f\r ] Read all newlines and whitespace characters, but don't store them