aboutsummaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2011-02-12 22:26:57 -0800
committerDenys Vlasenko <vda.linux@googlemail.com>2011-02-13 18:37:12 +0100
commitdc50676cce35cdba3ecba3870c3f752408d6db70 (patch)
treea8c7861c43f656b1013a0e57672446d63ffdb263 /runit
parent4ed3c52ce9b3ce5604c4fa075fda374f8cd01eea (diff)
downloadbusybox-w32-dc50676cce35cdba3ecba3870c3f752408d6db70.tar.gz
busybox-w32-dc50676cce35cdba3ecba3870c3f752408d6db70.tar.bz2
busybox-w32-dc50676cce35cdba3ecba3870c3f752408d6db70.zip
Move stpcpy replacement function into libbb
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'runit')
-rw-r--r--runit/runsv.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/runit/runsv.c b/runit/runsv.c
index ebb031837..e76572daa 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -139,16 +139,6 @@ static void s_term(int sig_no UNUSED_PARAM)
139 write(selfpipe.wr, "", 1); /* XXX */ 139 write(selfpipe.wr, "", 1); /* XXX */
140} 140}
141 141
142/* libbb candidate */
143static char *bb_stpcpy(char *p, const char *to_add)
144{
145 while ((*p = *to_add) != '\0') {
146 p++;
147 to_add++;
148 }
149 return p;
150}
151
152static int open_trunc_or_warn(const char *name) 142static int open_trunc_or_warn(const char *name)
153{ 143{
154 /* Why O_NDELAY? */ 144 /* Why O_NDELAY? */
@@ -192,26 +182,26 @@ static void update_status(struct svdir *s)
192 char *p = stat_buf; 182 char *p = stat_buf;
193 switch (s->state) { 183 switch (s->state) {
194 case S_DOWN: 184 case S_DOWN:
195 p = bb_stpcpy(p, "down"); 185 p = stpcpy(p, "down");
196 break; 186 break;
197 case S_RUN: 187 case S_RUN:
198 p = bb_stpcpy(p, "run"); 188 p = stpcpy(p, "run");
199 break; 189 break;
200 case S_FINISH: 190 case S_FINISH:
201 p = bb_stpcpy(p, "finish"); 191 p = stpcpy(p, "finish");
202 break; 192 break;
203 } 193 }
204 if (s->ctrl & C_PAUSE) 194 if (s->ctrl & C_PAUSE)
205 p = bb_stpcpy(p, ", paused"); 195 p = stpcpy(p, ", paused");
206 if (s->ctrl & C_TERM) 196 if (s->ctrl & C_TERM)
207 p = bb_stpcpy(p, ", got TERM"); 197 p = stpcpy(p, ", got TERM");
208 if (s->state != S_DOWN) 198 if (s->state != S_DOWN)
209 switch (s->sd_want) { 199 switch (s->sd_want) {
210 case W_DOWN: 200 case W_DOWN:
211 p = bb_stpcpy(p, ", want down"); 201 p = stpcpy(p, ", want down");
212 break; 202 break;
213 case W_EXIT: 203 case W_EXIT:
214 p = bb_stpcpy(p, ", want exit"); 204 p = stpcpy(p, ", want exit");
215 break; 205 break;
216 } 206 }
217 *p++ = '\n'; 207 *p++ = '\n';