official patch to clock #1

George M. Sipe george at rebel.UUCP
Mon Oct 24 06:12:33 AEST 1988


The following patch is courtesy of Bob Granvin (rjg at sialis.mn.org or
...{{amdahl,hpda}!bungia,rosevax}!sialis!rjg).  It should allow the recently
posted clock program to compile cleanly under System V.

Bob also noted that simply deleting "-DBSD" from the Makefile is sufficient
for System V use and that $CC may need to be explicitly set.


*** clock.c_orig	Sun Oct 23 15:09:50 1988
--- clock.c	Sun Oct 23 15:11:58 1988
***************
*** 46,51
  
  #include <string.h>
  #include <time.h>
  extern	long time();
  extern	unsigned int sleep();
  extern	void exit();

--- 46,52 -----
  
  #include <string.h>
  #include <time.h>
+ #include <sys/utsname.h>
  extern	long time();
  extern	unsigned int sleep();
  extern	void exit();
***************
*** 49,54
  extern	long time();
  extern	unsigned int sleep();
  extern	void exit();
  
  #endif	/* !BSD */
  

--- 50,56 -----
  extern	long time();
  extern	unsigned int sleep();
  extern	void exit();
+ struct	utsname	uts;
  
  #endif	/* !BSD */
  
***************
*** 211,216
  	initscr();
  	BASE = LINES - 21 + SYSLINE;
  	NBASE = BASE + DIGITS;
  	(void) gethostname(myname,sizeof(myname));
  	noecho();
  	nonl();

--- 213,219 -----
  	initscr();
  	BASE = LINES - 21 + SYSLINE;
  	NBASE = BASE + DIGITS;
+ #ifdef BSD
  	(void) gethostname(myname,sizeof(myname));
  #else
  	uname(&uts);
***************
*** 212,217
  	BASE = LINES - 21 + SYSLINE;
  	NBASE = BASE + DIGITS;
  	(void) gethostname(myname,sizeof(myname));
  	noecho();
  	nonl();
  	scr = newwin(LINES, COLS, 0, 0);

--- 215,224 -----
  	NBASE = BASE + DIGITS;
  #ifdef BSD
  	(void) gethostname(myname,sizeof(myname));
+ #else
+ 	uname(&uts);
+ 	strcpy(myname,uts.nodename);
+ #endif
  	noecho();
  	nonl();
  	scr = newwin(LINES, COLS, 0, 0);

-- 
George M. Sipe,		Phone: (404) 662-1533
Tolerant Systems, 6961 Peachtree Industrial, Norcross, GA  30071
UUCP: ...!{decvax,hplabs,linus,rutgers,seismo}!gatech!rebel!george



More information about the Comp.sources.bugs mailing list