[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnatsd end-of-line termination
From: |
Lars Henriksen |
Subject: |
gnatsd end-of-line termination |
Date: |
Fri, 10 Jan 2003 08:22:16 +0100 |
User-agent: |
Mutt/1.4i |
On Wed, Jan 08, 2003 at 09:18:39PM +0100, Lars Henriksen wrote:
> On Wed, Jan 08, 2003 at 08:14:59PM +0100, Lars Henriksen wrote:
> My "fix" breaks things hopelessly. A closer look at server_print_query()
> reveals that it prints the "\r\n" sequence after every single query result.
> If individual query results have no terminating newline, the results are
> nicely broken into lines; if they have, they are separated by empty lines.
While trying to understand how replies are returned by gnatsd I discovered
that three list commands (list FieldNames, list InitialInputFields and list
InitialRequiredFields) terminate lines with "\n" and not with "\r\n". This is
contrary to the documentation. All other lines are terminated by "\r\n".
Lars Henriksen
Index: lists.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/lists.c,v
retrieving revision 1.20
diff -u -p -r1.20 lists.c
--- lists.c 28 Oct 2002 22:57:50 -0000 1.20
+++ lists.c 10 Jan 2003 07:19:48 -0000
@@ -131,7 +131,7 @@ getGnatsFile (const DatabaseInfo databas
for (x = 0; (f = getNthField (database, x)) != NULL; x++)
{
- fprintf (fpout, "%s\n", fieldDefForIndex (f)->name);
+ fprintf (fpout, "%s%s", fieldDefForIndex (f)->name, eolTerminator);
}
break;
}
@@ -142,7 +142,7 @@ getGnatsFile (const DatabaseInfo databas
for (t = getInputTemplate (database); t != NULL; t = t->next)
{
FieldDef field = fieldDefForIndex (t->index);
- fprintf (fpout, "%s\n", field->name);
+ fprintf (fpout, "%s%s", field->name, eolTerminator);
}
break;
}
@@ -151,7 +151,9 @@ getGnatsFile (const DatabaseInfo databas
FieldList fields = getRequiredInputFields(database);
while (fields != NULL)
{
- fprintf (fpout, "%s\n", complexFieldIndexToString (fields->ent));
+ fprintf (fpout, "%s%s",
+ complexFieldIndexToString (fields->ent),
+ eolTerminator);
fields = fields->next;
}
break;