All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Fischer <rep.dot.nop@gmail.com>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [patch] don't use functions marked as LEGACY in SUSv3
Date: Thu, 20 Sep 2007 12:02:48 +0000	[thread overview]
Message-ID: <20070920120248.GG27699@aon.at> (raw)

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


Hi,

I choose not to have index(), rindex(), bzero(), bcopy() et al in my
libc since they are marked as legacy in SUSv3.
The attached patch uses the recommended functions instead.
Please apply.

TIA and cheers,
Bernhard

[-- Attachment #2: lm-sensors.01.susv3-legacy.patch --]
[-- Type: text/x-diff, Size: 2343 bytes --]

diff -rdup lm_sensors-2.10.4.oorig/lib/proc.c lm_sensors-2.10.4/lib/proc.c
--- lm_sensors-2.10.4.oorig/lib/proc.c	2007-07-17 06:53:06.000000000 +0200
+++ lm_sensors-2.10.4/lib/proc.c	2007-09-20 13:30:39.000000000 +0200
@@ -93,16 +93,16 @@ int sensors_read_proc_bus(void)
   while (fgets(line,255,f)) {
     if (strlen(line) > 0)
       line[strlen(line)-1] = '\0';
-    if (! (border = rindex(line,'\t')))
+    if (! (border = strrchr(line,'\t')))
       goto ERROR;
     /* Skip algorithm name */
     *border='\0';
-    if (! (border = rindex(line,'\t')))
+    if (! (border = strrchr(line,'\t')))
       goto ERROR;
     if (! (entry.adapter = strdup(border + 1)))
       goto FAT_ERROR;
     *border='\0';
-    if (! (border = rindex(line,'\t')))
+    if (! (border = strrchr(line,'\t')))
       goto ERROR;
     *border='\0';
     if (strncmp(line,"i2c-",4))
@@ -155,8 +155,8 @@ int sensors_read_proc(sensors_chip_name 
 		strcpy(n, name.busname);
 		strcat(n, "/");
 		strcpy(altn, n);
-		/* use rindex to append sysname to n */
-		getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0'));
+		/* use strrchr to append sysname to n */
+		getsysname(the_feature, strrchr(n, '\0'), &mag, strrchr(altn, '\0'));
 		if ((f = fopen(n, "r")) != NULL
 		 || (f = fopen(altn, "r")) != NULL) {
 			int res = fscanf(f, "%lf", value);
@@ -198,8 +198,8 @@ int sensors_write_proc(sensors_chip_name
 		strcpy(n, name.busname);
 		strcat(n, "/");
 		strcpy(altn, n);
-		/* use rindex to append sysname to n */
-		getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0'));
+		/* use strrchr to append sysname to n */
+		getsysname(the_feature, strrchr(n, '\0'), &mag, strrchr(altn, '\0'));
 		if ((f = fopen(n, "w")) != NULL
 		 || (f = fopen(altn, "w")) != NULL) {
 			for (; mag > 0; mag --)
diff -rdup lm_sensors-2.10.4.oorig/prog/dump/i2cbusses.c lm_sensors-2.10.4/prog/dump/i2cbusses.c
--- lm_sensors-2.10.4.oorig/prog/dump/i2cbusses.c	2007-07-17 06:53:10.000000000 +0200
+++ lm_sensors-2.10.4/prog/dump/i2cbusses.c	2007-09-20 13:29:19.000000000 +0200
@@ -185,7 +185,7 @@ found:
 				fprintf(stderr, "%s: read error\n", n);
 				continue;
 			}
-			if((border = index(x, '\n')) != NULL)
+			if((border = strchr(x, '\n')) != NULL)
 				*border = 0;
 			if(count++ == 0 && !procfmt)
 				fprintf(stderr,"  Installed I2C busses:\n");

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

                 reply	other threads:[~2007-09-20 12:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070920120248.GG27699@aon.at \
    --to=rep.dot.nop@gmail.com \
    --cc=lm-sensors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.