Re: pppd & mkdir diff

2001-01-16 Thread mouss
At 14:50 16/01/01 +0200, Peter Pentchev wrote: >As somebody already pointed out, there *is* a dirname(3) function, and even >a dirname(1) cmdline utility to invoke it. oops. I'll need to stay current:) >In a followup to Alfred's mkdir(1) commit, I sent a sample implementation >of a direxname()

Re: pppd & mkdir diff

2001-01-16 Thread Peter Pentchev
On Tue, Jan 16, 2001 at 01:32:13PM +0100, mouss wrote: > These are probably cosmetic comments, but here they are anyway... > > > At 09:54 13/01/01 +, W.H.Scholten wrote: > > >+char *dirname(char *path) { > >+ char *slash; > >+ > >+ while (path[ strlen(path)-1 ] == '/') path[ str

Re: pppd & mkdir diff

2001-01-16 Thread mouss
These are probably cosmetic comments, but here they are anyway... At 09:54 13/01/01 +, W.H.Scholten wrote: >+char *dirname(char *path) { >+ char *slash; >+ >+ while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; if path is an empty string, you are accessing path[-1

Re: pppd & mkdir diff

2001-01-14 Thread Warner Losh
In message <[EMAIL PROTECTED]> Ben Smithurst writes: : while (path[strlen(path) - 1] == '/') : path[strlen(path) - 1] = 0; : : :-) Preferably '\0' too of course like you say later. Yes. Actually, I'd do this like: cp = path + strlen(path) - 1; while (cp > pa

Re: pppd & mkdir diff

2001-01-14 Thread Alfred Perlstein
* Alfred Perlstein <[EMAIL PROTECTED]> [010113 19:15] wrote: > * W.H.Scholten <[EMAIL PROTECTED]> [010113 01:57] wrote: > > Alfred Perlstein wrote: > > > > [ mkdir ] > > > > > I'll commit the patch shortly. > > > > Here's a better patch, it checks for multiple slashes, so mkdir > > /tmp/aa///bb

Re: pppd & mkdir diff

2001-01-13 Thread Alfred Perlstein
* Warner Losh <[EMAIL PROTECTED]> [010113 19:55] wrote: > In message <[EMAIL PROTECTED]> "W.H.Scholten" writes: > : + while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; > > Style(9) says write this like: > while (path[ strlen(path)-1 ] == '/') > path[ strlen(p

Re: pppd & mkdir diff

2001-01-13 Thread Kris Kennaway
On Sat, Jan 13, 2001 at 10:14:16PM -0800, Kris Kennaway wrote: > On Sat, Jan 13, 2001 at 07:14:32PM -0800, Alfred Perlstein wrote: > > > Actually, there already exists a function called dirname in libc, dirname(3). > > > > Here's what I'm going to commit: > > You might also like to contribute t

Re: pppd & mkdir diff

2001-01-13 Thread Kris Kennaway
On Sat, Jan 13, 2001 at 07:14:32PM -0800, Alfred Perlstein wrote: > Actually, there already exists a function called dirname in libc, dirname(3). > > Here's what I'm going to commit: You might also like to contribute this back to the pppd maintainer ([EMAIL PROTECTED])..although since our versi

Re: pppd & mkdir diff

2001-01-13 Thread Ben Smithurst
Warner Losh wrote: > In message <[EMAIL PROTECTED]> "W.H.Scholten" writes: > : + while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; > > Style(9) says write this like: > while (path[ strlen(path)-1 ] == '/') > path[ strlen(path)-1 ] = 0; No it doesn't. "No

Re: pppd & mkdir diff

2001-01-13 Thread Warner Losh
In message <[EMAIL PROTECTED]> "W.H.Scholten" writes: : + while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; Style(9) says write this like: while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; : + : + slash = strrchr(path, '/'); : +

Re: pppd & mkdir diff

2001-01-13 Thread Alfred Perlstein
* W.H.Scholten <[EMAIL PROTECTED]> [010113 01:57] wrote: > Alfred Perlstein wrote: > > [ mkdir ] > > > I'll commit the patch shortly. > > Here's a better patch, it checks for multiple slashes, so mkdir > /tmp/aa///bb will give: > > mkdir: /tmp/aa: No such file or directory > > Also, renam

Re: pppd & mkdir diff

2001-01-13 Thread W.H.Scholten
Alfred Perlstein wrote: [ mkdir ] > I'll commit the patch shortly. Here's a better patch, it checks for multiple slashes, so mkdir /tmp/aa///bb will give: mkdir: /tmp/aa: No such file or directory Also, renamed the function to dirname as it does the same as dirname(1). Regards, Wouter

Re: pppd & mkdir diff

2001-01-12 Thread Alfred Perlstein
* W.H.Scholten <[EMAIL PROTECTED]> [010112 03:13] wrote: > Alfred Perlstein wrote: > > > > 1. a pppd patch which sends the pppd messages to stderr. > > > > not sure about this one, I would open a PR about it. > > I'm not sure either :) Maybe everyone else uses gui frontend which reads > pppd's s

Re: pppd & mkdir diff

2001-01-12 Thread W.H.Scholten
Alfred Perlstein wrote: > > 1. a pppd patch which sends the pppd messages to stderr. > > not sure about this one, I would open a PR about it. I'm not sure either :) Maybe everyone else uses gui frontend which reads pppd's syslog messages or starts pppd as root? > Ok, I may be misreading this, b

Re: pppd & mkdir diff

2001-01-11 Thread Alfred Perlstein
* W.H.Scholten <[EMAIL PROTECTED]> [010111 13:17] wrote: > L.S. > > Here are two patches I've been using for a while on both 3.3R and 4.1R: > > 1. a pppd patch which sends the pppd messages to stderr. not sure about this one, I would open a PR about it. > 2. a mkdir patch changing an error mes