bin/71663: [PATCH] cleanup of the usr.sbin/i4b code

Dan Lukes dan at obluda.cz
Sun Sep 12 10:40:27 PDT 2004


>Number:         71663
>Category:       bin
>Synopsis:       [PATCH] cleanup of the usr.sbin/i4b code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 12 17:40:24 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 5.3-BETA3 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD kulesh.obluda.cz 5.3-BETA3 FreeBSD 5.3-BETA3 #8: Sun Sep 5 07:06:40 CEST 2004 dan at kulesh.obluda.cz:/usr/obj/usr/src/sys/Dan i386
usr.sbin/i4b/isdnd/Makefile,v 1.14 2004/08/13 14:21:49 ru
usr.sbin/i4b/isdnd/exec.c,v 1.12 2003/06/07 18:45:45 imp
usr.sbin/i4b/isdnd/support.c,v 1.16 2003/07/31 09:13:22 hm
usr.sbin/i4b/isdnd/msghdl.c,v 1.12 2002/08/12 07:52:39 hm
usr.sbin/i4b/isdnd/isdnd.h,v 1.18 2002/08/12 07:52:39 hm
usr.sbin/i4b/isdntest/main.c,v 1.8 2000/10/09 14:22:45 hm

>Description:
	There are more than 5000 warnings issued during "make buildworld".
Some of them are false positives, but some of them are sign of true errors.

	Nobody is upset by warnings due it's amount, so some errors remain
uncorrected.

	I want to cleanup the code-base from warnings, so warnings will
become "attention mark" again.

usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/main.c:717: warning: implicit declaration of function `msg_keypad'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/log.c:172:2: warning: #warning "FreeBSD ncurses is buggy: write to last column = auto newline!"
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/msghdl.c:71: warning: implicit declaration of function `add_number_prefix'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/support.c:250: warning: unused variable `j'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/exec.c:324: warning: long int format, time_t arg (arg 3)
usr.sbin/i4b/isdnd/exec.c:324: warning: long int format, time_t arg (arg 4)
usr.sbin/i4b/isdnd/exec.c:334: warning: long int format, time_t arg (arg 3)
usr.sbin/i4b/isdnd/exec.c:334: warning: long int format, time_t arg (arg 4)
usr.sbin/i4b/isdnd/exec.c:378: warning: long int format, time_t arg (arg 3)
usr.sbin/i4b/isdnd/exec.c:378: warning: long int format, time_t arg (arg 4)
usr.sbin/i4b/isdnd/exec.c:399: warning: long int format, time_t arg (arg 3)
usr.sbin/i4b/isdnd/exec.c:399: warning: long int format, time_t arg (arg 4)
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnd/isdnd.h:800: warning: conflicting types for built-in function 'log'
usr.sbin/i4b/isdnmonitor/main.c:525:2: warning: #warning "FreeBSD ncurses is buggy: write to last column = auto newline!"
usr.sbin/i4b/isdntest/main.c:490:72: warning: trigraph ??) ignored, use -trigraphs to enable


>How-To-Repeat:
	N/A
>Fix:
*** usr.sbin/i4b/isdnd/Makefile.ORIG	Sun Aug 22 11:12:14 2004
--- usr.sbin/i4b/isdnd/Makefile	Sun Sep 12 13:35:24 2004
***************
*** 12,18 ****
  
  # avoid wacky merging of string constants from
  # source code with compile-time timestamp
! CFLAGS+= -fno-merge-constants
  
  # enable rtprio usage
  CFLAGS+= -DUSE_RTPRIO
--- 12,18 ----
  
  # avoid wacky merging of string constants from
  # source code with compile-time timestamp
! CFLAGS+= -fno-merge-constants -fno-builtin-log
  
  # enable rtprio usage
  CFLAGS+= -DUSE_RTPRIO
*** usr.sbin/i4b/isdnd/exec.c.ORIG	Tue Jul 15 22:47:12 2003
--- usr.sbin/i4b/isdnd/exec.c	Sun Sep 12 13:38:18 2004
***************
*** 321,327 ****
  			return;
  		}
  
! 		ret = fprintf(fp, "%ld %ld 1", now, now);
  		if(ret <= 0)
  			log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
  		
--- 321,327 ----
  			return;
  		}
  
! 		ret = fprintf(fp, "%d %d 1", now, now);
  		if(ret <= 0)
  			log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
  		
***************
*** 331,337 ****
  
  	/* get contents */
  	
! 	ret = fscanf(fp, "%ld %ld %d", &s, &l, &n);
  
  	/* reset fp */
  	
--- 331,337 ----
  
  	/* get contents */
  	
! 	ret = fscanf(fp, "%d %d %d", &s, &l, &n);
  
  	/* reset fp */
  	
***************
*** 375,381 ****
  				return;
  			}
  
! 			ret = fprintf(nfp, "%ld %ld %d", s, l, n);
  			if(ret <= 0)
  				log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
  			
--- 375,381 ----
  				return;
  			}
  
! 			ret = fprintf(nfp, "%d %d %d", s, l, n);
  			if(ret <= 0)
  				log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
  			
***************
*** 385,391 ****
  			n = 0;
  			s = now;
  
! 			log(LL_WRN, "upd_callstat_file: rotate %s, new s=%ld l=%ld n=%d", filename, s, l, n);
  		}				
  	}
  
--- 385,391 ----
  			n = 0;
  			s = now;
  
! 			log(LL_WRN, "upd_callstat_file: rotate %s, new s=%d l=%d n=%d", filename, s, l, n);
  		}				
  	}
  
***************
*** 396,402 ****
  	 * leftovers from previous contents!
  	 */
  
! 	ret = fprintf(fp, "%ld %ld %-3d", s, now, n);	
  
  	if(ret <= 0)
  		log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
--- 396,402 ----
  	 * leftovers from previous contents!
  	 */
  
! 	ret = fprintf(fp, "%d %d %-3d", s, now, n);	
  
  	if(ret <= 0)
  		log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
*** usr.sbin/i4b/isdnd/support.c.ORIG	Fri Aug  8 01:47:57 2003
--- usr.sbin/i4b/isdnd/support.c	Sun Sep 12 13:38:50 2004
***************
*** 247,253 ****
  find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd)
  {
  	cfg_entry_t *cep = NULL;
! 	int i, j;
  
  	for(i=0; i < nentries; i++)
  	{
--- 247,253 ----
  find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd)
  {
  	cfg_entry_t *cep = NULL;
! 	int i;
  
  	for(i=0; i < nentries; i++)
  	{
*** usr.sbin/i4b/isdnd/isdnd.h.ORIG	Mon Aug 12 18:29:35 2002
--- usr.sbin/i4b/isdnd/isdnd.h	Sun Sep 12 13:45:17 2004
***************
*** 753,758 ****
--- 753,759 ----
  
  #endif /* MAIN */
  
+ int add_number_prefix(char *number, int type_of_number);
  char * bdrivername ( int drivertype );
  void cfg_setval ( int keyword );
  void check_and_kill ( cfg_entry_t *cep );
***************
*** 812,817 ****
--- 813,819 ----
  void msg_dialoutnumber(msg_dialoutnumber_ind_t *mp);
  void msg_disconnect_ind ( msg_disconnect_ind_t *mp );
  void msg_idle_timeout_ind ( msg_idle_timeout_ind_t *mp );
+ void msg_keypad(msg_keypad_ind_t *mp);
  void msg_l12stat_ind(msg_l12stat_ind_t *ml);
  void msg_teiasg_ind(msg_teiasg_ind_t *mt);
  void msg_proceeding_ind ( msg_proceeding_ind_t *mp );
*** ./isdntest/main.c.ORIG	Mon Oct  9 16:22:45 2000
--- ./isdntest/main.c	Sun Sep 12 12:05:40 2004
***************
*** 487,493 ****
  	}
  	else
  	{
! 		fprintf(stderr, "isdntest: incoming disconnect indication, cdid %d (???), cause %d\n",
  			mdi->header.cdid, mdi->cause);
  	}		
  }
--- 487,493 ----
  	}
  	else
  	{
! 		fprintf(stderr, "isdntest: incoming disconnect indication, cdid %d (\?\?\?), cause %d\n",
  			mdi->header.cdid, mdi->cause);
  	}		
  }

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list