# ID:	greg@kroah.com|ChangeSet|20030410173830|44862|5a456b78236181c4
# User:	greg
# Host:	kroah.com
# Root:	/home/greg/src/udev

# Patch vers:	1.3
# Patch type:	REGULAR

== ChangeSet ==
greg@kroah.com|ChangeSet|20030410173830|44862|5a456b78236181c4
kay.sievers@vrfy.org|ChangeSet|20031215223818|32291
D 1.295 03/12/15 14:54:12-08:00 kay.sievers@vrfy.org +2 -0
B greg@kroah.com|ChangeSet|20030410173830|44862|5a456b78236181c4
C
c [PATCH] get part of callout return string
c 
c Try this patch if you like, to get special parts of the callout output.
c This beast works now:
c CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
c 
c The callout returned string is separated by spaces and is
c addressed by the "len" value of the 'c' format char.
c Since we support symlinks, this my be useful for other uses of callout too.
c 
c   introduce 'len number' for format chars
c   the first use is 'c'-the callout return to select a part of the output string like:
c   CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
c   (note: first part is requested by len=1, len=0 will return the whole string)
c   add a test to udev-test.pl
c 
c --liOOAslEiF7prFVr
c Content-Type: text/plain; charset=us-ascii
c Content-Disposition: inline; filename="02-get-part-of-callout-return-string.diff"
K 33536
P ChangeSet
------------------------------------------------

0a0
> greg@kroah.com|namedev.c|20030717002450|11594|a4fa941321b06ff8 kay.sievers@vrfy.org[greg]|namedev.c|20031215225411|64391
> greg@kroah.com|test/udev-test.pl|20031123054728|17148|fa31a884ea54d9e1 kay.sievers@vrfy.org[greg]|test/udev-test.pl|20031215225411|43303

== namedev.c ==
greg@kroah.com|namedev.c|20030717002450|11594|a4fa941321b06ff8
kay.sievers@vrfy.org[greg]|namedev.c|20031215223817|18535
D 1.65 03/12/13 08:19:27-08:00 kay.sievers@vrfy.org[greg] +36 -5
B greg@kroah.com|ChangeSet|20030410173830|44862|5a456b78236181c4
C
c get part of callout return string
F 196484
K 64391
O -rw-rw-r--
P namedev.c
------------------------------------------------

I202 2
	char temp[NAME_SIZE];
	char *tail;
I203 3
	char *pos2;
	char *pos3;
	int num;
I205 1
		num = 0;
D209 3
I211 12
			*pos = '\0';
			tail = pos+1;
			if (isdigit(tail[0])) {
				num = (int) strtoul(&pos[1], &tail, 10);
				if (tail == NULL) {
					dbg("format parsing error '%s'", pos+1);
					break;
				}
			}
			strfieldcpy(name, tail+1);
\
			switch (tail[0]) {
D244 2
I245 18
				if (num) {
					/* get part of return string */
					strncpy(temp, udev->callout_value, sizeof(temp));
					pos2 = temp;
					while (num) {
						num--;
						pos3 = strsep(&pos2, " ");
						if (pos3 == NULL) {
							dbg("requested part of callout string not found");
							break;
						}
					}
					strcat(pos, pos3);
					dbg("substitute partial callout output '%s'", pos3);
				} else {
					strcat(pos, udev->callout_value);
					dbg("substitute callout output '%s'", udev->callout_value);
				}

== test/udev-test.pl ==
greg@kroah.com|test/udev-test.pl|20031123054728|17148|fa31a884ea54d9e1
greg@kroah.com|test/udev-test.pl|20031210221229|23166
D 1.17 03/12/13 08:19:27-08:00 kay.sievers@vrfy.org[greg] +9 -0
B greg@kroah.com|ChangeSet|20030410173830|44862|5a456b78236181c4
C
c get part of callout return string
F 196484
K 43303
O -rwxr-xr-x
P test/udev-test.pl
------------------------------------------------

I155 9
		desc     => "callout program substitution (numbered part of)",
		subsys   => "block",
		devpath  => "block/sda/sda3",
		expected => "link1" ,
		conf     => <<EOF
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
EOF
	},
	{

# Patch checksum=32e91b9c
