Quicky GAS question
Dave Korn
dave.korn@artimi.com
Tue Apr 26 11:56:00 GMT 2005
Is it legitimate to alter the chars in the input buffer? I couldn't help
but notice that input_line_pointer isn't declared const :) I want to output
a string by doing something like....
char *message_start;
SKIP_WHITESPACE ();
message_start = input_line_pointer;
while ((input_line_pointer < buffer_limit)
&& !is_end_of_line[(unsigned char) *input_line_pointer])
input_line_pointer++;
if (input_line_pointer != message_start)
{
*input_line_pointer++ = 0;
as_bad (_("%s"), message_start);
}
... where I'm writing a zero to the buffer to terminate the string. I
notice that s_errwarn uses demand_copy_C_string, so I suppose there may be
some problem here, but I'm not sure what it is.
Alternatively, does as_bad fully understand printf-style field size
specifiers? That would let me write the message without needing to
nul-terminate it by saying
size_t length = input_line_pointer - message_start;
as_bad (_("%*.*s"), length, length, message_start);
cheers,
DaveK
--
Can't think of a witty .sigline today....
More information about the Binutils
mailing list