Date: Wed, 10 Jan 2001 15:48:12 +0000 From: "W.H.Scholten" <whs@xs4all.nl> To: freebsd-hackers@FreeBSD.ORG Subject: pppd & mkdir diff Message-ID: <3A5C843C.794BDF32@xs4all.nl>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------1CFBAE3959E2B60015FB7483 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. This is useful for dialup connections under X (I use a script to startup pppd, when the script is killed, so is pppd). Now the pppd startup messages are sent to e.g. the xterm the script is started on (using syslog.conf I can get this too but then all xterms get the messages which is annoying; or is there a way to do this that I'm not aware of?). Perhaps it's useful as a compile option or a runtime option. 2. a mkdir patch changing an error message. If for example /tmp/aa does not exist then mkdir /tmp/aa/bb will report /tmp/aa/bb: No such file or directory This is true but not the point. The patch makes it say: /tmp/aa: No such file or directory Wouter --------------1CFBAE3959E2B60015FB7483 Content-Type: text/plain; charset=us-ascii; name="pppd.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pppd.diff" --- /usr/src/usr.sbin/pppd/main.c~ Sun Aug 29 17:47:05 1999 +++ /usr/src/usr.sbin/pppd/main.c Mon Jun 12 21:09:47 2000 @@ -191,7 +191,7 @@ #ifdef ULTRIX openlog("pppd", LOG_PID); #else - openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP); + openlog("pppd", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_PPP); setlogmask(LOG_UPTO(LOG_INFO)); #endif --------------1CFBAE3959E2B60015FB7483 Content-Type: text/plain; charset=us-ascii; name="mkdir.diff2" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mkdir.diff2" diff -ruN mkdir.orig/mkdir.c mkdir/mkdir.c --- mkdir.orig/mkdir.c Sat Sep 4 05:19:38 1999 +++ mkdir/mkdir.c Fri Jan 5 07:56:35 2001 @@ -58,6 +58,8 @@ int build __P((char *, mode_t)); void usage __P((void)); +char *path_prefix __P((char *)); + int vflag; @@ -108,7 +110,10 @@ if (build(*argv, omode)) success = 0; } else if (mkdir(*argv, omode) < 0) { - warn("%s", *argv); + if (errno == ENOTDIR || errno == ENOENT) + warn("%s", path_prefix(*argv)); + else + warn("%s", *argv); success = 0; } else if (vflag) (void)printf("%s\n", *argv); @@ -129,6 +134,19 @@ } exit(exitval); } + + +char *path_prefix(char *path) { + char *slash; + + if (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; + + slash = strrchr(path, '/'); + if (slash) *slash = 0; + + return path; +} + int build(path, omode) --------------1CFBAE3959E2B60015FB7483-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A5C843C.794BDF32>