aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-09-29 16:18:57 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-09-29 16:18:57 +0000
commit39a841cecf616098c9c8cf63bbfea5ea2922097c (patch)
tree5b3a1d569d1e952d8c43899050dca4d6c47bf176 /libbb
parent6a60c821a81b01a136037f8389bd42d86b37e395 (diff)
downloadbusybox-w32-39a841cecf616098c9c8cf63bbfea5ea2922097c.tar.gz
busybox-w32-39a841cecf616098c9c8cf63bbfea5ea2922097c.tar.bz2
busybox-w32-39a841cecf616098c9c8cf63bbfea5ea2922097c.zip
change interface to bb_xasprintf() - more perfect for me.
ln.c: error_msg(str)->error_msg(%s, str) - remove standart "feature" for hackers reduce 100 bytes don't care in sum
Diffstat (limited to 'libbb')
-rw-r--r--libbb/bb_asprintf.c8
-rw-r--r--libbb/concat_path_file.c5
-rw-r--r--libbb/run_shell.c7
3 files changed, 8 insertions, 12 deletions
diff --git a/libbb/bb_asprintf.c b/libbb/bb_asprintf.c
index a3ba42454..8658a5408 100644
--- a/libbb/bb_asprintf.c
+++ b/libbb/bb_asprintf.c
@@ -1,5 +1,5 @@
1/* 1/*
2 Copyright (C) 2002 Vladimir Oleynik <dzo@simtreas.ru> 2 Copyright (C) 2002,2005 Vladimir Oleynik <dzo@simtreas.ru>
3*/ 3*/
4 4
5#include <stdlib.h> 5#include <stdlib.h>
@@ -7,16 +7,18 @@
7#include <stdarg.h> 7#include <stdarg.h>
8#include "libbb.h" 8#include "libbb.h"
9 9
10void bb_xasprintf(char **string_ptr, const char *format, ...) 10char *bb_xasprintf(const char *format, ...)
11{ 11{
12 va_list p; 12 va_list p;
13 int r; 13 int r;
14 char *string_ptr;
14 15
15 va_start(p, format); 16 va_start(p, format);
16 r = vasprintf(string_ptr, format, p); 17 r = vasprintf(&string_ptr, format, p);
17 va_end(p); 18 va_end(p);
18 19
19 if (r < 0) { 20 if (r < 0) {
20 bb_perror_msg_and_die("bb_xasprintf"); 21 bb_perror_msg_and_die("bb_xasprintf");
21 } 22 }
23 return string_ptr;
22} 24}
diff --git a/libbb/concat_path_file.c b/libbb/concat_path_file.c
index 00233ad9a..029c23272 100644
--- a/libbb/concat_path_file.c
+++ b/libbb/concat_path_file.c
@@ -30,7 +30,6 @@
30 30
31extern char *concat_path_file(const char *path, const char *filename) 31extern char *concat_path_file(const char *path, const char *filename)
32{ 32{
33 char *outbuf;
34 char *lc; 33 char *lc;
35 34
36 if (!path) 35 if (!path)
@@ -38,7 +37,5 @@ extern char *concat_path_file(const char *path, const char *filename)
38 lc = last_char_is(path, '/'); 37 lc = last_char_is(path, '/');
39 while (*filename == '/') 38 while (*filename == '/')
40 filename++; 39 filename++;
41 bb_xasprintf(&outbuf, "%s%s%s", path, (lc==NULL ? "/" : ""), filename); 40 return bb_xasprintf("%s%s%s", path, (lc==NULL ? "/" : ""), filename);
42
43 return outbuf;
44} 41}
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 67ff2a5f8..6d084eead 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -84,11 +84,8 @@ void run_shell ( const char *shell, int loginshell, const char *command, const c
84 84
85 args [0] = bb_get_last_path_component ( bb_xstrdup ( shell )); 85 args [0] = bb_get_last_path_component ( bb_xstrdup ( shell ));
86 86
87 if ( loginshell ) { 87 if ( loginshell )
88 char *args0; 88 args [0] = bb_xasprintf ("-%s", args [0]);
89 bb_xasprintf ( &args0, "-%s", args [0] );
90 args [0] = args0;
91 }
92 89
93 if ( command ) { 90 if ( command ) {
94 args [argno++] = "-c"; 91 args [argno++] = "-c";