Re: devfs question

From: Andrew Pimlott (andrew@pimlott.ne.mediaone.net)
Date: Tue Jul 18 2000 - 17:15:30 EST


On Tue, Jul 18, 2000 at 05:59:12PM -0400, Richard Gooch wrote:
> Khimenko Victor writes:
  
> > - if ((tty = rindex(ttyn, '/')))
> > - ++tty;
> > + if (strncmp(ttyn, "/dev/", 5) == 0)
> > + tty = ttyn+5;
> > else
>
> Hm. util-linux-2.10f doesn't have this, 2.10h does. 2.10g isn't on
> kernel.org.
>
> However, you really should have swapped to index(3) instead (or
> better, strchr(3) which is POSIX). Building an assumption on /dev
> isn't very good either. It still wouldn't be 100% correct (it'll fall
> over if your device nodes/devfs mountpoint are deeper), but it would
> be better.

Perhaps best to look for a purely numerical last component, and in
that case take the last two components.

Andrew

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 23 2000 - 21:00:11 EST