Ethereal-dev: [ethereal-dev] "gcc -Wall" warnings

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: guy@xxxxxxxxxx (Guy Harris)
Date: Tue, 13 Oct 1998 00:29:39 -0700 (PDT)
I checked in changes to clean up a bunch of "gcc -Wall" warnings. 
(Patch attached, although note that one thing it did was to rename
"snprintf.h" to "snprintf-imp.h" - it is actually a header file of stuff
used by "snprintf.c", the implementation of the
"snprintf()"/"vsnprintf()" interface, and

	1) declares a bunch of stuff its callers don't need or want, and
	   that causes "gcc -Wall" warnings;

	2) *doesn't* declare "snprintf()" or "vsnprintf()" itself -

and adds a new "snprintf.h" that only declares those two functions. 
I've attached a shell archive containing the patch and "snprintf-imp.h".)

The warnings that remain are:

follow.c: In function `reassemble_tcp':
follow.c:145: warning: implicit declaration of function `bcopy'

	Arguably, one should use "memmove()" here, but not all systems
	have it (e.g., SunOS 4.1[.x]).  I guess one could arrange to do

		#define memmove(dst, src, n)    bcopy(src, dst, n)

	on those systems, but there's no header file in SunOS 4.1[x.] that
	declares "bcopy()" - but that's true of a *lot* of functions, so
	you'll just get a lot of "gcc -Wall" noise on 4.1[.x], so maybe
	that's the right thing to do.

follow.c: In function `check_fragments':
follow.c:171: warning: assignment makes integer from pointer without a cast

	It's setting a member of the "src" index to a pointer in the
	reassembly code; I'm not sure it's supposed to be doing that.

packet-osi.c: In function `osi_decode_DR':
packet-osi.c:247: warning: too few arguments for format

	The statement in question is:

    sprintf(fd->win_info[COL_INFO], "DR TPDU src-ref: 0x%04x dst-ref: 0x%04x %s",
	    src_ref, dst_ref);

	Not being an OSI TP guru, I don't know what, if anything, should
	be printed after the "src-ref" and "dst-ref", matching the "%s"
	- "str"?

packet-ospf.c: In function `dissect_ospf':
packet-ospf.c:63: warning: `packet_type' might be used uninitialized in this function

	The comment that either I or somebody else stuck into the switch
	statement  in the "default" case was

	    /* XXX - set it to some string with the value of
	       "ospfh.packet_type"? */

	The problem is that "packet_type" isn't set if
	"ospfh.packet_type" isn't one of the types in the switch
	statement; from an OSPF book I have, those types *look* like the
	only legal packet types, but packet capture programs shouldn't
	assume only legal packets arrive (I've used them to debug
	problems in which my code was sending illegal packets out...).

prefs.c: In function `prefs_cb':
prefs.c:50: warning: unused variable `nlabel'

	This looks as if it's intended to be used when some
	commented-out code is finished and un-commented, so it should
	probably be left there as a reminder.

Shell archive containing patch and "snprintf-imp.h" (which is just a
slight modification of "snprintf.h", renamed):

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  patch snprintf-imp.h
# Wrapped by guy@tooting on Tue Oct 13 00:28:34 1998
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch'\"
else
echo shar: Extracting \"'patch'\" \(12673 characters\)
sed "s/^X//" >'patch' <<'END_OF_FILE'
XIndex: Makefile.am
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/Makefile.am,v
Xretrieving revision 1.8
Xdiff -c -r1.8 Makefile.am
X*** Makefile.am	1998/10/12 01:40:40	1.8
X--- Makefile.am	1998/10/13 06:52:19
X***************
X*** 63,69 ****
X  
X  EXTRA_ethereal_SOURCES = \
X  	snprintf.c           \
X! 	snprintf.h
X  
X  ethereal_DEPENDENCIES = @SNPRINTF_O@
X  ethereal_LDADD = @SNPRINTF_O@
X--- 63,70 ----
X  
X  EXTRA_ethereal_SOURCES = \
X  	snprintf.c           \
X! 	snprintf.h           \
X! 	snprintf-imp.h
X  
X  ethereal_DEPENDENCIES = @SNPRINTF_O@
X  ethereal_LDADD = @SNPRINTF_O@
X
XIndex: Makefile.in
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/Makefile.in,v
Xretrieving revision 1.8
Xdiff -c -r1.8 Makefile.in
X*** Makefile.in	1998/10/12 01:40:41	1.8
X--- Makefile.in	1998/10/13 06:52:19
X***************
X*** 135,141 ****
X  
X  EXTRA_ethereal_SOURCES = \
X  	snprintf.c           \
X! 	snprintf.h
X  
X  ethereal_DEPENDENCIES = @SNPRINTF_O@
X  ethereal_LDADD = @SNPRINTF_O@
X--- 135,142 ----
X  
X  EXTRA_ethereal_SOURCES = \
X  	snprintf.c           \
X! 	snprintf.h           \
X! 	snprintf-imp.h
X  
X  ethereal_DEPENDENCIES = @SNPRINTF_O@
X  ethereal_LDADD = @SNPRINTF_O@
X
XIndex: capture.c
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/capture.c,v
Xretrieving revision 1.6
Xdiff -c -r1.6 capture.c
X*** capture.c	1998/10/12 01:40:43	1.6
X--- capture.c	1998/10/13 06:52:19
X***************
X*** 36,46 ****
X--- 36,52 ----
X  #include <pcap.h>
X  
X  #include <string.h>
X+ #include <unistd.h>
X  #include <sys/socket.h>
X  #include <sys/ioctl.h>
X  #include <net/if.h>
X  
X  #ifdef NEED_SNPRINTF_H
X+ # ifdef HAVE_STDARG_H
X+ #  include <stdarg.h>
X+ # else
X+ #  include <varargs.h>
X+ # endif
X  # include "snprintf.h"
X  #endif
X  
X
XIndex: file.c
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/file.c,v
Xretrieving revision 1.9
Xdiff -c -r1.9 file.c
X*** file.c	1998/10/13 02:10:54	1.9
X--- file.c	1998/10/13 06:52:20
X***************
X*** 37,42 ****
X--- 37,47 ----
X  #include <errno.h>
X  
X  #ifdef NEED_SNPRINTF_H
X+ # ifdef HAVE_STDARG_H
X+ #  include <stdarg.h>
X+ # else
X+ #  include <varargs.h>
X+ # endif
X  # include "snprintf.h"
X  #endif
X  
X
XIndex: filter.c
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/filter.c,v
Xretrieving revision 1.6
Xdiff -c -r1.6 filter.c
X*** filter.c	1998/10/13 02:10:55	1.6
X--- filter.c	1998/10/13 06:52:21
X***************
X*** 429,436 ****
X  
X  void
X  filter_prefs_cancel(GtkWidget *w) {
X!   filter_def *filt;
X!   
X    /* Let the list cb know we're about to destroy the widget tree, so it */
X    /* doesn't operate on widgets that don't exist. */  
X    gtk_object_set_data(GTK_OBJECT(w), E_FILT_CM_KEY, (gpointer)TRUE);
X--- 429,435 ----
X  
X  void
X  filter_prefs_cancel(GtkWidget *w) {
X!  
X    /* Let the list cb know we're about to destroy the widget tree, so it */
X    /* doesn't operate on widgets that don't exist. */  
X    gtk_object_set_data(GTK_OBJECT(w), E_FILT_CM_KEY, (gpointer)TRUE);
X
XIndex: packet-ospf.c
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/packet-ospf.c,v
Xretrieving revision 1.5
Xdiff -c -r1.5 packet-ospf.c
X*** packet-ospf.c	1998/10/10 03:32:13	1.5
X--- packet-ospf.c	1998/10/13 06:52:21
X***************
X*** 570,576 ****
X                  add_item_to_tree(ospf_lsa_tree, offset + 5,  3,"Metric: %d", asext_metric);
X                  add_item_to_tree(ospf_lsa_tree, offset + 8,  4,"Forwarding Address: %s", 
X                                                   ip_to_str((guint8 *) &(asext_lsa.gateway)));
X!                 add_item_to_tree(ospf_lsa_tree, offset + 12, 4,"External Route Tag: %d", ntohl(asext_lsa.external_tag)); 
X                      
X                  break;
X              default:
X--- 570,576 ----
X                  add_item_to_tree(ospf_lsa_tree, offset + 5,  3,"Metric: %d", asext_metric);
X                  add_item_to_tree(ospf_lsa_tree, offset + 8,  4,"Forwarding Address: %s", 
X                                                   ip_to_str((guint8 *) &(asext_lsa.gateway)));
X!                 add_item_to_tree(ospf_lsa_tree, offset + 12, 4,"External Route Tag: %ld", (long)ntohl(asext_lsa.external_tag)); 
X                      
X                  break;
X              default:
X
XIndex: snprintf.c
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/snprintf.c,v
Xretrieving revision 1.1.1.1
Xdiff -c -r1.1.1.1 snprintf.c
X*** snprintf.c	1998/09/16 02:39:18	1.1.1.1
X--- snprintf.c	1998/10/13 06:52:21
X***************
X*** 44,49 ****
X--- 44,50 ----
X  # include <config.h>
X  #endif
X  
X+ #include "snprintf-imp.h"
X  #include "snprintf.h"
X  
X  /*
X
XIndex: snprintf.h
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/snprintf.h,v
Xretrieving revision 1.1.1.1
Xdiff -c -r1.1.1.1 snprintf.h
X*** snprintf.h	1998/09/16 02:39:18	1.1.1.1
X--- snprintf.h	1998/10/13 06:52:21
X***************
X*** 1,232 ****
X! /*
X!  Unix snprintf implementation.
X!  Version 1.2
X!    
X!    This program is free software; you can redistribute it and/or modify
X!    it under the terms of the GNU General Public License as published by
X!    the Free Software Foundation; either version 2 of the License, or
X!    (at your option) any later version.
X!    It can be redistribute also under the terms of GNU Library General
X!    Public Lincense.
X!    
X!    This program is distributed in the hope that it will be useful,
X!    but WITHOUT ANY WARRANTY; without even the implied warranty of
X!    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X!    GNU General Public License for more details.
X!    
X!    You should have received a copy of the GNU General Public License
X!    along with this program; if not, write to the Free Software
X!    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X!    
X!    Revision History:
X! 
X!    1.2:
X!       * put under LGPL.
X!    1.1:
X!       *  added changes from Miles Bader
X!       *  corrected a bug with %f
X!       *  added support for %#g
X!       *  added more comments :-)
X!    1.0:
X!       *  supporting must ANSI syntaxic_sugars(see below)
X!    0.0:
X!       *  suppot %s %c %d
X! 
X!     it understands:
X!       Integer:
X!         %lu %lu %u
X!         %hd %ld %d     decimal
X!         %ho %lo %o     octal
X!         %hx %lx %x %X  hexa
X!       Floating points:
X!         %g %G %e %E %f  double
X!       Strings:
X!         %s %c  string
X!         %%   %
X! 
X!     Formating conversion flags:
X!       - justify left
X!       + Justify right or put a plus if number
X!       # prefix 0x, 0X for hexa and 0 for octal
X!       * precision/witdth is specify as an (int) in the arguments
X!     ' ' leave a blank for number with no sign
X!       l the later should be a long
X!       h the later should be a short
X! 
X! format:
X!   snprintf(holder, sizeof_holder, format, ...)
X! 
X! Return values:
X!   (sizeof_holder - 1)
X! 
X! 
X!  THANKS(for the patches and ideas):
X!      Miles Bader
X!      Cyrille Rustom
X!      Jacek Slabocewiz
X!      Mike Parker(mouse)
X! 
X! Alain Magloire: alainm@xxxxxxxxxxxxxxxxx
X! */
X  
X  #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
X! #include <stdarg.h>
X! #else
X! #include <varargs.h>
X! #endif
X! 
X! #include <stdlib.h>    /* for atoi() */
X! #include <ctype.h>
X! 
X! 
X! /* 
X!  * For the FLOATING POINT FORMAT :
X!  *  the challenge was finding a way to
X!  *  manipulate the Real numbers without having
X!  *  to resort to mathematical function(it
X!  *  would require to link with -lm) and not
X!  *  going down to the bit pattern(not portable)
X!  *
X!  *  so a number, a real is:
X! 
X!       real = integral + fraction
X! 
X!       integral = ... + a(2)*10^2 + a(1)*10^1 + a(0)*10^0
X!       fraction = b(1)*10^-1 + b(2)*10^-2 + ...
X! 
X!       where:
X!        0 <= a(i) => 9 
X!        0 <= b(i) => 9 
X!  
X!     from then it was simple math
X!  */
X! 
X! /*
X!  * size of the buffer for the integral part
X!  * and the fraction part 
X!  */
X! #define MAX_INT  99 + 1 /* 1 for the null */
X! #define MAX_FRACT 29 + 1
X! 
X! /* 
X!  * numtoa() uses PRIVATE buffers to store the results,
X!  * So this function is not reentrant
X!  */
X! #define itoa(n) numtoa(n, 10, 0, (char **)0) 
X! #define otoa(n) numtoa(n, 8, 0, (char **)0)
X! #define htoa(n) numtoa(n, 16, 0, (char **)0)
X! #define dtoa(n, p, f) numtoa(n, 10, p, f)
X! 
X! #define SWAP_INT(a,b) {int t; t = (a); (a) = (b); (b) = t;}
X! 
X! /* this struct holds everything we need */
X! struct DATA {
X!   int length;
X!   char *holder;
X!   int counter;
X! #ifdef __STDC__
X!   const char *pf;
X  #else
X!   char *pf;
X  #endif
X- /* FLAGS */
X-   int width, precision;
X-   int justify; char pad;
X-   int square, space, star_w, star_p, a_long ;
X- };
X- 
X- #define PRIVATE static
X- #define PUBLIC
X- /* signature of the functions */
X- #ifdef __STDC__
X- /* the floating point stuff */
X-   PRIVATE double pow_10(int);
X-   PRIVATE int log_10(double);
X-   PRIVATE double integral(double, double *);
X-   PRIVATE char * numtoa(double, int, int, char **);
X- 
X- /* for the format */
X-   PRIVATE void conv_flag(char *, struct DATA *);
X-   PRIVATE void floating(struct DATA *, double);
X-   PRIVATE void exponent(struct DATA *, double);
X-   PRIVATE void decimal(struct DATA *, double);
X-   PRIVATE void octal(struct DATA *, double);
X-   PRIVATE void hexa(struct DATA *, double);
X-   PRIVATE void strings(struct DATA *, char *);
X- 
X- #else
X- /* the floating point stuff */
X-   PRIVATE double pow_10();
X-   PRIVATE int log_10();
X-   PRIVATE double integral();
X-   PRIVATE char * numtoa();
X- 
X- /* for the format */
X-   PRIVATE void conv_flag();
X-   PRIVATE void floating();
X-   PRIVATE void exponent();
X-   PRIVATE void decimal();
X-   PRIVATE void octal();
X-   PRIVATE void hexa();
X-   PRIVATE void strings();
X- #endif
X- 
X- /* those are defines specific to snprintf to hopefully
X-  * make the code clearer :-)
X-  */
X- #define RIGHT 1
X- #define LEFT  0
X- #define NOT_FOUND -1
X- #define FOUND 1
X- #define MAX_FIELD 15
X- 
X- /* the conversion flags */
X- #define isflag(c) ((c) == '#' || (c) == ' ' || \
X-                    (c) == '*' || (c) == '+' || \
X-                    (c) == '-' || (c) == '.' || \
X-                    isdigit(c))
X- 
X- /* round off to the precision */
X- #define ROUND(d, p) \
X-             (d < 0.) ? \
X-              d - pow_10(-(p)->precision) * 0.5 : \
X-              d + pow_10(-(p)->precision) * 0.5
X- 
X- /* set default precision */
X- #define DEF_PREC(p) \
X-             if ((p)->precision == NOT_FOUND) \
X-               (p)->precision = 6
X- 
X- /* put a char */
X- #define PUT_CHAR(c, p) \
X-             if ((p)->counter < (p)->length) { \
X-               *(p)->holder++ = (c); \
X-               (p)->counter++; \
X-             }
X- 
X- #define PUT_PLUS(d, p) \
X-             if ((d) > 0. && (p)->justify == RIGHT) \
X-               PUT_CHAR('+', p)
X- 
X- #define PUT_SPACE(d, p) \
X-             if ((p)->space == FOUND && (d) > 0.) \
X-               PUT_CHAR(' ', p)
X- 
X- /* pad right */ 
X- #define PAD_RIGHT(p) \
X-             if ((p)->width > 0 && (p)->justify != LEFT) \
X-               for (; (p)->width > 0; (p)->width--) \
X-                  PUT_CHAR((p)->pad, p)
X- 
X- /* pad left */
X- #define PAD_LEFT(p) \
X-             if ((p)->width > 0 && (p)->justify == LEFT) \
X-               for (; (p)->width > 0; (p)->width--) \
X-                  PUT_CHAR((p)->pad, p)
X- 
X- /* if width and prec. in the args */
X- #define STAR_ARGS(p) \
X-             if ((p)->star_w == FOUND) \
X-               (p)->width = va_arg(args, int); \
X-             if ((p)->star_p == FOUND) \
X-               (p)->precision = va_arg(args, int)
X--- 1,9 ----
X! extern int vsnprintf(char *string, size_t length, const char * format,
X!   va_list args);
X  
X  #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
X! extern int snprintf(char *string, size_t length, const char * format, ...);
X  #else
X! extern int snprintf(char *string, size_t length, const char * format,
X!   int va_alist);
X  #endif
X
XIndex: util.c
X===================================================================
XRCS file: /usr/local/cvsroot/ethereal/util.c,v
Xretrieving revision 1.4
Xdiff -c -r1.4 util.c
X*** util.c	1998/10/12 01:40:57	1.4
X--- util.c	1998/10/13 06:52:21
X***************
X*** 34,39 ****
X--- 34,48 ----
X  #include <stdarg.h>
X  #include <strings.h>
X  
X+ #ifdef NEED_SNPRINTF_H
X+ # ifdef HAVE_STDARG_H
X+ #  include <stdarg.h>
X+ # else
X+ #  include <varargs.h>
X+ # endif
X+ # include "snprintf.h"
X+ #endif
X+ 
X  #include "util.h"
X  
X  #include "image/icon-excl.xpm"
END_OF_FILE
if test 12673 -ne `wc -c <'patch'`; then
    echo shar: \"'patch'\" unpacked with wrong size!
fi
# end of 'patch'
fi
if test -f 'snprintf-imp.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'snprintf-imp.h'\"
else
echo shar: Extracting \"'snprintf-imp.h'\" \(6130 characters\)
sed "s/^X//" >'snprintf-imp.h' <<'END_OF_FILE'
X/*
X Unix snprintf implementation.
X Version 1.2
X   
X   This program is free software; you can redistribute it and/or modify
X   it under the terms of the GNU General Public License as published by
X   the Free Software Foundation; either version 2 of the License, or
X   (at your option) any later version.
X   It can be redistribute also under the terms of GNU Library General
X   Public Lincense.
X   
X   This program is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X   GNU General Public License for more details.
X   
X   You should have received a copy of the GNU General Public License
X   along with this program; if not, write to the Free Software
X   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X   
X   Revision History:
X
X   1.2:
X      * put under LGPL.
X   1.1:
X      *  added changes from Miles Bader
X      *  corrected a bug with %f
X      *  added support for %#g
X      *  added more comments :-)
X   1.0:
X      *  supporting must ANSI syntaxic_sugars(see below)
X   0.0:
X      *  suppot %s %c %d
X
X    it understands:
X      Integer:
X        %lu %lu %u
X        %hd %ld %d     decimal
X        %ho %lo %o     octal
X        %hx %lx %x %X  hexa
X      Floating points:
X        %g %G %e %E %f  double
X      Strings:
X        %s %c  string
X        %%   %
X
X    Formating conversion flags:
X      - justify left
X      + Justify right or put a plus if number
X      # prefix 0x, 0X for hexa and 0 for octal
X      * precision/witdth is specify as an (int) in the arguments
X    ' ' leave a blank for number with no sign
X      l the later should be a long
X      h the later should be a short
X
Xformat:
X  snprintf(holder, sizeof_holder, format, ...)
X
XReturn values:
X  (sizeof_holder - 1)
X
X
X THANKS(for the patches and ideas):
X     Miles Bader
X     Cyrille Rustom
X     Jacek Slabocewiz
X     Mike Parker(mouse)
X
XAlain Magloire: alainm@xxxxxxxxxxxxxxxxx
X*/
X
X#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
X#include <stdarg.h>
X#else
X#include <varargs.h>
X#endif
X
X#include <stdlib.h>    /* for atoi() */
X#include <ctype.h>
X
X
X/* 
X * For the FLOATING POINT FORMAT :
X *  the challenge was finding a way to
X *  manipulate the Real numbers without having
X *  to resort to mathematical function(it
X *  would require to link with -lm) and not
X *  going down to the bit pattern(not portable)
X *
X *  so a number, a real is:
X
X      real = integral + fraction
X
X      integral = ... + a(2)*10^2 + a(1)*10^1 + a(0)*10^0
X      fraction = b(1)*10^-1 + b(2)*10^-2 + ...
X
X      where:
X       0 <= a(i) => 9 
X       0 <= b(i) => 9 
X 
X    from then it was simple math
X */
X
X/*
X * size of the buffer for the integral part
X * and the fraction part 
X */
X#define MAX_INT  99 + 1 /* 1 for the null */
X#define MAX_FRACT 29 + 1
X
X/* 
X * numtoa() uses PRIVATE buffers to store the results,
X * So this function is not reentrant
X */
X#define itoa(n) numtoa(n, 10, 0, (char **)0) 
X#define otoa(n) numtoa(n, 8, 0, (char **)0)
X#define htoa(n) numtoa(n, 16, 0, (char **)0)
X#define dtoa(n, p, f) numtoa(n, 10, p, f)
X
X#define SWAP_INT(a,b) {int t; t = (a); (a) = (b); (b) = t;}
X
X/* this struct holds everything we need */
Xstruct DATA {
X  int length;
X  char *holder;
X  int counter;
X#ifdef __STDC__
X  const char *pf;
X#else
X  char *pf;
X#endif
X/* FLAGS */
X  int width, precision;
X  int justify; char pad;
X  int square, space, star_w, star_p, a_long ;
X};
X
X#define PRIVATE static
X#define PUBLIC
X/* signature of the functions */
X#ifdef __STDC__
X/* the floating point stuff */
X  PRIVATE double pow_10(int);
X  PRIVATE int log_10(double);
X  PRIVATE double integral(double, double *);
X  PRIVATE char * numtoa(double, int, int, char **);
X
X/* for the format */
X  PRIVATE void conv_flag(char *, struct DATA *);
X  PRIVATE void floating(struct DATA *, double);
X  PRIVATE void exponent(struct DATA *, double);
X  PRIVATE void decimal(struct DATA *, double);
X  PRIVATE void octal(struct DATA *, double);
X  PRIVATE void hexa(struct DATA *, double);
X  PRIVATE void strings(struct DATA *, char *);
X
X#else
X/* the floating point stuff */
X  PRIVATE double pow_10();
X  PRIVATE int log_10();
X  PRIVATE double integral();
X  PRIVATE char * numtoa();
X
X/* for the format */
X  PRIVATE void conv_flag();
X  PRIVATE void floating();
X  PRIVATE void exponent();
X  PRIVATE void decimal();
X  PRIVATE void octal();
X  PRIVATE void hexa();
X  PRIVATE void strings();
X#endif
X
X/* those are defines specific to snprintf to hopefully
X * make the code clearer :-)
X */
X#define RIGHT 1
X#define LEFT  0
X#define NOT_FOUND -1
X#define FOUND 1
X#define MAX_FIELD 15
X
X/* the conversion flags */
X#define isflag(c) ((c) == '#' || (c) == ' ' || \
X                   (c) == '*' || (c) == '+' || \
X                   (c) == '-' || (c) == '.' || \
X                   isdigit(c))
X
X/* round off to the precision */
X#define ROUND(d, p) \
X            (d < 0.) ? \
X             d - pow_10(-(p)->precision) * 0.5 : \
X             d + pow_10(-(p)->precision) * 0.5
X
X/* set default precision */
X#define DEF_PREC(p) \
X            if ((p)->precision == NOT_FOUND) \
X              (p)->precision = 6
X
X/* put a char */
X#define PUT_CHAR(c, p) \
X            if ((p)->counter < (p)->length) { \
X              *(p)->holder++ = (c); \
X              (p)->counter++; \
X            }
X
X#define PUT_PLUS(d, p) \
X            if ((d) > 0. && (p)->justify == RIGHT) \
X              PUT_CHAR('+', p)
X
X#define PUT_SPACE(d, p) \
X            if ((p)->space == FOUND && (d) > 0.) \
X              PUT_CHAR(' ', p)
X
X/* pad right */ 
X#define PAD_RIGHT(p) \
X            if ((p)->width > 0 && (p)->justify != LEFT) \
X              for (; (p)->width > 0; (p)->width--) \
X                 PUT_CHAR((p)->pad, p)
X
X/* pad left */
X#define PAD_LEFT(p) \
X            if ((p)->width > 0 && (p)->justify == LEFT) \
X              for (; (p)->width > 0; (p)->width--) \
X                 PUT_CHAR((p)->pad, p)
X
X/* if width and prec. in the args */
X#define STAR_ARGS(p) \
X            if ((p)->star_w == FOUND) \
X              (p)->width = va_arg(args, int); \
X            if ((p)->star_p == FOUND) \
X              (p)->precision = va_arg(args, int)
END_OF_FILE
if test 6130 -ne `wc -c <'snprintf-imp.h'`; then
    echo shar: \"'snprintf-imp.h'\" unpacked with wrong size!
fi
# end of 'snprintf-imp.h'
fi
echo shar: End of shell archive.
exit 0