File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / mtr / ui / utils.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:07:30 2021 UTC (3 years, 3 months ago) by misho
Branches: mtr, MAIN
CVS tags: v0_95, v0_94, HEAD
mtr 0.94

    1: /*
    2:     mtr  --  a network diagnostic tool
    3:     Copyright (C) 1997,1998  Matt Kimball
    4:     Copyright (C) 2005 R.E.Wolff@BitWizard.nl
    5: 
    6:     This program is free software; you can redistribute it and/or modify
    7:     it under the terms of the GNU General Public License version 2 as
    8:     published by the Free Software Foundation.
    9: 
   10:     This program is distributed in the hope that it will be useful,
   11:     but WITHOUT ANY WARRANTY; without even the implied warranty of
   12:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13:     GNU General Public License for more details.
   14: 
   15:     You should have received a copy of the GNU General Public License along
   16:     with this program; if not, write to the Free Software Foundation, Inc.,
   17:     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   18: */
   19: 
   20: enum {
   21:     STRTO_INT,
   22:     STRTO_U32INT
   23: };
   24: 
   25: extern char *trim(
   26:     char *s,
   27:     const char c);
   28: extern int strtonum_or_err(
   29:     const char *str,
   30:     const char *errmesg,
   31:     const int type);
   32: extern float strtofloat_or_err(
   33:     const char *str,
   34:     const char *errmesg);
   35: 
   36: /* Like strncpy(3) but ensure null termination. */
   37: static inline void xstrncpy(
   38:     char *dest,
   39:     const char *src,
   40:     size_t n)
   41: {
   42:     strncpy(dest, src, n - 1);
   43:     dest[n - 1] = 0;
   44: }
   45: 
   46: extern void *xmalloc(
   47:     const size_t size);
   48: extern char *xstrdup(
   49:     const char *str);
   50: 
   51: extern void close_stdout(
   52:     void);
   53: 
   54: extern const char *iso_time(
   55:     const time_t * t);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>