aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/other/dos2unix.c2
-rw-r--r--toys/other/nbd_client.c2
-rw-r--r--toys/other/netcat.c2
-rw-r--r--toys/other/reboot.c4
-rw-r--r--toys/pending/ftpget.c2
-rw-r--r--toys/pending/groupadd.c2
-rw-r--r--toys/pending/groupdel.c2
-rw-r--r--toys/pending/ip.c10
-rw-r--r--toys/pending/pgrep.c2
-rw-r--r--toys/pending/sh.c2
-rw-r--r--toys/pending/tcpsvd.c2
-rw-r--r--toys/pending/traceroute.c2
-rw-r--r--toys/pending/useradd.c2
-rw-r--r--toys/pending/userdel.c2
-rw-r--r--toys/posix/chgrp.c2
-rw-r--r--toys/posix/grep.c4
-rw-r--r--toys/posix/id.c30
-rw-r--r--toys/posix/true.c2
18 files changed, 42 insertions, 34 deletions
diff --git a/toys/other/dos2unix.c b/toys/other/dos2unix.c
index 3e1feb0e..690c5a8e 100644
--- a/toys/other/dos2unix.c
+++ b/toys/other/dos2unix.c
@@ -3,7 +3,7 @@
* Copyright 2012 Rob Landley <rob@landley.net>
USE_DOS2UNIX(NEWTOY(dos2unix, NULL, TOYFLAG_BIN))
-USE_DOS2UNIX(OLDTOY(unix2dos, dos2unix, NULL, TOYFLAG_BIN))
+USE_DOS2UNIX(OLDTOY(unix2dos, dos2unix, TOYFLAG_BIN))
config DOS2UNIX
bool "dos2unix/unix2dos"
diff --git a/toys/other/nbd_client.c b/toys/other/nbd_client.c
index 969ad4ae..c16585a2 100644
--- a/toys/other/nbd_client.c
+++ b/toys/other/nbd_client.c
@@ -8,7 +8,7 @@
// things like prototype "nbd-client_main" which isn't a valid symbol. So
// we hide the underscore name and OLDTOY the name we want.
USE_NBD_CLIENT(NEWTOY(nbd_client, "<3>3ns", 0))
-USE_NBD_CLIENT(OLDTOY(nbd-client, nbd_client, OPTSTR_nbd_client, TOYFLAG_USR|TOYFLAG_BIN))
+USE_NBD_CLIENT(OLDTOY(nbd-client, nbd_client, TOYFLAG_USR|TOYFLAG_BIN))
config NBD_CLIENT
bool "nbd-client"
diff --git a/toys/other/netcat.c b/toys/other/netcat.c
index 2c1ec7b2..58f08251 100644
--- a/toys/other/netcat.c
+++ b/toys/other/netcat.c
@@ -4,7 +4,7 @@
*
* TODO: udp, ipv6, genericize for telnet/microcom/tail-f
-USE_NETCAT(OLDTOY(nc, netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_BIN))
+USE_NETCAT(OLDTOY(nc, netcat, TOYFLAG_BIN))
USE_NETCAT(NEWTOY(netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_BIN))
config NETCAT
diff --git a/toys/other/reboot.c b/toys/other/reboot.c
index 5cbc4f87..8baa4d8a 100644
--- a/toys/other/reboot.c
+++ b/toys/other/reboot.c
@@ -3,8 +3,8 @@
* Copyright 2013 Elie De Brauwer <eliedebrauwer@gmail.com>
USE_REBOOT(NEWTOY(reboot, "n", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
-USE_REBOOT(OLDTOY(halt, reboot, "n", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
-USE_REBOOT(OLDTOY(poweroff, reboot, "n", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
+USE_REBOOT(OLDTOY(halt, reboot, TOYFLAG_BIN|TOYFLAG_NEEDROOT))
+USE_REBOOT(OLDTOY(poweroff, reboot, TOYFLAG_BIN|TOYFLAG_NEEDROOT))
config REBOOT
bool "reboot"
diff --git a/toys/pending/ftpget.c b/toys/pending/ftpget.c
index 2a81a34a..a1447139 100644
--- a/toys/pending/ftpget.c
+++ b/toys/pending/ftpget.c
@@ -6,7 +6,7 @@
* No Standard.
*
USE_FTPGET(NEWTOY(ftpget, "<2cvu:p:P#<0=21>65535", TOYFLAG_BIN))
-USE_FTPGET(OLDTOY(ftpput,ftpget, "<2vu:p:P#<0=21>65535", TOYFLAG_BIN))
+USE_FTPGET(OLDTOY(ftpput, ftpget, TOYFLAG_BIN))
config FTPGET
bool "ftpget/ftpput"
diff --git a/toys/pending/groupadd.c b/toys/pending/groupadd.c
index 7df0a5c3..615c12f8 100644
--- a/toys/pending/groupadd.c
+++ b/toys/pending/groupadd.c
@@ -6,7 +6,7 @@
* See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/groupadd.html
USE_GROUPADD(NEWTOY(groupadd, "<1>2g#<0S", TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
-USE_GROUPADD(OLDTOY(addgroup, groupadd, OPTSTR_groupadd, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
+USE_GROUPADD(OLDTOY(addgroup, groupadd, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
config GROUPADD
bool "groupadd"
diff --git a/toys/pending/groupdel.c b/toys/pending/groupdel.c
index 834e113e..483ac59c 100644
--- a/toys/pending/groupdel.c
+++ b/toys/pending/groupdel.c
@@ -6,7 +6,7 @@
* See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/groupdel.html
USE_GROUPDEL(NEWTOY(groupdel, "<1>2", TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
-USE_GROUPDEL(OLDTOY(delgroup, groupdel, OPTSTR_groupdel, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
+USE_GROUPDEL(OLDTOY(delgroup, groupdel, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
config GROUPDEL
bool "groupdel"
diff --git a/toys/pending/ip.c b/toys/pending/ip.c
index 42d3a734..be4d8bba 100644
--- a/toys/pending/ip.c
+++ b/toys/pending/ip.c
@@ -8,11 +8,11 @@
* No Standard.
*
USE_IP(NEWTOY(ip, NULL, TOYFLAG_SBIN))
-USE_IP(OLDTOY(ipaddr, ip, NULL, TOYFLAG_SBIN))
-USE_IP(OLDTOY(iplink, ip, NULL, TOYFLAG_SBIN))
-USE_IP(OLDTOY(iproute, ip, NULL, TOYFLAG_SBIN))
-USE_IP(OLDTOY(iprule, ip, NULL, TOYFLAG_SBIN))
-USE_IP(OLDTOY(iptunnel, ip, NULL, TOYFLAG_SBIN))
+USE_IP(OLDTOY(ipaddr, ip, TOYFLAG_SBIN))
+USE_IP(OLDTOY(iplink, ip, TOYFLAG_SBIN))
+USE_IP(OLDTOY(iproute, ip, TOYFLAG_SBIN))
+USE_IP(OLDTOY(iprule, ip, TOYFLAG_SBIN))
+USE_IP(OLDTOY(iptunnel, ip, TOYFLAG_SBIN))
config IP
bool "ip"
diff --git a/toys/pending/pgrep.c b/toys/pending/pgrep.c
index 77b6cede..59767b9f 100644
--- a/toys/pending/pgrep.c
+++ b/toys/pending/pgrep.c
@@ -5,7 +5,7 @@
*
USE_PGREP(NEWTOY(pgrep, "?P# s# xvonlf[!sP]", TOYFLAG_USR|TOYFLAG_BIN))
-USE_PGREP(OLDTOY(pkill, pgrep, OPTSTR_pgrep, TOYFLAG_USR|TOYFLAG_BIN))
+USE_PGREP(OLDTOY(pkill, pgrep, TOYFLAG_USR|TOYFLAG_BIN))
config PGREP
bool "pgrep"
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index 81f91a7b..a234e5b9 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -25,7 +25,7 @@ USE_SH(NEWTOY(cd, NULL, TOYFLAG_NOFORK))
USE_SH(NEWTOY(exit, NULL, TOYFLAG_NOFORK))
USE_SH(NEWTOY(sh, "c:"USE_SH_INTERACTIVE("i"), TOYFLAG_BIN))
-USE_SH(OLDTOY(toysh, sh, OPTSTR_sh, TOYFLAG_BIN))
+USE_SH(OLDTOY(toysh, sh, TOYFLAG_BIN))
config SH
bool "sh (toysh)"
diff --git a/toys/pending/tcpsvd.c b/toys/pending/tcpsvd.c
index d7e1f6c1..585ae733 100644
--- a/toys/pending/tcpsvd.c
+++ b/toys/pending/tcpsvd.c
@@ -7,7 +7,7 @@
* No Standard.
USE_TCPSVD(NEWTOY(tcpsvd, "^<3c#=30<1C:b#=20<0u:l:hEv", TOYFLAG_USR|TOYFLAG_BIN))
-USE_TCPSVD(OLDTOY(udpsvd, tcpsvd, OPTSTR_tcpsvd, TOYFLAG_USR|TOYFLAG_BIN))
+USE_TCPSVD(OLDTOY(udpsvd, tcpsvd, TOYFLAG_USR|TOYFLAG_BIN))
config TCPSVD
bool "tcpsvd"
diff --git a/toys/pending/traceroute.c b/toys/pending/traceroute.c
index 92509930..830331a5 100644
--- a/toys/pending/traceroute.c
+++ b/toys/pending/traceroute.c
@@ -8,7 +8,7 @@
* No Standard
USE_TRACEROUTE(NEWTOY(traceroute, "<1>2i:f#<1>255=1z#<0>86400=0g*w#<0>86400=5t#<0>255=0s:q#<1>255=3p#<1>65535=33434m#<1>255=30rvndlIUF64", TOYFLAG_STAYROOT|TOYFLAG_USR|TOYFLAG_BIN))
-USE_TRACEROUTE(OLDTOY(traceroute6,traceroute, OPTSTR_traceroute, TOYFLAG_STAYROOT|TOYFLAG_USR|TOYFLAG_BIN))
+USE_TRACEROUTE(OLDTOY(traceroute6,traceroute, TOYFLAG_STAYROOT|TOYFLAG_USR|TOYFLAG_BIN))
config TRACEROUTE
bool "traceroute"
default n
diff --git a/toys/pending/useradd.c b/toys/pending/useradd.c
index 4f2bcc61..78f083b7 100644
--- a/toys/pending/useradd.c
+++ b/toys/pending/useradd.c
@@ -6,7 +6,7 @@
* See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/useradd.html
USE_USERADD(NEWTOY(useradd, "<1>2u#<0G:s:g:h:SDH", TOYFLAG_NEEDROOT|TOYFLAG_UMASK|TOYFLAG_SBIN))
-USE_USERADD(OLDTOY(adduser, useradd, OPTSTR_useradd, TOYFLAG_NEEDROOT|TOYFLAG_UMASK|TOYFLAG_SBIN))
+USE_USERADD(OLDTOY(adduser, useradd, TOYFLAG_NEEDROOT|TOYFLAG_UMASK|TOYFLAG_SBIN))
config USERADD
bool "useradd"
diff --git a/toys/pending/userdel.c b/toys/pending/userdel.c
index 8619a620..9c93a219 100644
--- a/toys/pending/userdel.c
+++ b/toys/pending/userdel.c
@@ -5,7 +5,7 @@
* See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/userdel.html
USE_USERDEL(NEWTOY(userdel, "<1>1r", TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
-USE_USERDEL(OLDTOY(deluser, userdel, OPTSTR_userdel, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
+USE_USERDEL(OLDTOY(deluser, userdel, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
config USERDEL
bool "userdel"
diff --git a/toys/posix/chgrp.c b/toys/posix/chgrp.c
index 3aa25147..f573add4 100644
--- a/toys/posix/chgrp.c
+++ b/toys/posix/chgrp.c
@@ -8,7 +8,7 @@
* TODO: group only one of [HLP]
USE_CHGRP(NEWTOY(chgrp, "<2hPLHRfv", TOYFLAG_BIN))
-USE_CHGRP(OLDTOY(chown, chgrp, OPTSTR_chgrp, TOYFLAG_BIN))
+USE_CHGRP(OLDTOY(chown, chgrp, TOYFLAG_BIN))
config CHGRP
bool "chgrp/chown"
diff --git a/toys/posix/grep.c b/toys/posix/grep.c
index aba70878..18a27e3e 100644
--- a/toys/posix/grep.c
+++ b/toys/posix/grep.c
@@ -5,8 +5,8 @@
* See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html
USE_GREP(NEWTOY(grep, "ZzEFHabhinorsvwclqe*f*m#x[!wx][!EFw]", TOYFLAG_BIN))
-USE_GREP(OLDTOY(egrep, grep, OPTSTR_grep, TOYFLAG_BIN))
-USE_GREP(OLDTOY(fgrep, grep, OPTSTR_grep, TOYFLAG_BIN))
+USE_GREP(OLDTOY(egrep, grep, TOYFLAG_BIN))
+USE_GREP(OLDTOY(fgrep, grep, TOYFLAG_BIN))
config GREP
bool "grep"
diff --git a/toys/posix/id.c b/toys/posix/id.c
index 000d7b4c..dd48cf0b 100644
--- a/toys/posix/id.c
+++ b/toys/posix/id.c
@@ -7,9 +7,9 @@
* See http://opengroup.org/onlinepubs/9699919799/utilities/id.html
USE_ID(NEWTOY(id, ">1nGgru[!Ggu]", TOYFLAG_BIN))
-USE_GROUPS(OLDTOY(groups, id, NULL, TOYFLAG_USR|TOYFLAG_BIN))
-USE_LOGNAME(OLDTOY(logname, id, ">0", TOYFLAG_BIN))
-USE_WHOAMI(OLDTOY(whoami, id, ">0", TOYFLAG_BIN))
+USE_GROUPS(NEWTOY(groups, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+USE_LOGNAME(NEWTOY(logname, ">0", TOYFLAG_BIN))
+USE_WHOAMI(OLDTOY(whoami, logname, TOYFLAG_BIN))
config ID
bool "id"
@@ -133,15 +133,23 @@ void do_id(char *username)
void id_main(void)
{
// FLAG macros can be 0 if "id" command not enabled, so snapshot them here.
- if (FLAG_u) TT.do_u = toys.optflags & FLAG_u;
- if (FLAG_n) TT.do_n = toys.optflags & FLAG_n;
- if (FLAG_G) TT.do_G = toys.optflags & FLAG_G;
-
- // And set the variables for non-id commands.
- TT.is_groups = toys.which->name[0] == 'g';
- if (TT.is_groups) TT.do_G = TT.do_n = 1;
- else if (toys.which->name[0] != 'i') TT.do_u = TT.do_n = 1;
+ if (FLAG_u) TT.do_u |= toys.optflags & FLAG_u;
+ if (FLAG_n) TT.do_n |= toys.optflags & FLAG_n;
+ if (FLAG_G) TT.do_G |= toys.optflags & FLAG_G;
if (toys.optc) while(*toys.optargs) do_id(*toys.optargs++);
else do_id(NULL);
}
+
+void groups_main(void)
+{
+ TT.is_groups = 1;
+ TT.do_G = TT.do_n = 1;
+ id_main();
+}
+
+void logname_main(void)
+{
+ TT.do_u = TT.do_n = 1;
+ id_main();
+}
diff --git a/toys/posix/true.c b/toys/posix/true.c
index b22b7ac1..0fbb1786 100644
--- a/toys/posix/true.c
+++ b/toys/posix/true.c
@@ -5,7 +5,7 @@
* See http://opengroup.org/onlinepubs/9699919799/utilities/true.html
USE_TRUE(NEWTOY(true, NULL, TOYFLAG_BIN))
-USE_TRUE(OLDTOY(:, true, 0, TOYFLAG_NOFORK))
+USE_TRUE(OLDTOY(:, true, TOYFLAG_NOFORK))
config TRUE
bool "true"