On Sunday 13 February 2011 07:26, Dan Fandrich wrote:
> Signed-off-by: Dan Fandrich <[email protected]>
> ---
>  include/platform.h |    8 ++++++++
>  libbb/platform.c   |   11 +++++++++++
>  runit/runsv.c      |   24 +++++++-----------------
>  3 files changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/include/platform.h b/include/platform.h
> index 00ebe56..e390e58 100644
> --- a/include/platform.h
> +++ b/include/platform.h
> @@ -18,6 +18,7 @@
>  #define HAVE_PTSNAME_R 1
>  #define HAVE_SETBIT 1
>  #define HAVE_SIGHANDLER_T 1
> +#define HAVE_STPCPY 1
>  #define HAVE_STRCASESTR 1
>  #define HAVE_STRCHRNUL 1
>  #define HAVE_STRSEP 1
> @@ -356,6 +357,8 @@ typedef unsigned smalluint;
>  #  define ADJ_TICK MOD_CLKB
>  # endif
>  
> +# undef HAVE_STPCPY
> +
>  #else
>  
>  # define bb_setpgrp() setpgrp()
> @@ -376,6 +379,7 @@ typedef unsigned smalluint;
>  # undef HAVE_MEMRCHR
>  # undef HAVE_MKDTEMP
>  # undef HAVE_SETBIT
> +# undef HAVE_STPCPY
>  # undef HAVE_STRCASESTR
>  # undef HAVE_STRCHRNUL
>  # undef HAVE_STRSEP
> @@ -413,6 +417,10 @@ extern char *mkdtemp(char *template) FAST_FUNC;
>  typedef void (*sighandler_t)(int);
>  #endif
>  
> +#ifndef HAVE_STPCPY
> +extern char *stpcpy(char *p, const char *to_add) FAST_FUNC;
> +#endif
> +
>  #ifndef HAVE_STRCASESTR
>  extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
>  #endif
> diff --git a/libbb/platform.c b/libbb/platform.c
> index ccde2bf..569a305 100644
> --- a/libbb/platform.c
> +++ b/libbb/platform.c
> @@ -134,3 +134,14 @@ char* FAST_FUNC strsep(char **stringp, const char *delim)
>       return start;
>  }
>  #endif
> +
> +#ifndef HAVE_STPCPY
> +char * FAST_FUNC stpcpy(char *p, const char *to_add)
> +{
> +     while ((*p = *to_add) != '\0') {
> +             p++;
> +             to_add++;
> +     }
> +     return p;
> +}
> +#endif
> diff --git a/runit/runsv.c b/runit/runsv.c
> index ebb0318..e76572d 100644
> --- a/runit/runsv.c
> +++ b/runit/runsv.c
> @@ -139,16 +139,6 @@ static void s_term(int sig_no UNUSED_PARAM)
>       write(selfpipe.wr, "", 1); /* XXX */
>  }
>  
> -/* libbb candidate */
> -static char *bb_stpcpy(char *p, const char *to_add)
> -{
> -     while ((*p = *to_add) != '\0') {
> -             p++;
> -             to_add++;
> -     }
> -     return p;
> -}
> -
>  static int open_trunc_or_warn(const char *name)
>  {
>       /* Why O_NDELAY? */
> @@ -192,26 +182,26 @@ static void update_status(struct svdir *s)
>               char *p = stat_buf;
>               switch (s->state) {
>               case S_DOWN:
> -                     p = bb_stpcpy(p, "down");
> +                     p = stpcpy(p, "down");
>                       break;
>               case S_RUN:
> -                     p = bb_stpcpy(p, "run");
> +                     p = stpcpy(p, "run");
>                       break;
>               case S_FINISH:
> -                     p = bb_stpcpy(p, "finish");
> +                     p = stpcpy(p, "finish");
>                       break;
>               }
>               if (s->ctrl & C_PAUSE)
> -                     p = bb_stpcpy(p, ", paused");
> +                     p = stpcpy(p, ", paused");
>               if (s->ctrl & C_TERM)
> -                     p = bb_stpcpy(p, ", got TERM");
> +                     p = stpcpy(p, ", got TERM");
>               if (s->state != S_DOWN)
>                       switch (s->sd_want) {
>                       case W_DOWN:
> -                             p = bb_stpcpy(p, ", want down");
> +                             p = stpcpy(p, ", want down");
>                               break;
>                       case W_EXIT:
> -                             p = bb_stpcpy(p, ", want exit");
> +                             p = stpcpy(p, ", want exit");
>                               break;
>                       }
>               *p++ = '\n';


Applied, thanks!
-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to