aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-01-16 09:26:50 -0600
committerRob Landley <rob@landley.net>2014-01-16 09:26:50 -0600
commit59d85e2bb065a3bdc27868acb7a65f89d872c7fa (patch)
tree25db9183f6e142b7c5f12b69e9728aaa98f5bbd6 /toys/pending
parent2ded83376cb822198e83048335417a0e870f2240 (diff)
downloadtoybox-59d85e2bb065a3bdc27868acb7a65f89d872c7fa.tar.gz
Rename xmsprintf() to just xmprintf().
Partly because there's no supplied target string ala sprintf, and partly because I can never remember what order the m and s go in.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/fdisk.c2
-rw-r--r--toys/pending/fsck.c4
-rw-r--r--toys/pending/groupadd.c6
-rw-r--r--toys/pending/init.c4
-rw-r--r--toys/pending/netstat.c8
-rw-r--r--toys/pending/ps.c30
-rw-r--r--toys/pending/syslogd.c2
-rw-r--r--toys/pending/tcpsvd.c4
-rw-r--r--toys/pending/useradd.c12
-rw-r--r--toys/pending/watch.c4
10 files changed, 38 insertions, 38 deletions
diff --git a/toys/pending/fdisk.c b/toys/pending/fdisk.c
index 24769c68..932b38df 100644
--- a/toys/pending/fdisk.c
+++ b/toys/pending/fdisk.c
@@ -1005,7 +1005,7 @@ static void add_new_partition(void)
return;
}
- msg = xmsprintf(" %s\n p primary partition(1-4)\n",
+ msg = xmprintf(" %s\n p primary partition(1-4)\n",
extended_offset? "l logical (5 or over)" : "e extended");
choice = 0x20 | read_input(msg, NULL);
diff --git a/toys/pending/fsck.c b/toys/pending/fsck.c
index 1c607ae2..1e31fe4c 100644
--- a/toys/pending/fsck.c
+++ b/toys/pending/fsck.c
@@ -198,9 +198,9 @@ static void do_fsck(struct f_sys_info *finfo)
else type = "auto";
args = xzalloc((toys.optc + 2 + 1 + 1) * sizeof(char*)); //+1, for NULL, +1 if -C
- args[0] = xmsprintf("fsck.%s", type);
+ args[0] = xmprintf("fsck.%s", type);
- if(toys.optflags & FLAG_C) args[i++] = xmsprintf("%s %d","-C", TT.fd_num);
+ if(toys.optflags & FLAG_C) args[i++] = xmprintf("%s %d","-C", TT.fd_num);
while(toys.optargs[j]) {
if(*toys.optargs[j]) args[i++] = xstrdup(toys.optargs[j]);
j++;
diff --git a/toys/pending/groupadd.c b/toys/pending/groupadd.c
index 8ff539eb..c19e1eef 100644
--- a/toys/pending/groupadd.c
+++ b/toys/pending/groupadd.c
@@ -59,10 +59,10 @@ static void new_group()
}
}
- entry = xmsprintf("%s:%s:%d:", *toys.optargs, "x", TT.gid);
+ entry = xmprintf("%s:%s:%d:", *toys.optargs, "x", TT.gid);
update_password(GROUP_PATH, *toys.optargs, entry);
free(entry);
- entry = xmsprintf("%s:%s::", *toys.optargs, "!");
+ entry = xmprintf("%s:%s::", *toys.optargs, "!");
update_password(SECURE_GROUP_PATH, *toys.optargs, entry);
free(entry);
}
@@ -82,7 +82,7 @@ void groupadd_main(void)
xgetpwnam(*toys.optargs);
if (!(grp = getgrnam(toys.optargs[1])))
error_exit("group '%s' does not exist", toys.optargs[1]);
- if (!grp->gr_mem) entry = xmsprintf("%s", *toys.optargs);
+ if (!grp->gr_mem) entry = xmprintf("%s", *toys.optargs);
else {
int i;
diff --git a/toys/pending/init.c b/toys/pending/init.c
index 559ab09b..751f987d 100644
--- a/toys/pending/init.c
+++ b/toys/pending/init.c
@@ -155,8 +155,8 @@ static void inittab_parsing(void)
case 1:
if (*extracted_token) {
if (!strncmp(extracted_token, "/dev/", 5))
- tty_name = xmsprintf("%s",extracted_token);
- else tty_name = xmsprintf("/dev/%s",extracted_token);
+ tty_name = xmprintf("%s",extracted_token);
+ else tty_name = xmprintf("/dev/%s",extracted_token);
} else tty_name = xstrdup("");
break;
case 2:
diff --git a/toys/pending/netstat.c b/toys/pending/netstat.c
index 34644f44..55be7726 100644
--- a/toys/pending/netstat.c
+++ b/toys/pending/netstat.c
@@ -115,7 +115,7 @@ static char *append_pathandfile(char *path, char *fname)
if (!path) path = "";
c = find_last_char(path, '/');
while (*fname == '/') fname++;
- return xmsprintf("%s%s%s", path, (c)? "" : "/", fname);
+ return xmprintf("%s%s%s", path, (c)? "" : "/", fname);
}
/*
* Concat sub-path and the file name.
@@ -211,10 +211,10 @@ static void show_data(unsigned rport, char *label, unsigned rxq, unsigned txq, c
static char *get_servname(int port, char *label)
{
int lport = htons(port);
- if (!lport) return xmsprintf("%s", "*");
+ if (!lport) return xmprintf("%s", "*");
struct servent *ser = getservbyport(lport, label);
- if (ser) return xmsprintf("%s", ser->s_name);
- return xmsprintf("%u", (unsigned)ntohs(lport));
+ if (ser) return xmprintf("%s", ser->s_name);
+ return xmprintf("%u", (unsigned)ntohs(lport));
}
/*
* used to convert address into text format.
diff --git a/toys/pending/ps.c b/toys/pending/ps.c
index 19521b6f..fddf2f3f 100644
--- a/toys/pending/ps.c
+++ b/toys/pending/ps.c
@@ -104,8 +104,8 @@ static void print_header(void)
temp++;
while (def_header[i].name) {
if (!(strcmp(def_header[i].name, ptr))) { // search from default header
- if (str) ptr = xmsprintf("%s,%s", temp, str); //handle condition like ppid = M,OM
- else ptr = xmsprintf("%s", temp);
+ if (str) ptr = xmprintf("%s,%s", temp, str); //handle condition like ppid = M,OM
+ else ptr = xmprintf("%s", temp);
list_add(&o_list, &def_header[i], ptr);
break;
}
@@ -163,7 +163,7 @@ void get_etime(unsigned long s_time)
min = info.uptime - min;
sec = min % 60;
min = min / 60;
- temp = xmsprintf("%3lu:%02u", min,sec);
+ temp = xmprintf("%3lu:%02u", min,sec);
xprintf("%*.*s",7,7,temp);
free(temp);
}
@@ -177,7 +177,7 @@ void get_time(unsigned long s_time, unsigned long u_time)
min = (s_time + u_time)/sysconf(_SC_CLK_TCK);
sec = min % 60;
min = min / 60;
- temp = xmsprintf("%3lu:%02u", min,sec);
+ temp = xmprintf("%3lu:%02u", min,sec);
xprintf("%*.*s",6,6,temp);
free(temp);
}
@@ -237,7 +237,7 @@ static void do_ps_line(int pid, int tid)
name = ptr;
ptr = strrchr(stat_buff, ')');
*ptr = '\0'; //unecessary if?
- name = xmsprintf("[%s]", name);
+ name = xmprintf("[%s]", name);
ptr += 2; // goto STATE
n = sscanf(ptr, "%c %u %u %*u %d %*s %*s %*s %*s %*s %*s "
"%lu %lu %*s %*s %*s %d %*s %*s %lu %lu %ld",
@@ -272,15 +272,15 @@ static void do_ps_line(int pid, int tid)
switch (p->position) {
case 0:
pw = getpwuid(stats.st_uid);
- if (!pw) user = xmsprintf("%d",(int)stats.st_uid);
- else user = xmsprintf("%s", pw->pw_name);
+ if (!pw) user = xmprintf("%d",(int)stats.st_uid);
+ else user = xmprintf("%s", pw->pw_name);
printf("%-*.*s", width, width, user);
free(user);
break;
case 1:
gr = getgrgid(stats.st_gid);
- if (!gr) group = xmsprintf("%d",(int)stats.st_gid);
- else group = xmsprintf("%s", gr->gr_name);
+ if (!gr) group = xmprintf("%d",(int)stats.st_gid);
+ else group = xmprintf("%s", gr->gr_name);
printf("%-*.*s", width, width, group);
free(group);
break;
@@ -322,16 +322,16 @@ static void do_ps_line(int pid, int tid)
case 9:
get_uid_gid(stat_buff, "Gid:", &rgid);
gr = getgrgid(rgid);
- if (!gr) rgroup = xmsprintf("%d",(int)stats.st_gid);
- else rgroup = xmsprintf("%s", gr->gr_name);
+ if (!gr) rgroup = xmprintf("%d",(int)stats.st_gid);
+ else rgroup = xmprintf("%s", gr->gr_name);
printf("%-*.*s", width,width, rgroup);
free(rgroup);
break;
case 10:
get_uid_gid(stat_buff, "Uid:", &ruid);
pw = getpwuid(ruid);
- if (!pw) ruser = xmsprintf("%d",(int)stats.st_uid);
- else ruser = xmsprintf("%s", pw->pw_name);
+ if (!pw) ruser = xmprintf("%d",(int)stats.st_uid);
+ else ruser = xmprintf("%s", pw->pw_name);
printf("%-*.*s", width, width, ruser);
free(ruser);
break;
@@ -340,7 +340,7 @@ static void do_ps_line(int pid, int tid)
break;
case 12:
if (tty_major) {
- char *temp = xmsprintf("%d,%d", tty_major,tty_minor);
+ char *temp = xmprintf("%d,%d", tty_major,tty_minor);
printf("%-*s", width, temp);
free(temp);
} else printf("%-*s", width, "?");
@@ -370,7 +370,7 @@ void do_ps_threads(int pid)
DIR *d;
int tid;
struct dirent *de;
- char *tmp = xmsprintf("/proc/%d/task",pid);
+ char *tmp = xmprintf("/proc/%d/task",pid);
if (!(d = opendir(tmp))) {
free(tmp);
diff --git a/toys/pending/syslogd.c b/toys/pending/syslogd.c
index e272691d..28b14132 100644
--- a/toys/pending/syslogd.c
+++ b/toys/pending/syslogd.c
@@ -176,7 +176,7 @@ static int parse_config_file(void)
*/
if (toys.optflags & FLAG_R) {
file = xzalloc(sizeof(struct logfile));
- file->filename = xmsprintf("@%s",TT.remote_log);
+ file->filename = xmprintf("@%s",TT.remote_log);
TT.lfiles = file;
if (!(toys.optflags & FLAG_L)) return 0;
}
diff --git a/toys/pending/tcpsvd.c b/toys/pending/tcpsvd.c
index 37aafebf..031d7238 100644
--- a/toys/pending/tcpsvd.c
+++ b/toys/pending/tcpsvd.c
@@ -79,8 +79,8 @@ static char *sock_to_address(struct sockaddr *sock, int flags)
if (!(status = getnameinfo(sock, len, hbuf, sizeof(hbuf), sbuf,
sizeof(sbuf), flags))) {
- if (flags & NI_NUMERICSERV) return xmsprintf("%s:%s",hbuf, sbuf);
- return xmsprintf("%s",hbuf);
+ if (flags & NI_NUMERICSERV) return xmprintf("%s:%s",hbuf, sbuf);
+ return xmprintf("%s",hbuf);
}
error_exit("getnameinfo: %s", gai_strerror(status));
}
diff --git a/toys/pending/useradd.c b/toys/pending/useradd.c
index ecfd638f..450e021a 100644
--- a/toys/pending/useradd.c
+++ b/toys/pending/useradd.c
@@ -90,7 +90,7 @@ static void create_copy_skel(char *skel, char *hdir)
args[0] = "chown";
args[1] = "-R";
- args[2] = xmsprintf("%u:%u", TT.uid, TT.gid);
+ args[2] = xmprintf("%u:%u", TT.uid, TT.gid);
args[3] = hdir;
//Change ownership to that of UID and GID of new user
toys.exitval = exec_wait(args);
@@ -118,7 +118,7 @@ static void new_user()
if (toys.optflags & FLAG_g) pwd.pw_gecos = TT.gecos;
else pwd.pw_gecos = "Linux User,";
if (toys.optflags & FLAG_h) pwd.pw_dir = TT.dir;
- else pwd.pw_dir = xmsprintf("/home/%s", *toys.optargs);
+ else pwd.pw_dir = xmprintf("/home/%s", *toys.optargs);
if (toys.optflags & FLAG_s) pwd.pw_shell = TT.shell;
else pwd.pw_shell = get_shell();
@@ -168,7 +168,7 @@ static void new_user()
//add group, invoke addgroup command
args[0] = "groupadd";
args[1] = toys.optargs[0];
- args[2] = xmsprintf("-g%ld", pwd.pw_gid);
+ args[2] = xmprintf("-g%ld", pwd.pw_gid);
args[3] = NULL;
if (exec_wait(args)) error_msg("addgroup fail");
}
@@ -180,15 +180,15 @@ static void new_user()
*/
// 1. add an entry to /etc/passwd and /etc/shadow file
- entry = xmsprintf("%s:%s:%ld:%ld:%s:%s:%s", pwd.pw_name, pwd.pw_passwd,
+ entry = xmprintf("%s:%s:%ld:%ld:%s:%s:%s", pwd.pw_name, pwd.pw_passwd,
pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell);
if (update_password("/etc/passwd", pwd.pw_name, entry)) error_exit("updating passwd file failed");
free(entry);
if (toys.optflags & FLAG_S)
- entry = xmsprintf("%s:!!:%u::::::", pwd.pw_name,
+ entry = xmprintf("%s:!!:%u::::::", pwd.pw_name,
(unsigned)(time(NULL))/(24*60*60)); //passwd is not set initially
- else entry = xmsprintf("%s:!!:%u:%ld:%ld:%ld:::", pwd.pw_name,
+ else entry = xmprintf("%s:!!:%u:%ld:%ld:%ld:::", pwd.pw_name,
(unsigned)(time(NULL))/(24*60*60), 0, 99999, 7); //passwd is not set initially
update_password("/etc/shadow", pwd.pw_name, entry);
free(entry);
diff --git a/toys/pending/watch.c b/toys/pending/watch.c
index b7fdb5c4..8343fe1f 100644
--- a/toys/pending/watch.c
+++ b/toys/pending/watch.c
@@ -35,10 +35,10 @@ void watch_main(void)
while(toys.optargs[++i])
{
char * oldcmd = cmd;
- cmd = xmsprintf("%s %s", oldcmd, toys.optargs[i]);
+ cmd = xmprintf("%s %s", oldcmd, toys.optargs[i]);
if (CFG_TOYBOX_FREE) free(oldcmd);
}
- header = xmsprintf("Every %us: %s", TT.interval, cmd);
+ header = xmprintf("Every %us: %s", TT.interval, cmd);
hlen = strlen(header);
while(1) {