From 46ddf0e34b03f7711a9c80f7a70dc8cbf732f782 Mon Sep 17 00:00:00 2001 From: Isaac Dunham Date: Wed, 19 Nov 2014 16:38:46 -0600 Subject: probe for getspnam(), forkpty(), utmpx, replace sethostname() Android is missing all of these; we need to probe for some so we have a config symbol to depend on. sethostname() is easily replaced. We got termios.h via pty.h; now it's not included in configure-step tools, so we need termios.h to generate globals. --- toys/lsb/passwd.c | 1 + toys/lsb/su.c | 1 + toys/other/login.c | 1 + toys/other/netcat.c | 1 + toys/other/uptime.c | 13 +++++++------ toys/other/w.c | 1 + toys/pending/sulogin.c | 1 + toys/pending/telnetd.c | 1 + toys/posix/who.c | 1 + 9 files changed, 15 insertions(+), 6 deletions(-) (limited to 'toys') diff --git a/toys/lsb/passwd.c b/toys/lsb/passwd.c index c92fb0d7..ca98f2ef 100644 --- a/toys/lsb/passwd.c +++ b/toys/lsb/passwd.c @@ -10,6 +10,7 @@ USE_PASSWD(NEWTOY(passwd, ">1a:dlu", TOYFLAG_STAYROOT|TOYFLAG_USR|TOYFLAG_BIN)) config PASSWD bool "passwd" default y + depends on TOYBOX_SHADOW help usage: passwd [-a ALGO] [-dlu] diff --git a/toys/lsb/su.c b/toys/lsb/su.c index 268ddf75..616541b9 100644 --- a/toys/lsb/su.c +++ b/toys/lsb/su.c @@ -10,6 +10,7 @@ USE_SU(NEWTOY(su, "lmpc:s:", TOYFLAG_BIN|TOYFLAG_ROOTONLY)) config SU bool "su" default y + depends on TOYBOX_SHADOW help usage: su [-lmp] [-c CMD] [-s SHELL] [USER [ARGS...]] diff --git a/toys/other/login.c b/toys/other/login.c index 09861644..91523d43 100644 --- a/toys/other/login.c +++ b/toys/other/login.c @@ -10,6 +10,7 @@ USE_LOGIN(NEWTOY(login, ">1fph:", TOYFLAG_BIN)) config LOGIN bool "login" default y + depends on TOYBOX_SHADOW help usage: login [-p] [-h host] [[-f] username] diff --git a/toys/other/netcat.c b/toys/other/netcat.c index 485dda13..2c1ec7b2 100644 --- a/toys/other/netcat.c +++ b/toys/other/netcat.c @@ -26,6 +26,7 @@ config NETCAT_LISTEN bool "netcat server options (-let)" default y depends on NETCAT + depends on TOYBOX_PTY help usage: netcat [-t] [-lL COMMAND...] diff --git a/toys/other/uptime.c b/toys/other/uptime.c index adbbfc03..f584d9ab 100644 --- a/toys/other/uptime.c +++ b/toys/other/uptime.c @@ -25,17 +25,18 @@ void uptime_main(void) time_t tmptime; struct tm * now; unsigned int days, hours, minutes; - struct utmpx *entry; - int users = 0; + USE_TOYBOX_UTMPX(struct utmpx *entry;) + USE_TOYBOX_UTMPX(int users = 0;) // Obtain the data we need. sysinfo(&info); time(&tmptime); now = localtime(&tmptime); + // Obtain info about logged on users - setutxent(); - while ((entry = getutxent())) if (entry->ut_type == USER_PROCESS) users++; - endutxent(); + USE_TOYBOX_UTMPX(setutxent();) + USE_TOYBOX_UTMPX(while ((entry = getutxent())) if (entry->ut_type == USER_PROCESS) users++;) + USE_TOYBOX_UTMPX(endutxent();) // Time xprintf(" %02d:%02d:%02d up ", now->tm_hour, now->tm_min, now->tm_sec); @@ -48,7 +49,7 @@ void uptime_main(void) if (days) xprintf("%d day%s, ", days, (days!=1)?"s":""); if (hours) xprintf("%2d:%02d, ", hours, minutes); else printf("%d min, ", minutes); - printf(" %d user%s, ", users, (users!=1) ? "s" : ""); + USE_TOYBOX_UTMPX(printf(" %d user%s, ", users, (users!=1) ? "s" : "");) printf(" load average: %.02f, %.02f, %.02f\n", info.loads[0]/65536.0, info.loads[1]/65536.0, info.loads[2]/65536.0); } diff --git a/toys/other/w.c b/toys/other/w.c index c271e8bd..a76c82f5 100644 --- a/toys/other/w.c +++ b/toys/other/w.c @@ -7,6 +7,7 @@ USE_W(NEWTOY(w, NULL, TOYFLAG_USR|TOYFLAG_BIN)) config W bool "w" default y + depends on TOYBOX_UTMPX help usage: w diff --git a/toys/pending/sulogin.c b/toys/pending/sulogin.c index 45f76597..e6cb8314 100644 --- a/toys/pending/sulogin.c +++ b/toys/pending/sulogin.c @@ -13,6 +13,7 @@ USE_SULOGIN(NEWTOY(sulogin, "t#<0=0", TOYFLAG_SBIN|TOYFLAG_NEEDROOT)) config SULOGIN bool "sulogin" default n + depends on TOYBOX_SHADOW help usage: sulogin [-t time] [tty] diff --git a/toys/pending/telnetd.c b/toys/pending/telnetd.c index 4198e63f..f9f34224 100644 --- a/toys/pending/telnetd.c +++ b/toys/pending/telnetd.c @@ -8,6 +8,7 @@ USE_TELNETD(NEWTOY(telnetd, "w#<0b:p#<0>65535=23f:l:FSKi[!wi]", TOYFLAG_USR|TOYF config TELNETD bool "telnetd" default n + depends on TOYBOX_PTY help Handle incoming telnet connections diff --git a/toys/posix/who.c b/toys/posix/who.c index 2c8a2e65..876a562a 100644 --- a/toys/posix/who.c +++ b/toys/posix/who.c @@ -14,6 +14,7 @@ USE_WHO(NEWTOY(who, "a", TOYFLAG_BIN)) config WHO bool "who" default y + depends on TOYBOX_UTMPX help usage: who -- cgit v1.2.3