[comp.mail.elm] Problem+Fix w/Elm 2.2 vs GCC

scs@lokkur.UUCP (Steve Simmons) (04/15/89)

In building Elm 2.2 under System V.2, using GCC 1.34, on a UNIX-PC,
I got the following complaints:

	gcc  -O -I../hdrs    -c curses.c
curses.c: In function CursorUp:
curses.c:376: warning: `CursorUp' was declared `extern' and later `static'
../hdrs/curses.h:33: warning: previous declaration of `CursorUp'
curses.c: In function CursorDown:
curses.c:393: warning: `CursorDown' was declared `extern' and later `static'
../hdrs/curses.h:33: warning: previous declaration of `CursorDown'
curses.c: In function CursorLeft:
curses.c:410: warning: `CursorLeft' was declared `extern' and later `static'
../hdrs/curses.h:34: warning: previous declaration of `CursorLeft'
curses.c: In function CursorRight:
curses.c:427: warning: `CursorRight' was declared `extern' and later `static'
../hdrs/curses.h:34: warning: previous declaration of `CursorRight'

Two simple changes were needed.  I removed the declarations of
Cursor<dir> from hdrs/curses.h, and moved the code for them higher
in the curses.c file.  No actual code lines were changed.  The
patch follows.

*** /tmp/,RCSt1a14878	Sat Apr 15 09:15:09 1989
--- hdrs/curses.h	Fri Apr 14 23:01:15 1989
***************
*** 33,40 ****
       ClearScreen(), 	 CleartoEOLN(),
  
       MoveCursor(),
-      CursorUp(),         CursorDown(), 
-      CursorLeft(),       CursorRight(), 
  
       StartBold(),        EndBold(), 
       StartUnderline(),   EndUnderline(), 
--- 33,38 ----
*** /tmp/,RCSt1a14878	Sat Apr 15 09:15:19 1989
--- src/curses.c	Fri Apr 14 23:00:23 1989
***************
*** 291,296 ****
--- 291,363 ----
  	fflush(stdout);
  }
  
+ static
+ CursorUp(n)
+ int n;
+ {
+ 	/** move the cursor up 'n' lines **/
+ 	/** Calling function must check that _up is not null before calling **/
+ 
+ 	_line = (_line-n > 0? _line - n: 0);	/* up 'n' lines... */
+ 
+ 	while (n-- > 0)
+ 		tputs(_up, 1, outchar);
+ 
+ 	fflush(stdout);
+ 	return(0);
+ }
+ 
+ 
+ static
+ CursorDown(n)
+ int n;
+ {
+ 	/** move the cursor down 'n' lines **/
+ 	/** Caller must check that _down is not null before calling **/
+ 
+ 	_line = (_line+n < LINES? _line + n: LINES);	/* down 'n' lines... */
+ 
+ 	while (n-- > 0)
+ 		tputs(_down, 1, outchar);
+ 
+ 	fflush(stdout);
+ 	return(0);
+ }
+ 
+ 
+ static
+ CursorLeft(n)
+ int n;
+ {
+ 	/** move the cursor 'n' characters to the left **/
+ 	/** Caller must check that _left is not null before calling **/
+ 
+ 	_col = (_col - n> 0? _col - n: 0);	/* left 'n' chars... */
+ 
+ 	while (n-- > 0)
+ 		tputs(_left, 1, outchar);
+ 
+ 	fflush(stdout);
+ 	return(0);
+ }
+ 
+ 
+ static
+ CursorRight(n)
+ int n;
+ {
+ 	/** move the cursor 'n' characters to the right (nondestructive) **/
+ 	/** Caller must check that _right is not null before calling **/
+ 
+ 	_col = (_col+n < COLUMNS? _col + n: COLUMNS);	/* right 'n' chars... */
+ 
+ 	while (n-- > 0)
+ 		tputs(_right, 1, outchar);
+ 
+ 	fflush(stdout);
+ 	return(0);
+ }
+ 
  MoveCursor(row, col)
  int row, col;
  {
***************
*** 372,444 ****
  
  	Writechar('\n');
  	Writechar('\r');
- }
- 
- static
- CursorUp(n)
- int n;
- {
- 	/** move the cursor up 'n' lines **/
- 	/** Calling function must check that _up is not null before calling **/
- 
- 	_line = (_line-n > 0? _line - n: 0);	/* up 'n' lines... */
- 
- 	while (n-- > 0)
- 		tputs(_up, 1, outchar);
- 
- 	fflush(stdout);
- 	return(0);
- }
- 
- 
- static
- CursorDown(n)
- int n;
- {
- 	/** move the cursor down 'n' lines **/
- 	/** Caller must check that _down is not null before calling **/
- 
- 	_line = (_line+n < LINES? _line + n: LINES);	/* down 'n' lines... */
- 
- 	while (n-- > 0)
- 		tputs(_down, 1, outchar);
- 
- 	fflush(stdout);
- 	return(0);
- }
- 
- 
- static
- CursorLeft(n)
- int n;
- {
- 	/** move the cursor 'n' characters to the left **/
- 	/** Caller must check that _left is not null before calling **/
- 
- 	_col = (_col - n> 0? _col - n: 0);	/* left 'n' chars... */
- 
- 	while (n-- > 0)
- 		tputs(_left, 1, outchar);
- 
- 	fflush(stdout);
- 	return(0);
- }
- 
- 
- static
- CursorRight(n)
- int n;
- {
- 	/** move the cursor 'n' characters to the right (nondestructive) **/
- 	/** Caller must check that _right is not null before calling **/
- 
- 	_col = (_col+n < COLUMNS? _col + n: COLUMNS);	/* right 'n' chars... */
- 
- 	while (n-- > 0)
- 		tputs(_right, 1, outchar);
- 
- 	fflush(stdout);
- 	return(0);
  }
  
  
--- 439,444 ----
-- 
+ Steve Simmons, Inland Sea Software, Ltd.         scs@lokkur.dexter.mi.us +
|    9353 Hidden Lake, Dexter, MI. 48130                   313-426-8981    |
+          "When Dexter's on the Internet can Hell be far behind?"         +