Changeset 56ed56a6 in rtems


Ignore:
Timestamp:
Oct 3, 2014, 10:55:12 PM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11, master
Children:
dfc2786d
Parents:
7db6953
Message:

libmisc/shell: Remove the need for -lm when linking from the ping command.

Remove the use of sqrt and so the need to link to -lm.
Clean up some warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/main_ping.c

    r7db6953 r56ed56a6  
    8787//#include <err.h>
    8888#include <errno.h>
     89#if !defined(__rtems__)
    8990#include <math.h>
     91#endif
    9092#include <netdb.h>
    9193#include <signal.h>
     
    334336static void pr_iph(struct ip *);
    335337static void pr_retip(struct ip *);
    336 static void status(int);
    337338static void stopit(int);
    338339static void tvsub(struct timeval *, struct timeval *);
     
    359360static void g_usage(rtems_shell_globals_t* globals) __dead2;
    360361
    361 void
     362static void
    362363rtems_shell_ping_exit (rtems_shell_globals_t* globals, int code)
    363364{
     
    15821583 */
    15831584
     1585#if !defined(__rtems__)
    15841586static void
    15851587status(sig)
    15861588        int sig __unused;
    15871589{
    1588 #if !__rtems__
    15891590        siginfo_p = 1;
    1590 #endif
    15911591}
     1592#endif
    15921593
    15931594static void
     
    16391640                double n = nreceived + nrepeats;
    16401641                double avg = tsum / n;
     1642#if defined(__rtems__)
     1643                (void) printf(
     1644                    "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f ms\n",
     1645                    tmin, avg, tmax);
     1646#else
    16411647                double vari = tsumsq / n - avg * avg;
    16421648                (void)printf(
    16431649                    "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n",
    16441650                    tmin, avg, tmax, sqrt(vari));
     1651#endif
    16451652        }
    16461653        if (nreceived)
     
    19181925
    19191926        for (cp = patp; *cp; cp++) {
    1920                 if (!isxdigit(*cp))
     1927                if (!isxdigit((int)*cp))
    19211928                        errx(&globals->exit_jmp, EX_USAGE,
    19221929                            "patterns must be specified as hex digits");
Note: See TracChangeset for help on using the changeset viewer.