linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: [udev] remove '\n' from end of callout return
Date: Mon, 15 Dec 2003 01:32:20 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-107145204516892@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-107145173416718@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

Uups, new mail.  It's better to attach the promised file :)

Attached is a patch to remove a possible newline from the end
of the callout returned string. So we can use "echo" instead of "echo -n"
in a callout script, to match with ID=

thanks,
Kay


03-remove-newline-from-callout-return.diff
  remove possible newline at end of callout output,
  for easier matching with ID=

[-- Attachment #2: 03-remove-newline-from-callout-return.diff --]
[-- Type: text/plain, Size: 491 bytes --]

diff -Nru a/namedev.c b/namedev.c
--- a/namedev.c	Mon Dec 15 02:22:46 2003
+++ b/namedev.c	Mon Dec 15 02:22:46 2003
@@ -266,6 +266,7 @@
 	char buffer[256];
 	char *arg;
 	char *args[CALLOUT_MAXARG];
+	char *pos;
 	int i;
 
 	dbg("callout to '%s'", dev->exec_program);
@@ -326,6 +327,9 @@
 				strncpy(value, buffer, len);
 			}
 		}
+		pos = value + strlen(value)-1;
+		if (pos[0] == '\n')
+			pos[0] = '\0';
 		dbg("callout returned '%s'", value);
 		close(fds[0]);
 		res = wait(&status);

  reply	other threads:[~2003-12-15  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-15  1:26 [udev] remove '\n' from end of callout return Kay Sievers
2003-12-15  1:32 ` Kay Sievers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-12-15  2:27 Kay Sievers
2003-12-15  2:48 Kay Sievers
2003-12-15 22:38 Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-107145204516892@msgid-missing \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).