mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2024-12-27 06:27:57 +00:00
(remove_comments): Use find_char_unquote.
This commit is contained in:
parent
9b0a99a051
commit
117d4e0f36
1 changed files with 5 additions and 28 deletions
33
misc.c
33
misc.c
|
@ -124,36 +124,13 @@ void
|
||||||
remove_comments (line)
|
remove_comments (line)
|
||||||
char *line;
|
char *line;
|
||||||
{
|
{
|
||||||
register char *p, *p2;
|
char *comment;
|
||||||
register int backslash;
|
|
||||||
register unsigned int bs_write;
|
|
||||||
|
|
||||||
while (1)
|
comment = find_char_unquote (line, '#', 0);
|
||||||
{
|
|
||||||
p = index (line, '#');
|
|
||||||
if (p == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
backslash = 0;
|
if (comment != 0)
|
||||||
bs_write = 0;
|
/* Cut off the line at the #. */
|
||||||
for (p2 = p - 1; p2 >= line && *p2 == '\\'; --p2)
|
*comment = '\0';
|
||||||
{
|
|
||||||
if (backslash)
|
|
||||||
++bs_write;
|
|
||||||
backslash = !backslash;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!backslash)
|
|
||||||
{
|
|
||||||
/* Cut off the line at the #. */
|
|
||||||
*p = '\0';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* strcpy better copy left to right. */
|
|
||||||
line = p;
|
|
||||||
strcpy (p2 + 1 + bs_write, line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print N spaces (used by DEBUGPR for target-depth). */
|
/* Print N spaces (used by DEBUGPR for target-depth). */
|
||||||
|
|
Loading…
Reference in a new issue