diff options
author | Elliott Hughes <enh@google.com> | 2016-10-22 09:12:59 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-10-22 09:14:49 -0700 |
commit | fb3ebf8f5d9760cd7ee843c70fd2e503e7b51d95 (patch) | |
tree | abf59a44d7712f52e4ccf4752fb331fa743e544e /toys | |
parent | 5e9108a442fca8fb74c6dd6fc63b2f076f6c5ac4 (diff) | |
parent | b27d5d9ad0c56014d8661d91f69ee498bbbe4cf9 (diff) | |
download | toybox-fb3ebf8f5d9760cd7ee843c70fd2e503e7b51d95.tar.gz |
Merge remote-tracking branch 'toybox/master' into HEAD
Change-Id: Ief5b3e5e09340c03048048511629f4af38ee16b9
Diffstat (limited to 'toys')
-rw-r--r-- | toys/net/ifconfig.c | 3 | ||||
-rw-r--r-- | toys/pending/chrt.c | 2 | ||||
-rw-r--r-- | toys/pending/getfattr.c | 2 | ||||
-rw-r--r-- | toys/pending/setfattr.c (renamed from toys/other/setfattr.c) | 2 | ||||
-rw-r--r-- | toys/posix/touch.c | 33 |
5 files changed, 30 insertions, 12 deletions
diff --git a/toys/net/ifconfig.c b/toys/net/ifconfig.c index 1d2a41dc..174369fe 100644 --- a/toys/net/ifconfig.c +++ b/toys/net/ifconfig.c @@ -125,6 +125,9 @@ static void display_ifconfig(char *name, int always, unsigned long long val[]) xprintf("HWaddr "); for (i=0; i<6; i++) xprintf(":%02x"+!i, ifre.ifr_hwaddr.sa_data[i]); } + sprintf(toybuf, "/sys/class/net/%.15s/device/driver", name); + if (readlink0(toybuf, toybuf, sizeof(toybuf))>0 && (pp = strrchr(toybuf, '/'))) + xprintf(" Driver %s", pp+1); xputc('\n'); // If an address is assigned record that. diff --git a/toys/pending/chrt.c b/toys/pending/chrt.c index 0c25f484..d2b73a42 100644 --- a/toys/pending/chrt.c +++ b/toys/pending/chrt.c @@ -6,7 +6,7 @@ USE_CHRT(NEWTOY(chrt, "mp#bfiorR[!bfior]", TOYFLAG_USR|TOYFLAG_SBIN)) config CHRT bool "chrt" - default y + default n help usage: chrt [-m] [-p PID] [POLICY PRIO] [COMMAND [ARGS...]] diff --git a/toys/pending/getfattr.c b/toys/pending/getfattr.c index efec53a8..b17cdc1d 100644 --- a/toys/pending/getfattr.c +++ b/toys/pending/getfattr.c @@ -8,7 +8,7 @@ USE_GETFATTR(NEWTOY(getfattr, "dhn:", TOYFLAG_USR|TOYFLAG_BIN)) config GETFATTR bool "getfattr" - default y + default n help usage: getfattr [-d] [-h] [-n NAME] FILE... diff --git a/toys/other/setfattr.c b/toys/pending/setfattr.c index 080991f2..9a41a4da 100644 --- a/toys/other/setfattr.c +++ b/toys/pending/setfattr.c @@ -8,7 +8,7 @@ USE_SETFATTR(NEWTOY(setfattr, "hn:|v:x:|[!xv]", TOYFLAG_USR|TOYFLAG_BIN)) config SETFATTR bool "setfattr" - default y + default n help usage: setfattr [-h] [-x|-n NAME] [-v VALUE] FILE... diff --git a/toys/posix/touch.c b/toys/posix/touch.c index 79928cee..79eba177 100644 --- a/toys/posix/touch.c +++ b/toys/posix/touch.c @@ -4,7 +4,7 @@ * * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html -USE_TOUCH(NEWTOY(touch, "acd:mr:t:h[!dtr]", TOYFLAG_BIN)) +USE_TOUCH(NEWTOY(touch, "<1acd:mr:t:h[!dtr]", TOYFLAG_BIN)) config TOUCH bool "touch" @@ -54,7 +54,7 @@ void touch_main(void) format = (char *[]){"%Y-%m-%dT%T", "%Y-%m-%d %T", 0}; date = TT.date; } else { - format = (char *[]){"%Y%m%d%H%M", "%m%d%H%M", "%y%m%d%H%M", 0}; + format = (char *[]){"%m%d%H%M", "%y%m%d%H%M", "%C%y%m%d%H%M", 0}; date = TT.time; } @@ -66,6 +66,13 @@ void touch_main(void) } while (*format) { + if (toys.optflags&FLAG_t) { + s = strchr(date, '.'); + if ((s ? s-date : strlen(date)) != strlen(*format)) { + format++; + continue; + } + } localtime_r(&(ts->tv_sec), &tm); // Adjusting for daylight savings time gives the wrong answer. tm.tm_isdst = 0; @@ -108,13 +115,21 @@ void touch_main(void) // Loop through files on command line for (ss = toys.optargs; *ss;) { + char *s = *ss++; - // cheat: FLAG_h is rightmost flag, so its value is 1 - if (!utimensat(AT_FDCWD, *ss, ts, - (toys.optflags & FLAG_h)*AT_SYMLINK_NOFOLLOW)) ss++; - else if (toys.optflags & FLAG_c) ss++; - else if (access(*ss, F_OK) && (-1!=(fd = open(*ss, O_CREAT, 0666)))) - close(fd); - else perror_msg("'%s'", *ss++); + if (!strcmp(s, "-")) { + if (!futimens(1, ts)) continue; + } else { + // cheat: FLAG_h is rightmost flag, so its value is 1 + if (!utimensat(AT_FDCWD, s, ts, + (toys.optflags & FLAG_h)*AT_SYMLINK_NOFOLLOW)) continue; + if (toys.optflags & FLAG_c) continue; + if (access(s, F_OK) && (-1!=(fd = open(s, O_CREAT, 0666)))) { + close(fd); + if (toys.optflags) ss--; + continue; + } + } + perror_msg("'%s'", s); } } |