Re: PATCH: allow comments inside services file (Responder)
Subject : Re: PATCH: allow comments inside services file (Responder)
From: Marc Krochmal <email@hidden >
Date: Wed, 3 Nov 2004 13:22:19 -0800
Delivered-to: email@hidden
Delivered-to: email@hidden
On Nov 2, 2004, at 10:42 AM, Ademar de Souza Reis Jr. wrote:
Hi.
Attached is a patch to allow standard comments (prefixed by '#') inside
service files (passed as -f to mDNSResponderPosix).
It ignores comments and blank lines even if they're in the middle of a
block, which may not be considered by some the right behavior, but I'm
sending it in the hope it's useful to other people as it's to me.
I appologize if that's not the right list to send patches, I'm new to
this
list (and Zeroconf in general) and I haven't found a better place to
do that.
Thanks Ademar. We'll checkin your fix in the next few days.
Best Regards,
-Marc
^[:wq!
Index: Responder.c
===================================================================
RCS file: /cvs/apsl/mDNSResponder/mDNSPosix/Responder.c,v
retrieving revision 1.23
diff -u -r1.23 Responder.c
--- Responder.c 2004/09/17 01:08:54 1.23
+++ Responder.c 2004/11/02 18:24:52
@@ -554,7 +554,12 @@
static mDNSBool ReadALine(char *buf, size_t bufSize, FILE *fp)
{
- mDNSBool good = (fgets(buf, bufSize, fp) != NULL);
+ mDNSBool good;
+
+ do {
+ good = (fgets(buf, bufSize, fp) != NULL);
+ } while (good && (buf[0] == '#' || buf[0] == '\r' || buf[0] ==
'\n'));
+
if (good)
{
size_t len = strlen(buf);
@@ -584,10 +589,14 @@
mDNSu8 text[sizeof(RDataBody)];
mDNSu16 textLen = 0;
char port[256];
- // Skip over any blank lines.
+
+ // Skip over any blank lines or comments.
do {
ch = fgetc(fp);
- } while ( ch == '\n' || ch == '\r' );
+ if (ch == '#') {
+ fgets(rawText, sizeof(rawText), fp);
+ }
+ } while ( ch == '\n' || ch == '\r' || ch == '#');
if (ch != EOF) {
good = (ungetc(ch, fp) == ch);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Rendezvous-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/rendezvous-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Rendezvous-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/rendezvous-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.