void handle_line(char *buf, int start, int stop)
{
char *wrap_ptr;
int wrap_pos;
char *stop_ptr;
int stop_pos;
char *ptr;
int pos;
int cnt;
wrap_pos = 0;
stop_pos = 0;
pos = 0;
cnt = -1;
for(ptr = buf; (*ptr != '\0'); ptr++)
{
pos++;
if (*ptr != '\n')
continue;
++cnt;
if (cnt == start)
{
wrap_ptr = ptr+1;
wrap_pos = pos;
continue;
}
if (cnt == stop)
{
printf("%s", ptr);
stop_ptr = ptr+1;
stop_pos = pos;
break;
}
}
printf("%d %d\r\n", wrap_pos, stop_pos);
printf("PRE:\r\n%*.*s\r\n", 0,wrap_pos, buf);
printf("Wrap:\r\n%*.*s\r\n", 0,(stop_pos-wrap_pos), wrap_ptr);
printf("POST:\r\n%s\r\n", stop_ptr);
}
Sat Mar 10 02:05:33 2007 :: [*****] BUG: Attempt to recyle invalid memory of size 14.
Sat Mar 10 02:05:33 2007 :: [*****] BUG: I wana wrap:
Sat Mar 10 02:05:33 2007 :: [****] BUG FILE: comm.c LINE: 3528
Sat Mar 10 02:05:33 2007 :: [*****] BUG: Attempt to recyle invalid memory of size 32.
at Mar 10 02:05:33 2007 :: [*****] BUG:
this
this
this
and this
Sat Mar 10 02:05:33 2007 :: [****] BUG FILE: comm.c LINE: 3625
Sat Mar 10 02:05:33 2007 :: [*****] BUG: Attempt to recyle invalid memory of size 32.
at Mar 10 02:05:33 2007 :: [*****] BUG:
this
this
this
and this
Sat Mar 10 02:05:33 2007 :: [****] BUG FILE: comm.c LINE: 3531
Sat Mar 10 02:05:33 2007 :: [*****] BUG: Attempt to recyle invalid memory of size 10.
Sat Mar 10 02:05:33 2007 :: [*****] BUG: together
Sat Mar 10 02:05:33 2007 :: [****] BUG FILE: comm.c LINE: 3534
WrapLines:
buffer = new_buf();
sprintf(buf3, "%*.*s", 0, wrap_pos, buf);
add_buf(buffer, buf3);
(3528) free_string(buf3);
sprintf(buf3, "%*.*s", 0, (stop_pos-wrap_pos), wrap_ptr);
add_buf(buffer, wraptext(buf3));
(3531) free_string(buf3);
sprintf(buf3, "%s", stop_ptr);
add_buf(buffer, buf3);
(3534) free_string(buf3);
WrapText:
(3624) free_string(text);
return str_dup(wrap2);
if (!start)
{
wrap_ptr = ptr;
wrap_pos = 0;
}
I want to wrap line <a> to <b> but leave that stuff before <a> and after <b> alone, i seem to have been having some quiant difficulty in doing so.
I do, have a text wrapper i made, but i want the wrap_lines to be seperate from it like wrap_lines(txt, <a>, <b>)
since im not the smartest in the world, what i wrote came up as:
(PSTR jus mean char*)
but, apparently that dun work, or i wouldnt be here, asking for help.