home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sources / misc / 4121 < prev    next >
Encoding:
Text File  |  1992-11-21  |  54.7 KB  |  2,092 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
  4. Subject:  v33i116:  u386mon - SVR3 performance/status monitor v2.60, Part07/09
  5. Message-ID: <1992Nov22.020251.24400@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: 4252b4b64226e9cc61a5f6a0236f8333
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. References: <csm-v33i110=u386mon.195754@sparky.IMD.Sterling.COM>
  11. Date: Sun, 22 Nov 1992 02:02:51 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 2077
  14.  
  15. Submitted-by: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
  16. Posting-number: Volume 33, Issue 116
  17. Archive-name: u386mon/part07
  18. Environment: SYSVR3
  19. Supersedes: u386mon: Volume 22, Issue 3-9
  20.  
  21. #!/bin/sh
  22. # This is part 07 of u386mon.2.60
  23. # ============= libnlsym.h ==============
  24. if test -f 'libnlsym.h' -a X"$1" != X"-c"; then
  25.     echo 'x - skipping libnlsym.h (File already exists)'
  26. else
  27. echo 'x - extracting libnlsym.h (Text)'
  28. sed 's/^X//' << 'SHAR_EOF' > 'libnlsym.h' &&
  29. X/* CHK=0x7095 */
  30. X/*+-----------------------------------------------------------------------
  31. X    libnlsym.h
  32. X    ...!{gatech,emory}!n4hgf!wht
  33. X------------------------------------------------------------------------*/
  34. X/*+:EDITS:*/
  35. X/*:07-15-1992-14:31-wht@n4hgf-2.60 release - u386mon+siotools merge */
  36. X/*:08-01-1991-23:34-wht@n4hgf-release 2.40 source control point */
  37. X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
  38. X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
  39. X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
  40. X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
  41. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  42. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  43. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  44. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  45. X/*:10-28-1988-14:47-afterlint-creation */
  46. X
  47. X
  48. X#ifndef _libnlsym_h
  49. X#define _libnlsym_h
  50. X
  51. X#ifndef BUILDING_LINT_ARGS
  52. X#ifdef LINT_ARGS
  53. X
  54. X/* libnlsym.c */
  55. Xvoid nlsym_error(char * );
  56. Xvoid nlsym_read(void);
  57. X
  58. X#else        /* compiler doesn't know about prototyping */
  59. X
  60. X/* libnlsym.c */
  61. Xvoid nlsym_error();
  62. Xvoid nlsym_read();
  63. X
  64. X#endif /* LINT_ARGS */
  65. X#endif /* BUILDING_LINT_ARGS */
  66. X#endif /* _libnlsym_h */
  67. X
  68. X/* vi: set tabstop=4 shiftwidth=4: */
  69. X/* end of libnlsym.h */
  70. SHAR_EOF
  71. chmod 0644 libnlsym.h ||
  72. echo 'restore of libnlsym.h failed'
  73. Wc_c="`wc -c < 'libnlsym.h'`"
  74. test 1352 -eq "$Wc_c" ||
  75.     echo 'libnlsym.h: original size 1352, current size' "$Wc_c"
  76. fi
  77. # ============= lint_args.h ==============
  78. if test -f 'lint_args.h' -a X"$1" != X"-c"; then
  79.     echo 'x - skipping lint_args.h (File already exists)'
  80. else
  81. echo 'x - extracting lint_args.h (Text)'
  82. sed 's/^X//' << 'SHAR_EOF' > 'lint_args.h' &&
  83. X/* CHK=0x3AC6 */
  84. X/*+-----------------------------------------------------------------------
  85. X    lint_args.h
  86. X------------------------------------------------------------------------*/
  87. X/*+:EDITS:*/
  88. X/*:07-15-1992-14:32-wht@n4hgf-2.60 release - u386mon+siotools merge */
  89. X/*:08-01-1991-23:34-wht@n4hgf-release 2.40 source control point */
  90. X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
  91. X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
  92. X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
  93. X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
  94. X/*:07-21-1990-16:01-afterlint-creation */
  95. X
  96. X#ifndef _lint_args_h
  97. X#define _lint_args_h
  98. X
  99. X#ifndef BUILDING_LINT_ARGS
  100. X#ifdef LINT_ARGS
  101. X
  102. X/* bootinfo.c */
  103. Xextern  char *bmemf_text(unsigned long flags);
  104. Xextern  void display_bootinfo(struct _win_st *win,int y,int x);
  105. X/* det_proc.c */
  106. Xextern  char *get_cpu_time_str(long ticks);
  107. Xextern  char *pgrp_to_ttyname(int pgrp);
  108. Xextern  char *uid_to_name(unsigned short uid);
  109. Xextern  int det_proc_init(void );
  110. Xextern  int get_user(struct proc *tproc,struct user *tuser);
  111. Xextern  int getpwent_and_enter(unsigned short uid);
  112. Xextern  int ppproc_pid_compare(struct proc * *ppp1,struct proc * *ppp2);
  113. Xextern  int uid_name_enter(unsigned short uid,char *name);
  114. Xextern  struct utmp *find_utmp_for_pgrp(int pgrp);
  115. Xextern  void display_proc_stat(struct _win_st *win,int iproc,int initial);
  116. Xextern  void display_proc_stats(struct _win_st *win,int initial);
  117. Xextern  void init_uid_name_hash(void );
  118. Xextern  void read_and_sort_procs(int initial);
  119. Xextern  void read_utmp(void );
  120. X/* det_sio.c */
  121. Xextern  char *B_to_baud_rate(int code);
  122. Xextern  char *cflag_to_baud_d_p_s(int cflag);
  123. Xextern  void display_sio_summary(struct _win_st *win,int initial);
  124. Xextern  int tty_slot_compare(struct tty *sio1,struct tty *sio2);
  125. Xextern  void display_siofull_init(struct _win_st *win,int tly,int tlx,int show_flag);
  126. Xextern  void display_siofull_update(struct _win_st *win,int tly,int tlx,struct tty *tsio);
  127. Xextern  void display_siosum_update(struct _win_st *win,int y,struct tty *tsio);
  128. Xextern  void grok_sio_tty(void );
  129. X/* detail.c */
  130. Xextern  void detail_init(void );
  131. Xextern  void detail_panel_cmd(unsigned long cmd);
  132. Xextern  void detail_panel_update(void );
  133. Xextern  void detpanel_destroy(void );
  134. Xextern  void detpanel_extra_init(void );
  135. Xextern  void detpanel_extra_update(void );
  136. Xextern  void detpanel_ps_init(int full43);
  137. Xextern  void detpanel_ps_update(void );
  138. Xextern  void detpanel_sio_init(void );
  139. Xextern  void detpanel_sio_update(void );
  140. X/* disputil.c */
  141. Xextern  PANEL *mkpanel(int rows,int cols,int tly,int tlx,char *userp);
  142. Xextern  void clear_area(struct _win_st *win,int y,int x,int len);
  143. Xextern  void clear_area_char(struct _win_st *win,int y,int x,int len,unsigned char fillchar);
  144. Xextern  void disp_info_int(struct _win_st *win,char *label,char *fmt,int value);
  145. Xextern  void disp_info_long(struct _win_st *win,char *label,char *fmt,long value);
  146. Xextern  void disp_msg(unsigned long cp,char *msg);
  147. Xextern  void disp_static_int(struct _win_st *win,char *label,char *fmt,int value);
  148. Xextern  void disp_static_long(struct _win_st *win,char *label,char *fmt,long value);
  149. Xextern  void pflush(void );
  150. Xextern  void wperror(struct _win_st *win,char *desc);
  151. X/* libkmem.c */
  152. Xextern  void kinit(int write_needed);
  153. Xextern  void kread(char *caddr,long kaddr,int len);
  154. X/* libmem.c */
  155. Xextern  void minit(int write_needed);
  156. Xextern  void mread(char *caddr,long maddr,int len);
  157. X/* libnlsym.c */
  158. Xextern  void nlsym_error(char *text);
  159. Xextern  void nlsym_read(void );
  160. X/* libswap.c */
  161. Xextern  void sinit(void );
  162. Xextern  void sread(char *caddr,long maddr,int len);
  163. X/* nlsym.c */
  164. Xextern  int main(int argc,char * *argv,char * *envp);
  165. Xextern  void nlsym_write_error(int code);
  166. X/* proc.c */
  167. Xextern  char *pstat_text(char pstat);
  168. Xextern  void display_proc(struct _win_st *win,int y,int x);
  169. Xextern  void grok_proc(void );
  170. X/* tune.c */
  171. Xextern  void display_tune(struct _win_st *win,int y,int x);
  172. X/* u386mon.c */
  173. Xextern  char *get_elapsed_time(long elapsed_seconds);
  174. Xextern  int get_cpu_avg(long *cpu_ticks,int period);
  175. Xextern  int get_wait_avg(long *wait_ticks,int period);
  176. Xextern  int main(int argc,char * *argv,char * *envp);
  177. Xextern  long update_cpuscale(struct _win_st *win,int y,int x,int width,long *per_state);
  178. Xextern  long update_waitscale(struct _win_st *win,int y,int x,int width,long *per_state,long total_ticks);
  179. Xextern  void calc_cpu_avg(long *per_state);
  180. Xextern  void calc_wait_avg(long *per_state);
  181. Xextern  void caught_signal(int sig);
  182. Xextern  void draw_cpuscale_literals(struct _win_st *win,int y,int x);
  183. Xextern  void draw_per_sec_literals(struct _win_st *win,int y,int x);
  184. Xextern  void draw_waitscale_literals(struct _win_st *win,int y,int x);
  185. Xextern  void extra_info_stuff(void );
  186. Xextern  void extra_static_stuff(void );
  187. Xextern  void leave(int exit_code);
  188. Xextern  void leave_text(char *text,int exit_code);
  189. Xextern  void leaving(void );
  190. Xextern  void read_sysinfo_and_minfo(void );
  191. X/* var.c */
  192. Xextern  void display_var(struct _win_st *win,int y,int x);
  193. X
  194. X#else        /* compiler doesn't know about prototyping */
  195. X
  196. X/* bootinfo.c */
  197. Xextern  char *bmemf_text();
  198. Xextern  void display_bootinfo();
  199. X/* det_proc.c */
  200. Xextern  char *get_cpu_time_str();
  201. Xextern  char *pgrp_to_ttyname();
  202. Xextern  char *uid_to_name();
  203. Xextern  int det_proc_init();
  204. Xextern  int get_user();
  205. Xextern  int getpwent_and_enter();
  206. Xextern  int ppproc_pid_compare();
  207. Xextern  int uid_name_enter();
  208. Xextern  struct utmp *find_utmp_for_pgrp();
  209. Xextern  void display_proc_stat();
  210. Xextern  void display_proc_stats();
  211. Xextern  void init_uid_name_hash();
  212. Xextern  void read_and_sort_procs();
  213. Xextern  void read_utmp();
  214. X/* det_sio.c */
  215. Xextern  char *B_to_baud_rate();
  216. Xextern  char *cflag_to_baud_d_p_s();
  217. Xextern  void display_sio_summary();
  218. Xextern  int tty_slot_compare();
  219. Xextern  void display_siofull_init();
  220. Xextern  void display_siofull_update();
  221. Xextern  void display_siosum_update();
  222. Xextern  void grok_sio_tty();
  223. X/* detail.c */
  224. Xextern  void detail_init();
  225. Xextern  void detail_panel_cmd();
  226. Xextern  void detail_panel_update();
  227. Xextern  void detpanel_destroy();
  228. Xextern  void detpanel_extra_init();
  229. Xextern  void detpanel_extra_update();
  230. Xextern  void detpanel_ps_init();
  231. Xextern  void detpanel_ps_update();
  232. Xextern  void detpanel_sio_init();
  233. Xextern  void detpanel_sio_update();
  234. X/* disputil.c */
  235. Xextern  PANEL *mkpanel();
  236. Xextern  void clear_area();
  237. Xextern  void clear_area_char();
  238. Xextern  void disp_info_int();
  239. Xextern  void disp_info_long();
  240. Xextern  void disp_msg();
  241. Xextern  void disp_static_int();
  242. Xextern  void disp_static_long();
  243. Xextern  void pflush();
  244. Xextern  void wperror();
  245. X/* libkmem.c */
  246. Xextern  void kinit();
  247. Xextern  void kread();
  248. X/* libmem.c */
  249. Xextern  void minit();
  250. Xextern  void mread();
  251. X/* libnlsym.c */
  252. Xextern  void nlsym_error();
  253. Xextern  void nlsym_read();
  254. X/* libswap.c */
  255. Xextern  void sinit();
  256. Xextern  void sread();
  257. X/* nlsym.c */
  258. Xextern  int main();
  259. Xextern  void nlsym_write_error();
  260. X/* proc.c */
  261. Xextern  char *pstat_text();
  262. Xextern  void display_proc();
  263. Xextern  void grok_proc();
  264. X/* tune.c */
  265. Xextern  void display_tune();
  266. X/* u386mon.c */
  267. Xextern  char *get_elapsed_time();
  268. Xextern  int get_cpu_avg();
  269. Xextern  int get_wait_avg();
  270. Xextern  int main();
  271. Xextern  long update_cpuscale();
  272. Xextern  long update_waitscale();
  273. Xextern  void calc_cpu_avg();
  274. Xextern  void calc_wait_avg();
  275. Xextern  void caught_signal();
  276. Xextern  void draw_cpuscale_literals();
  277. Xextern  void draw_per_sec_literals();
  278. Xextern  void draw_waitscale_literals();
  279. Xextern  void extra_info_stuff();
  280. Xextern  void extra_static_stuff();
  281. Xextern  void leave();
  282. Xextern  void leave_text();
  283. Xextern  void leaving();
  284. Xextern  void read_sysinfo_and_minfo();
  285. X/* var.c */
  286. Xextern  void display_var();
  287. X
  288. X#endif /* LINT_ARGS */
  289. X#endif /* BUILDING_LINT_ARGS */
  290. X#endif /* _lint_args_h */
  291. X
  292. X/* vi: set tabstop=4 shiftwidth=4: */
  293. X/* end of lint_args.h */
  294. SHAR_EOF
  295. chmod 0644 lint_args.h ||
  296. echo 'restore of lint_args.h failed'
  297. Wc_c="`wc -c < 'lint_args.h'`"
  298. test 7817 -eq "$Wc_c" ||
  299.     echo 'lint_args.h: original size 7817, current size' "$Wc_c"
  300. fi
  301. # ============= nlsym.h ==============
  302. if test -f 'nlsym.h' -a X"$1" != X"-c"; then
  303.     echo 'x - skipping nlsym.h (File already exists)'
  304. else
  305. echo 'x - extracting nlsym.h (Text)'
  306. sed 's/^X//' << 'SHAR_EOF' > 'nlsym.h' &&
  307. X/* CHK=0x88A7 */
  308. X/*+-------------------------------------------------------------------------
  309. X    nlsym.h -- utility nlist - fast access to kernel /dev/kmem offsets
  310. X    ...!{gatech,emory}!n4hgf!wht
  311. X
  312. XThe nlsym file contains three records:
  313. X1.  struct stat unixstat - stat buffer from /unix at file creation time
  314. X2.  struct nlist nlsym - the structure of nlist'd information
  315. X3.  long unique - a unique identifier to help ensure correct nlsym length
  316. X
  317. X--------------------------------------------------------------------------*/
  318. X/*+:EDITS:*/
  319. X/*:07-15-1992-14:32-wht@n4hgf-2.60 release - u386mon+siotools merge */
  320. X/*:08-20-1991-12:44-root@n4hgf-nba@sysware.dk S5R31 and config reorg */
  321. X/*:08-14-1991-13:04-wht@n4hgf-STREAMS and table works for ISC 2.2 */
  322. X/*:08-01-1991-23:34-wht@n4hgf-release 2.40 source control point */
  323. X/*:05-15-1991-17:22-wht@n4hgf-2.3 patches for SVR31 from nba@sysware.dk */
  324. X/*:04-16-1991-02:25-martin@hppcmart additions for SCO 3.2.2 */
  325. X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
  326. X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
  327. X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
  328. X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
  329. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  330. X/*:06-27-1990-01:55-wht@n4hgf-use 64 bits of unique check */
  331. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  332. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  333. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  334. X/*:10-27-1988-11:07-wht-creation */
  335. X
  336. X#ifndef _nlsym_h
  337. X#define _nlsym_h
  338. X
  339. X#define UNIX_KERNEL        "/unix"
  340. X#define UNIX_NLSYM        "/unix.nlsym"
  341. X#define NLSYM_UNIQUE1    0x1BADD00DL
  342. X#define NLSYM_UNIQUE2    0xDEADB1FFL
  343. X
  344. X#define Nindex_AVAILRMEM            0
  345. X#define Nindex_AVAILSMEM            1
  346. X#define Nindex_BDEVCNT              2
  347. X#define Nindex_BDEVSW               3
  348. X#if defined(HAS_BOOTINFO)
  349. X#define Nindex_BOOTINFO             4
  350. X#endif
  351. X#define Nindex_CDEVCNT              5
  352. X#define Nindex_CDEVSW               6
  353. X#define Nindex_CFREE                7
  354. X#define Nindex_CFREECNT             8
  355. X#define Nindex_CFREELIST            9
  356. X#if defined(M_UNIX)
  357. X#define Nindex_CONSSW              10
  358. X#endif
  359. X#define Nindex_CURPROC             11
  360. X#define Nindex_DINFO               12
  361. X#if defined(M_UNIX)
  362. X#define Nindex_DSTFLAG             13
  363. X#endif
  364. X#define Nindex_DUMPDEV             14
  365. X#if defined(M_UNIX)
  366. X#define Nindex_EMAP                15
  367. X#endif
  368. X#define Nindex_FFREELIST           16
  369. X#define Nindex_FILE                17
  370. X#define Nindex_FMODCNT             18
  371. X#define Nindex_FMODSW              19
  372. X#define Nindex_FREEMEM             20
  373. X#define Nindex_FSINFO              21
  374. X#define Nindex_FSTYPSW             22
  375. X#if defined(M_UNIX)
  376. X#define Nindex_HZ                  23
  377. X#endif
  378. X#define Nindex_IDLESERVER          24
  379. X#define Nindex_IFREELIST           25
  380. X#define Nindex_INODE               26
  381. X#define Nindex_KPTBL               27
  382. X#define Nindex_LBOLT               28
  383. X#define Nindex_LINECNT             29
  384. X#define Nindex_LINESW              30
  385. X#define Nindex_MAXCLICK            31
  386. X#define Nindex_MAXMEM              32
  387. X#define Nindex_MINFO               33
  388. X#define Nindex_MOUNT               34
  389. X#define Nindex_MSGLISTCNT          35
  390. X#define Nindex_NFSTYP              36
  391. X#define Nindex_NPTALLOCED          37
  392. X#define Nindex_NPTFREE             38
  393. X#define Nindex_NSERVERS            39
  394. X#define Nindex_NSWAP               40
  395. X#if defined(M_UNIX)
  396. X#define Nindex_NSYSENT             41
  397. X#define Nindex_OLDPROC             42
  398. X#define Nindex_OLD_CURPROC         43
  399. X#endif
  400. X#define Nindex_PANICSTR            44
  401. X#define Nindex_PHYSMEM             45
  402. X#define Nindex_PIPEDEV             46
  403. X#define Nindex_PROC                47
  404. X#define Nindex_RCINFO              48
  405. X#define Nindex_ROOTDEV             49
  406. X#define Nindex_RUNQ                50
  407. X#define Nindex_SHLBINFO            51
  408. X#define Nindex_SWAPDEV             52
  409. X#define Nindex_SWPLO               53
  410. X#define Nindex_SYSERR              54
  411. X#define Nindex_SYSINFO             55
  412. X#define Nindex_SYSSEGS             56
  413. X#define Nindex_SYSWAIT             57
  414. X#define Nindex_TIME                58
  415. X#if defined(M_UNIX)
  416. X#define Nindex_TIMEZONE            59
  417. X#endif
  418. X#define Nindex_TTHIWAT             60
  419. X#define Nindex_TTLOWAT             61
  420. X#define Nindex_TUNE                62
  421. X#define Nindex_U                   63
  422. X#if defined(M_UNIX)
  423. X#define Nindex_USERTABLE           64
  424. X#endif
  425. X#define Nindex_V                   65
  426. X#if defined(M_UNIX)
  427. X#define Nindex_WIN_UBLK            66
  428. X#endif
  429. X#define Nindex_REGION              67
  430. X#if defined(DPT_SIO)
  431. X#define Nindex_SIO_TTY             68
  432. X#endif
  433. X#if defined(DPT_STREAMS)
  434. X#define Nindex_STRST               69
  435. X#define Nindex_RBSIZE              70
  436. X#define Nindex_NMBLOCK             71
  437. X#define Nindex_FLCKINFO            72
  438. X#define Nindex_RACTIVE             73
  439. X#endif
  440. X#if defined(DPT_TABLE)
  441. X#define Nindex_CALLOUT             74
  442. X#endif
  443. X#if defined(DPT_WD)
  444. X#define Nindex_FLSTATS             75
  445. X#define Nindex_WD1010STATS         76
  446. X#endif
  447. X
  448. X#if defined(HAS_BOOTINFO)
  449. X#define bootinfoaddr (nlsym[Nindex_BOOTINFO].n_value)
  450. X#endif
  451. X#define freememaddr (nlsym[Nindex_FREEMEM].n_value)
  452. X#define lboltaddr (nlsym[Nindex_LBOLT].n_value)
  453. X#define maxmemaddr (nlsym[Nindex_MAXMEM].n_value)
  454. X#define minfoaddr (nlsym[Nindex_MINFO].n_value)
  455. X#define nswapaddr (nlsym[Nindex_NSWAP].n_value)
  456. X#define physmemaddr (nlsym[Nindex_PHYSMEM].n_value)
  457. X#define procaddr (nlsym[Nindex_PROC].n_value)
  458. X#define regionaddr (nlsym[Nindex_REGION].n_value)
  459. X#define sysinfoaddr (nlsym[Nindex_SYSINFO].n_value)
  460. X#define tuneaddr (nlsym[Nindex_TUNE].n_value)
  461. X#define vaddr (nlsym[Nindex_V].n_value)
  462. X#if defined(DPT_SIO)
  463. X#define sio_ttyaddr (nlsym[Nindex_SIO_TTY].n_value)
  464. X#endif /* DPT_SIO */
  465. X#if defined(DPT_STREAMS)
  466. X#define strstaddr (nlsym[Nindex_STRST].n_value)
  467. X#define rbsizeaddr (nlsym[Nindex_RBSIZE].n_value)
  468. X#define nmblockaddr (nlsym[Nindex_NMBLOCK].n_value)
  469. X#endif /* DPT_STREAMS */
  470. X#if defined(DPT_TABLE)
  471. X#define flckinfoaddr (nlsym[Nindex_FLCKINFO].n_value)
  472. X#define fileaddr (nlsym[Nindex_FILE].n_value)
  473. X#define ifreelistaddr (nlsym[Nindex_IFREELIST].n_value)
  474. X#define inodeaddr (nlsym[Nindex_INODE].n_value)
  475. X#define ffreelistaddr (nlsym[Nindex_FFREELIST].n_value)
  476. X#define ractiveaddr (nlsym[Nindex_RACTIVE].n_value)
  477. X#define cfreecntaddr (nlsym[Nindex_CFREECNT].n_value)
  478. X#define calloutaddr (nlsym[Nindex_CALLOUT].n_value)
  479. X#define syserraddr (nlsym[Nindex_SYSERR].n_value)
  480. X#endif /* DPT_TABLE */
  481. X#if defined(DPT_WD)
  482. X#define flstatsaddr (nlsym[Nindex_FLSTATS].n_value)
  483. X#define wd1010statsaddr (nlsym[Nindex_WD1010STATS].n_value)
  484. X#endif /* DPT_WD */
  485. X
  486. X#ifdef DEFINE_NLSYM
  487. Xstruct nlist nlsym[] =
  488. X{
  489. X    { "availrmem" },
  490. X    { "availsmem" },
  491. X    { "bdevcnt" },
  492. X    { "bdevsw" },
  493. X#if defined(HAS_BOOTINFO)
  494. X    { "bootinfo" },
  495. X#else
  496. X    { "dummy" },
  497. X#endif
  498. X    { "cdevcnt" },
  499. X    { "cdevsw" },
  500. X    { "cfree" },
  501. X    { "cfreecnt" },
  502. X    { "cfreelist" },
  503. X#if defined(M_UNIX)
  504. X    { "conssw" },
  505. X#else
  506. X    { "dummy" },
  507. X#endif
  508. X    { "curproc" },
  509. X    { "dinfo" },
  510. X#if defined(M_UNIX)
  511. X    { "Dstflag" },
  512. X#else
  513. X    { "dummy" },
  514. X#endif
  515. X    { "dumpdev" },
  516. X#if defined(M_UNIX)
  517. X    { "emap" },
  518. X#else
  519. X    { "dummy" },
  520. X#endif
  521. X    { "ffreelist" },
  522. X    { "file" },
  523. X    { "fmodcnt" },
  524. X    { "fmodsw" },
  525. X    { "freemem" },
  526. X    { "fsinfo" },
  527. X    { "fstypsw" },
  528. X#if defined(M_UNIX)
  529. X    { "Hz" },
  530. X#else
  531. X    { "dummy" },
  532. X#endif
  533. X    { "idleserver" },
  534. X    { "ifreelist" },
  535. X    { "inode" },
  536. X    { "kptbl" },
  537. X    { "lbolt" },
  538. X    { "linecnt" },
  539. X    { "linesw" },
  540. X    { "maxclick" },
  541. X    { "maxmem" },
  542. X    { "minfo" },
  543. X    { "mount" },
  544. X    { "msglistcnt" },
  545. X    { "nfstyp" },
  546. X    { "nptalloced" },
  547. X    { "nptfree" },
  548. X    { "nservers" },
  549. X    { "nswap" },
  550. X#if defined(M_UNIX)
  551. X    { "nsysent" },
  552. X    { "oldproc" },
  553. X    { "old_curproc" },
  554. X#else
  555. X    { "dummy" },
  556. X    { "dummy" },
  557. X    { "dummy" },
  558. X#endif
  559. X    { "panicstr" },
  560. X    { "physmem" },
  561. X    { "dummy" },
  562. X    { "proc" },
  563. X    { "rcinfo" },
  564. X    { "rootdev" },
  565. X    { "runq" },
  566. X    { "shlbinfo" },
  567. X    { "swapdev" },
  568. X    { "swplo" },
  569. X    { "syserr" },
  570. X    { "sysinfo" },
  571. X    { "syssegs" },
  572. X    { "syswait" },
  573. X    { "time" },
  574. X#if defined(M_UNIX)
  575. X    { "Timezone" },
  576. X#else
  577. X    { "dummy" },
  578. X#endif
  579. X    { "tthiwat" },
  580. X    { "ttlowat" },
  581. X    { "tune" },
  582. X    { "u" },
  583. X#if defined(M_UNIX)
  584. X    { "usertable" },
  585. X#else
  586. X    { "dummy" },
  587. X#endif
  588. X    { "v" },
  589. X#if defined(M_UNIX)
  590. X    { "win_ublk" },
  591. X#else
  592. X    { "dummy" },
  593. X#endif
  594. X    { "region" },
  595. X#if defined(DPT_SIO)
  596. X#if defined(SIO_IS_FAS)
  597. X    { "fas_tty" },
  598. X#else
  599. X    { "sio_tty" },
  600. X#endif
  601. X#else
  602. X    { "dummy" },
  603. X#endif
  604. X#if defined(DPT_STREAMS)
  605. X    { "strst" },
  606. X    { "rbsize" },
  607. X    { "nmblock" },
  608. X#else
  609. X    { "dummy" },
  610. X    { "dummy" },
  611. X    { "dummy" },
  612. X#endif
  613. X#if defined(DPT_TABLE)
  614. X    { "flckinfo" },
  615. X    { "ractive" },
  616. X    { "callout" },
  617. X#else
  618. X    { "dummy" },
  619. X    { "dummy" },
  620. X    { "dummy" },
  621. X#endif
  622. X#if defined(DPT_WD)
  623. X    { "flstats" },
  624. X    { "wd1010stats" },
  625. X#else
  626. X    { "dummy" },
  627. X    { "dummy" },
  628. X#endif
  629. X    { (char *)0 }
  630. X};
  631. X#else
  632. Xextern struct nlist nlsym[];
  633. X#endif
  634. X
  635. X#endif /* _nlsym_h */
  636. X
  637. X/* vi: set tabstop=4 shiftwidth=4: */
  638. X/* end of nlsym.h */
  639. SHAR_EOF
  640. chmod 0644 nlsym.h ||
  641. echo 'restore of nlsym.h failed'
  642. Wc_c="`wc -c < 'nlsym.h'`"
  643. test 8792 -eq "$Wc_c" ||
  644.     echo 'nlsym.h: original size 8792, current size' "$Wc_c"
  645. fi
  646. # ============= patchlevel.h ==============
  647. if test -f 'patchlevel.h' -a X"$1" != X"-c"; then
  648.     echo 'x - skipping patchlevel.h (File already exists)'
  649. else
  650. echo 'x - extracting patchlevel.h (Text)'
  651. sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
  652. X/* CHK=0x1C3F */
  653. X#define PATCHLEVEL 0 /* scheme good for 9 patches */
  654. SHAR_EOF
  655. chmod 0644 patchlevel.h ||
  656. echo 'restore of patchlevel.h failed'
  657. Wc_c="`wc -c < 'patchlevel.h'`"
  658. test 70 -eq "$Wc_c" ||
  659.     echo 'patchlevel.h: original size 70, current size' "$Wc_c"
  660. fi
  661. # ============= ttynm.h ==============
  662. if test -f 'ttynm.h' -a X"$1" != X"-c"; then
  663.     echo 'x - skipping ttynm.h (File already exists)'
  664. else
  665. echo 'x - extracting ttynm.h (Text)'
  666. sed 's/^X//' << 'SHAR_EOF' > 'ttynm.h' &&
  667. X/* CHK=0xEBC2 */
  668. X/*+-------------------------------------------------------------------------
  669. X    ttynm.h - u386mon tty name file
  670. X
  671. XYou may have to edit this file if you do not use an SCO sio driver
  672. X--------------------------------------------------------------------------*/
  673. X/*+:EDITS:*/
  674. X/*:07-15-1992-14:33-wht@n4hgf-2.60 release - u386mon+siotools merge */
  675. X/*:04-07-1992-14:26-wht@n4hgf-creation */
  676. X
  677. X#ifndef _ttynm_h
  678. X#define _ttynm_h
  679. X
  680. Xextern char *ttynm[];
  681. X
  682. X#if !defined(SIO_IS_FAS)
  683. X
  684. X#define SIO_NTTY 16    
  685. X
  686. X#ifdef DEFINE_TTYNM
  687. Xchar *ttynm[SIO_NTTY] = {
  688. X    "1a",
  689. X    "1b",
  690. X    "1c",
  691. X    "1d",
  692. X    "1e",
  693. X    "1f",
  694. X    "1g",
  695. X    "1h",
  696. X    "2a",
  697. X    "2b",
  698. X    "2c",
  699. X    "2d",
  700. X    "2e",
  701. X    "2f",
  702. X    "2g",
  703. X    "2h",
  704. X};
  705. X#endif /* DEFINE_TTYNM */
  706. X
  707. X#else
  708. X
  709. X/*
  710. X * This is the ordering of my FAS driver tty structures
  711. X * Yours will probably be different
  712. X */
  713. X#define SIO_NTTY 18
  714. X
  715. X#ifdef DEFINE_TTYNM
  716. Xchar *ttynm[SIO_NTTY] = {
  717. X    "1a",
  718. X    "2a",
  719. X    "2b",
  720. X    "2c",
  721. X    "2d",
  722. X    "2e",
  723. X    "2f",
  724. X    "2g",
  725. X    "2h",
  726. X    "1A",
  727. X    "2A",
  728. X    "2B",
  729. X    "2C",
  730. X    "2D",
  731. X    "2E",
  732. X    "2F",
  733. X    "2G",
  734. X    "2H",
  735. X};
  736. X#endif /* DEFINE_TTYNM */
  737. X
  738. X#endif /* SIO_IS_FAS */
  739. X
  740. X#endif /* _ttynm_h */
  741. X
  742. X/* vi: set tabstop=4 shiftwidth=4: */
  743. X/* end of ttynm.h */
  744. SHAR_EOF
  745. chmod 0644 ttynm.h ||
  746. echo 'restore of ttynm.h failed'
  747. Wc_c="`wc -c < 'ttynm.h'`"
  748. test 1129 -eq "$Wc_c" ||
  749.     echo 'ttynm.h: original size 1129, current size' "$Wc_c"
  750. fi
  751. # ============= u386mon.h ==============
  752. if test -f 'u386mon.h' -a X"$1" != X"-c"; then
  753.     echo 'x - skipping u386mon.h (File already exists)'
  754. else
  755. echo 'x - extracting u386mon.h (Text)'
  756. sed 's/^X//' << 'SHAR_EOF' > 'u386mon.h' &&
  757. X/* CHK=0x4829 */
  758. X/*+-------------------------------------------------------------------------
  759. X    u386mon.h - UNIX 386 system monitor definitions
  760. X    wht@n4hgf.Mt-Park.GA.US
  761. X--------------------------------------------------------------------------*/
  762. X/*+:EDITS:*/
  763. X/*:07-15-1992-14:34-wht@n4hgf-2.60 release - u386mon+siotools merge */
  764. X/*:08-01-1991-23:35-wht@n4hgf-release 2.40 source control point */
  765. X/*:08-10-1990-14:12-jmd@p1so/wht@n4hgf-2.20-add Tandem Integrity S2 */
  766. X/*:08-07-1990-14:24-wht@n4hgf-nba@sysware.dk SVR31 updates */
  767. X/*:08-02-1990-15:36-wht@n4hgf-2.12-old curses hacks+minor 3.2 formalizations */
  768. X/*:07-28-1990-18:06-wht@n4hgf-2.10 release */
  769. X/*:07-10-1990-19:06-root@n4hgf-redesign attributes/color pairs */
  770. X/*:07-10-1990-18:33-root@n4hgf-move pio wait to medium alert */
  771. X/*:07-03-1990-03:21-root@n4hgf-add cpBANWARN and renumber */
  772. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  773. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  774. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  775. X/*:06-21-1990-14:27-r@n4hgf-version x0.12 seems bug free */
  776. X/*:06-20-1990-03:03-root@n4hgf-trick use_cp into making bright fgnd colors */
  777. X/*:06-19-1990-21:35-wht-get ready for release */
  778. X
  779. X
  780. X#ifndef _u386mon_h
  781. X#define _u386mon_h
  782. X
  783. X#ifndef M_SYSV    /* for ISC */
  784. X#define u_char unsigned char
  785. X#define u_long unsigned long
  786. X#endif
  787. X
  788. Xchar *getenv();
  789. Xchar *strchr();
  790. Xchar *strrchr();
  791. X#ifdef __STDC__
  792. Xvoid *malloc();
  793. X#else
  794. Xchar *malloc();
  795. X#endif
  796. X
  797. X#define pW(pan) panel_window(pan)
  798. X#define W WINDOW
  799. X#define P PANEL
  800. X
  801. X/* color numbers for EGA/VGA */
  802. X#ifdef COLOR_16_TERMINFO    /* wht 16-color fgnd/bgnd terminfo */
  803. X#define cHIBIT    8
  804. X#define cBLK    0
  805. X#define cBLU    1
  806. X#define cGRN    2
  807. X#define cCYN    3
  808. X#define cRED    4
  809. X#define cMAG    5
  810. X#define cBRN    6
  811. X#define cWHT    7
  812. X#define cGRY    (cBLK | cHIBIT)
  813. X#define cLTB    (cBLU | cHIBIT)
  814. X#define cLTG    (cGRN | cHIBIT)
  815. X#define cLTC    (cCYN | cHIBIT)
  816. X#define cLTR    (cRED | cHIBIT)
  817. X#define cLTM    (cMAG | cHIBIT)
  818. X#define cYEL    (cBRN | cHIBIT)
  819. X#define cHIW    (cWHT | cHIBIT)
  820. X#else
  821. X#ifdef    COLOR_BLACK
  822. X#define cBLK    COLOR_BLACK
  823. X#define cBLU    COLOR_BLUE
  824. X#define cGRN    COLOR_GREEN
  825. X#define cCYN    COLOR_CYAN
  826. X#define cRED    COLOR_RED
  827. X#define cMAG    COLOR_MAGENTA
  828. X#define cBRN    COLOR_YELLOW
  829. X#define cWHT    COLOR_WHITE
  830. X#define cGRY    COLOR_BLACK
  831. X#define cLTB    COLOR_BLUE
  832. X#define cLTG    COLOR_GREEN
  833. X#define cLTC    COLOR_CYAN
  834. X#define cLTR    COLOR_RED
  835. X#define cLTM    COLOR_MAGENTA
  836. X#define cYEL    COLOR_YELLOW
  837. X#define cHIW    COLOR_WHITE
  838. X#endif
  839. X#endif
  840. X
  841. X#define sTL        0xDA
  842. X#define sTR        0xBF
  843. X#define sBL        0xC0
  844. X#define sBR        0xD9
  845. X#define sLT        0xC3    /* left hand T */
  846. X#define sRT        0xB4    /* right hand T */
  847. X#define sVR        0xB3    /* vertical rule */
  848. X#define sHR        0xC4    /* horizontal rule */
  849. X
  850. X/* color pairs */
  851. X#ifdef COLOR_16_TERMINFO    /* wht 16-color fgnd/bgnd terminfo */
  852. X#define use_cp(win,cp) wattrset(win,COLOR_PAIR(cp))
  853. X#else
  854. X#ifdef COLOR_PAIR
  855. X#define use_cp(win,cp) wattrset(win,\
  856. X    (color_avail) ? color_attr[cp] : mono_attr[cp])
  857. X#else
  858. X#define use_cp(win,cp) wattrset(win,mono_attr[cp])
  859. X#endif
  860. X#endif
  861. X
  862. X/*
  863. X * for SVR31
  864. X */
  865. X#ifndef getcury
  866. X#define getcury(win)        ((win)->_cury)
  867. X#endif
  868. X#ifndef getcurx
  869. X#define getcurx(win)        ((win)->_curx)
  870. X#endif
  871. X#ifndef getbegy
  872. X#define getbegy(win)        ((win)->_begy)
  873. X#endif
  874. X#ifndef getbegx
  875. X#define getbegx(win)        ((win)->_begx)
  876. X#endif
  877. X#ifndef getbegyx
  878. X#define getbegyx(win,y,x)   ((y)=getbegy(win),(x)=getbegx(win))
  879. X#endif
  880. X#ifndef getmaxy
  881. X#define getmaxy(win)        ((win)->_maxy)
  882. X#endif
  883. X#ifndef getmaxx
  884. X#define getmaxx(win)        ((win)->_maxx)
  885. X#endif
  886. X#ifndef getmaxyx
  887. X#define getmaxyx(win,y,x)   ((y)=getmaxy(win),(x)=getmaxx(win))
  888. X#endif
  889. X
  890. X/* 
  891. X * if color par numbers are changed, disputil.c
  892. X * color_attr and mono_attr tables
  893. X * must also be changed
  894. X */
  895. X
  896. X#define cpINFO        1    /* information field */
  897. X#define cpREVERSE    2    /* "reverse video" */
  898. X#define cpBANWARN    3    /* banner warning */
  899. X#define cpLOW        4    /* low/user/io */
  900. X#define cpMED        5    /* medium/kernel/pio */
  901. X#define cpHIGH        6    /* high/brk/swp */
  902. X#define cpBANNER    7    /* banner */
  903. X#define cpLIT        8    /* field literals */
  904. Xextern int color_avail;
  905. X#ifdef COLOR_PAIR
  906. Xextern long color_attr[];
  907. X#endif
  908. Xextern long mono_attr[];
  909. X
  910. X#define MSG_TLY        (LINES - 2)
  911. X#define CMD_TLY        (LINES - 1)
  912. X#define LVMSG_Y        MSG_TLY
  913. X#define LVMSG_X        0
  914. X
  915. X#define CPUSCALE_TLY        1
  916. X#define CPUSCALE_SX            13
  917. X#define CPUSCALE_WIDTH        50
  918. X
  919. X#define WAITSCALE_TLY        5
  920. X#define WAITSCALE_SX        13
  921. X#define WAITSCALE_WIDTH        50
  922. X
  923. X/* Sysinfo/Minfo per second area */
  924. X#define PER_SEC_TLY            9
  925. X#define PER_SEC1_TLX        0
  926. X#define PER_SEC2_TLX        18
  927. X#define PER_SEC3_TLX        35
  928. X#define PER_SEC4_TLX        51
  929. X#define PER_SEC5_TLX        66
  930. X
  931. X/* extra info area */
  932. X#define EXTRA_TLY            26
  933. X#define EXTRA1_TLX            0
  934. X#define EXTRA2_TLX            18
  935. X#define EXTRA3_TLX            43
  936. X#define EXTRA4_TLX            62
  937. X
  938. X#include "lint_args.h"
  939. X
  940. X#endif /* _u386mon_h */
  941. X
  942. X/* vi: set tabstop=4 shiftwidth=4: */
  943. X/* end of u386mon.h */
  944. SHAR_EOF
  945. chmod 0644 u386mon.h ||
  946. echo 'restore of u386mon.h failed'
  947. Wc_c="`wc -c < 'u386mon.h'`"
  948. test 4824 -eq "$Wc_c" ||
  949.     echo 'u386mon.h: original size 4824, current size' "$Wc_c"
  950. fi
  951. # ============= renice/Makefile ==============
  952. if test ! -d 'renice'; then
  953.     echo 'x - creating directory renice'
  954.     mkdir 'renice'
  955. fi
  956. if test -f 'renice/Makefile' -a X"$1" != X"-c"; then
  957.     echo 'x - skipping renice/Makefile (File already exists)'
  958. else
  959. echo 'x - extracting renice/Makefile (Text)'
  960. sed 's/^X//' << 'SHAR_EOF' > 'renice/Makefile' &&
  961. X#  CHK=0x72AC
  962. X#+-------------------------------------------------------------------
  963. X#  Makefile for renice for SCO UNIX V/386
  964. X#  ...!emory!n4hgf!wht
  965. X#--------------------------------------------------------------------
  966. X#+:EDITS:*/
  967. X#:07-15-1992-14:32-wht@n4hgf-2.60 release - u386mon+siotools merge
  968. X#:06-25-1990-04:14-wht@n4hgf-1.03-better error handling
  969. X#:06-21-1990-14:27-r@n4hgf-version x0.12 seems bug free
  970. X#:06-19-1990-21:37-wht@n4hgf-get ready for 0.08 release
  971. X
  972. X#------------> CFLAGS 
  973. XCFLAGS = -c -Octl -DLINT_ARGS
  974. X#CFLAGS = -c -O
  975. X
  976. X#------------> BINDIR
  977. XBINDIR = /usr/local/bin
  978. X
  979. X#LDFLAGS = -s
  980. X
  981. X
  982. X#handle Sys V make "feature" of using SHELL
  983. XSHELL = /bin/sh
  984. X
  985. X#FCRC = fcrc -u $*.c ;
  986. X.c.o:;    $(FCRC) $(CC) $(CFLAGS) $*.c 
  987. X
  988. XSRC = \
  989. X    renice.c
  990. X
  991. XRENICE_OBJ =\
  992. X    renice.o\
  993. X    ../libnlsym.o\
  994. X    libkmem-w.o
  995. X
  996. Xall: renice
  997. X
  998. X#must run as root
  999. Xinstall: all
  1000. X    mv renice $(BINDIR)
  1001. X    chmod 4711 $(BINDIR)/renice
  1002. X    chown root $(BINDIR)/renice
  1003. X    @echo ' ';echo 'csh users rehash before executing'
  1004. X
  1005. Xrenice: $(RENICE_OBJ)
  1006. X    $(CC) $(LDFLAGS) -o $@ $(RENICE_OBJ) $(LIB)
  1007. X
  1008. Xlibkmem-w.o: ../libkmem.c
  1009. X    cc $(CFLAGS) -I .. -DKWRITE_NEEDED ../libkmem.c; mv libkmem.o libkmem-w.o
  1010. X
  1011. X../libnlsym.o: ../libnlsym.c
  1012. X    cd ..;make libnlsym.o
  1013. X
  1014. Xclean:
  1015. X    rm -f renice.o libkmem-w.o core 
  1016. X
  1017. Xclobber: clean
  1018. X    rm -f renice
  1019. X
  1020. SHAR_EOF
  1021. chmod 0644 renice/Makefile ||
  1022. echo 'restore of renice/Makefile failed'
  1023. Wc_c="`wc -c < 'renice/Makefile'`"
  1024. test 1267 -eq "$Wc_c" ||
  1025.     echo 'renice/Makefile: original size 1267, current size' "$Wc_c"
  1026. fi
  1027. # ============= renice/renice.c ==============
  1028. if test -f 'renice/renice.c' -a X"$1" != X"-c"; then
  1029.     echo 'x - skipping renice/renice.c (File already exists)'
  1030. else
  1031. echo 'x - extracting renice/renice.c (Text)'
  1032. sed 's/^X//' << 'SHAR_EOF' > 'renice/renice.c' &&
  1033. X/* CHK=0x71B7 */
  1034. X/*+-------------------------------------------------------------------------
  1035. X    renice.c - UNIX 386 renice
  1036. X
  1037. X * This program was written by me, Mike "Ford" Ditto, and
  1038. X * I hereby release it into the public domain in the interest
  1039. X * of promoting the development of free, quality software
  1040. X * for the hackers and users of the world.
  1041. X *
  1042. X * Feel free to use, copy, modify, improve, and redistribute
  1043. X * this program, but keep in mind the spirit of this
  1044. X * contribution; always provide source, and always allow
  1045. X * free redistribution (shareware is fine with me).  If
  1046. X * you use a significant part of this code in a program of
  1047. X * yours, I would appreciate being given the appropriate
  1048. X * amount of credit.
  1049. X *                -=] Ford [=-
  1050. X *
  1051. X--------------------------------------------------------------------------*/
  1052. X/*+:EDITS:*/
  1053. X/*:07-15-1992-14:32-wht@n4hgf-2.60 release - u386mon+siotools merge */
  1054. X/*:06-26-1990-15:09-wht@n4hgf-adapt Ford's work to UNIX 386 */
  1055. X
  1056. X#include <stdio.h>
  1057. X#include <errno.h>
  1058. X#include <sys/types.h>
  1059. X#undef NGROUPS_MAX
  1060. X#undef NULL
  1061. X#include <sys/param.h>
  1062. X#include <sys/immu.h>
  1063. X#include <sys/region.h>
  1064. X#include <sys/proc.h>
  1065. X#include <sys/var.h>
  1066. X#include <nlist.h>
  1067. X#include "../nlsym.h"
  1068. X#include "../libkmem.h"
  1069. X#include "../libnlsym.h"
  1070. X
  1071. Xstruct var v;
  1072. Xstruct proc tproc;
  1073. Xint myuid;
  1074. Xchar *progname;
  1075. Xchar s128[128];
  1076. Xint myreadcnt = 0;            /* see libkmem.c, libmem.c, libswap.c */
  1077. Xdaddr_t myreadlen = 0;
  1078. X
  1079. X/*+-------------------------------------------------------------------------
  1080. X    leave_text(text,exit_code)
  1081. XIf exit_code == 255, do perror
  1082. X--------------------------------------------------------------------------*/
  1083. Xvoid
  1084. Xleave_text(text,exit_code)
  1085. Xchar *text;
  1086. Xint exit_code;
  1087. X{
  1088. X    if(exit_code == 255)
  1089. X        perror(text);
  1090. X    else
  1091. X    {
  1092. X        fputs(text,stderr);
  1093. X        fputs("\n",stderr);
  1094. X    }
  1095. X    exit(exit_code);
  1096. X}    /* end of leave_text */
  1097. X
  1098. X/*+-------------------------------------------------------------------------
  1099. X    renice(pid,value,relative) - change nice of process `pid'
  1100. Xbased on 'value' and 'relative'
  1101. X--------------------------------------------------------------------------*/
  1102. Xrenice(pid,value,relative)
  1103. Xint pid;
  1104. Xint value;
  1105. Xint relative;
  1106. X{
  1107. X    register i;
  1108. X    int tmpnice;
  1109. X
  1110. X    for(i = 0; i < v.v_proc; i++)
  1111. X    {
  1112. X        kread((caddr_t)&tproc,(daddr_t)((struct proc *)procaddr + i),
  1113. X            sizeof(struct proc));
  1114. X        if(tproc.p_pid == pid)
  1115. X        {
  1116. X#ifdef DEBUG
  1117. X            fprintf(stderr,"Found it!  proc[%d], p_uid is %d\n",
  1118. X                i,tproc.p_uid);
  1119. X
  1120. X            fprintf(stderr,"Old p_nice was %d\n",tproc.p_nice);
  1121. X#endif /* DEBUG */
  1122. X
  1123. X            tmpnice = tproc.p_nice;
  1124. X
  1125. X            if(relative)
  1126. X                tmpnice += value;
  1127. X            else
  1128. X                tmpnice = value;
  1129. X
  1130. X            if(tmpnice >= 40)
  1131. X                tmpnice = 40;
  1132. X            if(tmpnice < 0)
  1133. X                tmpnice = 0;
  1134. X
  1135. X#ifdef DEBUG
  1136. X            fprintf(stderr,"New p_nice is %d\n",tmpnice);
  1137. X#endif /* DEBUG */
  1138. X
  1139. X            if( 
  1140. X#ifdef WHT
  1141. X                (myuid && (myuid != 201))
  1142. X#else
  1143. X                myuid
  1144. X#endif
  1145. X                 && ((myuid != tproc.p_uid) || (tmpnice < tproc.p_nice)))
  1146. X            {
  1147. X                errno = EACCES;
  1148. X                sprintf(s128,"%s: can't renice process %d",progname,pid);
  1149. X                perror(s128);
  1150. X                return 1;
  1151. X            }
  1152. X
  1153. X            tproc.p_nice = tmpnice;
  1154. X
  1155. X            kwrite((daddr_t)&((struct proc *)procaddr)[i]
  1156. X                + ( ((caddr_t)&tproc.p_nice) - (caddr_t)&tproc ),
  1157. X                (caddr_t)&tproc.p_nice,sizeof(tproc.p_nice));
  1158. X            return(0);
  1159. X        }
  1160. X    }
  1161. X    fprintf(stderr,"%s: process %d not found.\n",progname,pid);
  1162. X
  1163. X    return(1);
  1164. X}    /* end of renice */
  1165. X
  1166. X/*+-------------------------------------------------------------------------
  1167. X    usage()
  1168. X--------------------------------------------------------------------------*/
  1169. Xvoid
  1170. Xusage()
  1171. X{
  1172. X    fprintf(stderr,"usage: %s [{+-}inc] [=prio] pid ...\n",progname);
  1173. X    exit(-1);
  1174. X}    /* end of usage */
  1175. X
  1176. X/*+-------------------------------------------------------------------------
  1177. X    main(argc,argv)
  1178. X--------------------------------------------------------------------------*/
  1179. Xmain(argc,argv)
  1180. Xint argc;
  1181. Xchar **argv;
  1182. X{
  1183. X    int status=0;
  1184. X    int pid;
  1185. X    int relative = 1;
  1186. X    int value = 0;
  1187. X
  1188. X    progname = *argv;
  1189. X    if(argc < 2)
  1190. X        usage();
  1191. X
  1192. X    myuid = getuid();
  1193. X    nlsym_read();
  1194. X    kinit(1);
  1195. X    kread((caddr_t)&v,vaddr,sizeof(v));
  1196. X
  1197. X    while(++argv,--argc)
  1198. X    {
  1199. X        switch(**argv)
  1200. X        {
  1201. X        case '-':
  1202. X            if(sscanf(*argv+1,"%d",&value) != 1)
  1203. X                usage();
  1204. X            relative = 1;
  1205. X            break;
  1206. X        case '+':
  1207. X            if(sscanf(*argv+1,"%d",&value) != 1)
  1208. X                usage();
  1209. X            value = -value;
  1210. X            relative = 1;
  1211. X            break;
  1212. X        case '=':
  1213. X            if(sscanf(*argv+1,"%d",&value) != 1)
  1214. X                usage();
  1215. X            relative = 0;
  1216. X            break;
  1217. X        default:
  1218. X            if(sscanf(*argv,"%d",&pid) != 1)
  1219. X                usage();
  1220. X            status += renice(pid,value,relative);
  1221. X        }
  1222. X    }
  1223. X
  1224. X    exit(status);
  1225. X}    /* end of main */
  1226. X
  1227. X/* vi: set tabstop=4 shiftwidth=4: */
  1228. X/* end of renice.c */
  1229. SHAR_EOF
  1230. chmod 0644 renice/renice.c ||
  1231. echo 'restore of renice/renice.c failed'
  1232. Wc_c="`wc -c < 'renice/renice.c'`"
  1233. test 4536 -eq "$Wc_c" ||
  1234.     echo 'renice/renice.c: original size 4536, current size' "$Wc_c"
  1235. fi
  1236. # ============= panel/README ==============
  1237. if test ! -d 'panel'; then
  1238.     echo 'x - creating directory panel'
  1239.     mkdir 'panel'
  1240. fi
  1241. if test -f 'panel/README' -a X"$1" != X"-c"; then
  1242.     echo 'x - skipping panel/README (File already exists)'
  1243. else
  1244. echo 'x - extracting panel/README (Text)'
  1245. sed 's/^X//' << 'SHAR_EOF' > 'panel/README' &&
  1246. XLIBPANEL 1.2 README - last revised Wed Jul 25 01:07:33 EDT 1990
  1247. X
  1248. XThis is a public domain implementation of the S5R3 terminfo
  1249. Xcurses panels layer.  It was written primarily to assist in
  1250. Xporting u386mon 2.0 to systems lacking panels support.  It meets
  1251. Xthose needs and may be useful in other applications.  u386mon
  1252. X2.10 and beyond use the package.
  1253. X
  1254. XFUNCTIONALITY
  1255. X-------------
  1256. X
  1257. XPanels are terminfo curses(3) windows with the added feature of depth.
  1258. XPanel functions allow the use of stacked windows and ensure the proper
  1259. Xportions of each window and the curses stdscr window are hidden or
  1260. Xdisplayed when panels are added, moved, modified or removed.  The set
  1261. Xof currently visible panels is the stack of panels.  Stdscr beneath
  1262. Xall panels, and is not considered part of the stack.
  1263. X
  1264. XA window is associated with every panel.  The panel routines enable
  1265. Xyou to create, move, hides, and show panels, as well as position a
  1266. Xpanel at an appropriate position in the stack.
  1267. X
  1268. XPanel routines are a functional layer added to terminfo curses(3),
  1269. Xmake only high-level curses calls, and work anywhere terminfo curses
  1270. Xdoes.
  1271. X
  1272. XCOMPATIBILITY
  1273. X-------------
  1274. X
  1275. XReasonable care has been taken to ensure compatibility with the native
  1276. Xpanel facility introducted with S5R3.2.  The PANEL data structures are
  1277. Xmerely similar.  The programmer is cautioned not to directly use
  1278. X'PANEL' fields.
  1279. X
  1280. XThe functions show_panel() and top_panel() are identical in thes
  1281. Ximplementation, and work equally well with displayed or hidden panels.
  1282. XIn the native implementation, show_panel() is intended for making a
  1283. Xhidden panel visible (at the top of the stack) and top_panel() is
  1284. Xintended for making an already-visible panel move to the top of the
  1285. Xstack.  You are cautioned to use the correct function to ensure
  1286. Xcompatibility with native panel libraries.
  1287. X
  1288. XUSE
  1289. X---
  1290. X
  1291. XTo make this panels implementation work for you, install
  1292. Xpanel.h in /usr/include or modify each of your panel-using
  1293. Xsources in a fashion similar to:
  1294. X
  1295. Xold:
  1296. X#include <curses.h>
  1297. X#include <panel.h>
  1298. X
  1299. Xnew:
  1300. X#include <curses.h>
  1301. X#ifdef NATIVE_PANELS
  1302. X#include <panel.h>
  1303. X#else
  1304. X#include "panel.h"
  1305. X#endif
  1306. X
  1307. XInclude libpanel.o in your link line and panel away.
  1308. X
  1309. XCOMPILE TIME SWITCHES
  1310. X---------------------
  1311. X__STDC__ is used to detect nouveau compilers.  Depending on who/where
  1312. Xyou are, on what day of the week, The Great Programmer help you.
  1313. XI only use it to satisfy lint that malloc is a good function to use.
  1314. X
  1315. XLINT_ARGS causes a Microsoft 5.1 flavor of function prototypes to
  1316. Xbe used.
  1317. X
  1318. XNATIVE_PANELS is detected by panel.h.  If NATIVE_PANELS *is* defined,
  1319. Xthen an error is emited to keep you from using the wrong panel.h.
  1320. X
  1321. XTESTING
  1322. X-------
  1323. X
  1324. XA rudimentary test program, PTEST, is supplied.  It requires
  1325. Xthe nap() system call.  If You do not have nap, add -DNONAP
  1326. Xto your CFLAGS line.
  1327. X
  1328. XCopy libpanel.[ch] into this directory to make the test executable.
  1329. X
  1330. XThe manual page speaks highly of libpanel, but I really have no
  1331. Xidea about its usability other than with u386mon.
  1332. X
  1333. XComments are appreciated, especially bug fixes and information
  1334. Xhelping to port the module to another system.
  1335. X
  1336. XWarren Tucker N4HGF
  1337. X{gatech,emory}!n4hgf!wht -or- wht@n4hgf.Mt-Park.GA.US
  1338. SHAR_EOF
  1339. chmod 0644 panel/README ||
  1340. echo 'restore of panel/README failed'
  1341. Wc_c="`wc -c < 'panel/README'`"
  1342. test 3147 -eq "$Wc_c" ||
  1343.     echo 'panel/README: original size 3147, current size' "$Wc_c"
  1344. fi
  1345. # ============= panel/panel.3 ==============
  1346. if test -f 'panel/panel.3' -a X"$1" != X"-c"; then
  1347.     echo 'x - skipping panel/panel.3 (File already exists)'
  1348. else
  1349. echo 'x - extracting panel/panel.3 (Text)'
  1350. sed 's/^X//' << 'SHAR_EOF' > 'panel/panel.3' &&
  1351. X.\" @(#)panel.3    1.1 7/23/90
  1352. X.TH PANEL 3 "23 July 1990" "wht@n4hgf"
  1353. X.SH NAME
  1354. Xpanel - surrogate PANEL library routines
  1355. X.SH SYNTAX
  1356. X.B "include "panel.h"
  1357. X
  1358. X.B "cc [flags] sourcefiles libpanel.[co] -lcurses -[otherlibs]
  1359. X
  1360. X.B "PANEL *new_panel(win);"
  1361. X.br
  1362. XWINDOW *win;
  1363. X
  1364. X.B "int bottom_panel(pan);"
  1365. X.br
  1366. XPANEL *pan;
  1367. X
  1368. X.B "int top_panel(pan);"
  1369. X.br
  1370. XPANEL *pan;
  1371. X
  1372. X.B "int show_panel(pan);"
  1373. X.br
  1374. XPANEL *pan;
  1375. X
  1376. X.B "void update_panels();"
  1377. X
  1378. X.B "int hide_panel(pan);"
  1379. X.br
  1380. XPANEL *pan;
  1381. X
  1382. X.B "WINDOW *panel_window(pan);"
  1383. X.br
  1384. XPANEL *pan;
  1385. X
  1386. X.B "int replace_panel(pan,window);"
  1387. X.br
  1388. XPANEL *pan;
  1389. X.br
  1390. XWINDOW *window;
  1391. X
  1392. X.B "int move_panel(pan,starty,startx);"
  1393. X.br
  1394. XPANEL *pan;
  1395. X.br
  1396. Xint starty;
  1397. X.br
  1398. Xint startx;
  1399. X
  1400. X.B "int panel_hidden(pan);"
  1401. X.br
  1402. XPANEL *pan;
  1403. X
  1404. X.B "PANEL *panel_above(pan);"
  1405. X.br
  1406. XPANEL *pan;
  1407. X
  1408. X.B "PANEL *panel_below(pan);"
  1409. X.br
  1410. XPANEL *pan;
  1411. X
  1412. X.B "int set_panel_userptr(pan,ptr);"
  1413. X.br
  1414. XPANEL *pan;
  1415. X.br
  1416. Xchar *ptr;
  1417. X
  1418. X.B "char *panel_userptr(pan);"
  1419. X.br
  1420. XPANEL *pan;
  1421. X
  1422. X.B "int del_panel(pan);"
  1423. X.br
  1424. XPANEL *pan;
  1425. X
  1426. X.SH DESCRIPTION
  1427. XPanels are terminfo curses(3) windows with the added feature of
  1428. Xdepth.  Panel functions allow the use of stacked windows and
  1429. Xensure the proper portions of each window and the curses stdscr
  1430. Xwindow are hidden or displayed when panels are added, moved,
  1431. Xmodified or removed.  The set of currently visible panels is the
  1432. Xstack of panels.  Stdscr beneath all panels, and is not
  1433. Xconsidered part of the stack.
  1434. X
  1435. XA window is associated with every panel.  The panel routines
  1436. Xenable you to create, move, hides, and show panels, as well as
  1437. Xposition a panel at an appropriate position in the stack.
  1438. X
  1439. XPanel routines are a functional layer added to terminfo curses(3), make
  1440. Xonly high-level curses calls, and work anywhere terminfo curses does.
  1441. X
  1442. X.SH FUNCTIONS
  1443. X.B "new_panel(win)"
  1444. Xallocates a 'PANEL',
  1445. Xassovciates it with win,
  1446. Xplaces the panel on the top of the stack (causes it to be dispalyed
  1447. Xabove any other panel) and
  1448. Xreturns a pointer to the new panel.
  1449. X
  1450. X.B "void update_panels()"
  1451. Xrefreshes the virtual screen to reflect the relations between the
  1452. Xpanels in the stack, but does not call doupdate() to refresh the
  1453. Xphysical screen.  Use this function and not wrefresh or wnoutrefresh.
  1454. Xupdate_panels() may be called more than once before a call to
  1455. Xdoupdate(), but doupdate() is the function responsible for
  1456. Xupdating the physical screen.
  1457. X.br
  1458. Xe.g.,
  1459. X.br
  1460. Xupdate_panels();   /* panel(3) call */
  1461. X.br
  1462. Xdoupdate();        /* curses(3) call */
  1463. X
  1464. X.B "del_panel(pan)"
  1465. Xremoves pan from the stack,
  1466. Xdeletes the 'PANEL', but not its associated window.
  1467. X
  1468. X.B "hide_panel(pan)"
  1469. Xremoves the panel from the panel stack and thus hides it
  1470. Xfrom view.  The 'PANEL' is not lost, merely removed
  1471. Xfrom the stack.
  1472. X
  1473. X.B "show_panel(pan)"
  1474. Xmakes a hidden panel visible by placing it on top of
  1475. Xthe panels in the panel stack.
  1476. XSee COMPATIBILITY below.
  1477. X
  1478. X.B "top_panel(pan)"
  1479. Xputs the given visible panel on top of all panels in the stack.
  1480. XSee COMPATIBILITY below.
  1481. X
  1482. X.B "bottom_panel(pan)"
  1483. Xputs panel at the bottom of all panels.
  1484. X
  1485. X.B "move_panel(pan,starty,startx)"
  1486. Xmoves the given panel window so that
  1487. Xits upper-left corner is at starty, startx.  
  1488. XIt does not change the position of the panel in the stack.
  1489. XBe sure to use this function, not mvwin(), to move a panel window.
  1490. X
  1491. X.B "replace_panel(pan,window)"
  1492. Xreplaces the current window of panel with window.
  1493. XIt does not change the position of the panel in the stack.
  1494. X
  1495. X.B "panel_above(pan)"
  1496. Xreturns a pointer to the panel above pan.  If
  1497. Xthe panel argument is (PANEL *)0, it returns a pointer to the
  1498. Xbottom panel in the stack.
  1499. X
  1500. X.B "panel_below(pan)"
  1501. Xreturns a pointer to the panel just below pan.
  1502. XIf the panel argument is (PANEL *)0,
  1503. Xit returns a pointer to the top panel in the stack.
  1504. X
  1505. X.B "set_panel_userptr(pan,ptr)"
  1506. Xsets the panel's user pointer.
  1507. X
  1508. X.B "panel_userptr(pan)"
  1509. Xreturns the user pointer for a given panel.
  1510. X
  1511. X.B "panel_window(pan)"
  1512. Xreturns a pointer to the window of panel.
  1513. X
  1514. X.SH DIAGNOSTICS
  1515. XEach routine that returns a pointer returns NULL if an error
  1516. Xoccurs.  Each routine that returns an int value returns OK if it
  1517. Xexecutes successfully and ERR if not.
  1518. X
  1519. X.SH COMPATIBILITY
  1520. XReasonable care has been taken to ensure compatibility with
  1521. Xthe native panel facility introducted with S5R3.2.  The PANEL
  1522. Xdata structures are merely  similar.  The programmer
  1523. Xis cautioned not to directly use 'PANEL' fields.
  1524. X
  1525. XThe functions show_panel() and top_panel() are identical
  1526. Xin thes implementation, and work equally well with
  1527. Xdisplayed or hidden panels.
  1528. XIn the native implementation,
  1529. Xshow_panel() is intended for making a hidden panel visible
  1530. X(at the top of the stack) and top_panel() is intended for
  1531. Xmaking an already-visible panel move to the top of the stack.
  1532. XYou are cautioned to use the correct function to ensure
  1533. Xcompatibility with native panel libraries.
  1534. X
  1535. X.SH FILES
  1536. Xpanel.h
  1537. X.br
  1538. Xlibpanel.c
  1539. X
  1540. X.SH "SEE ALSO"
  1541. Xcurses(3)
  1542. X
  1543. X.SH "AUTHOR"
  1544. Xwht@n4hgf.Mt-Park.GA.US ({emory,gatech}!n4hgf!wht), primarily
  1545. Xto assist in porting u386mon to systems without a native
  1546. Xpanels library.
  1547. SHAR_EOF
  1548. chmod 0644 panel/panel.3 ||
  1549. echo 'restore of panel/panel.3 failed'
  1550. Wc_c="`wc -c < 'panel/panel.3'`"
  1551. test 4935 -eq "$Wc_c" ||
  1552.     echo 'panel/panel.3: original size 4935, current size' "$Wc_c"
  1553. fi
  1554. # ============= panel/ptest.c ==============
  1555. if test -f 'panel/ptest.c' -a X"$1" != X"-c"; then
  1556.     echo 'x - skipping panel/ptest.c (File already exists)'
  1557. else
  1558. echo 'x - extracting panel/ptest.c (Text)'
  1559. sed 's/^X//' << 'SHAR_EOF' > 'panel/ptest.c' &&
  1560. X/* CHK=0x9F7C */
  1561. X/*+-------------------------------------------------------------------------
  1562. X    ptest.c
  1563. X--------------------------------------------------------------------------*/
  1564. X/*+:EDITS:*/
  1565. X/*:07-15-1992-14:32-wht@n4hgf-2.60 release - u386mon+siotools merge */
  1566. X/*:07-24-1990-23:20-wht@n4hgf-move debug code to libpanel.c */
  1567. X/*:07-20-1990-18:28-wht-creation */
  1568. X
  1569. X#define M_TERMINFO
  1570. X#include <curses.h>
  1571. X#include "libpanel.h"
  1572. X
  1573. XPANEL *p1;
  1574. XPANEL *p2;
  1575. XPANEL *p3;
  1576. XPANEL *p4;
  1577. XPANEL *p5;
  1578. XWINDOW *w1;
  1579. XWINDOW *w2;
  1580. XWINDOW *w3;
  1581. XWINDOW *w4;
  1582. XWINDOW *w5;
  1583. X
  1584. Xlong nap_msec = 500L;
  1585. X
  1586. Xchar *mod[] = 
  1587. X{
  1588. X    "test ",
  1589. X    "TEST ",
  1590. X    "(**) ",
  1591. X    "*()* ",
  1592. X    "<--> ",
  1593. X    "LAST "
  1594. X};
  1595. X
  1596. X/*+-------------------------------------------------------------------------
  1597. X    wait_a_while(msec)
  1598. X--------------------------------------------------------------------------*/
  1599. Xvoid
  1600. Xwait_a_while(msec)
  1601. Xlong msec;
  1602. X{
  1603. X#ifdef NONAP
  1604. X    if(nap_msec == 1)
  1605. X        getchar();
  1606. X    else if(msec > 1000L)
  1607. X        sleep((int)msec/1000L);
  1608. X    else
  1609. X        sleep(1);
  1610. X#else
  1611. X    if(nap_msec == 1)
  1612. X        getchar();
  1613. X    else
  1614. X        nap(nap_msec);
  1615. X#endif
  1616. X}    /* end of wait_a_while */
  1617. X
  1618. X/*+-------------------------------------------------------------------------
  1619. X    saywhat(text)
  1620. X--------------------------------------------------------------------------*/
  1621. Xvoid
  1622. Xsaywhat(text)
  1623. Xchar *text;
  1624. X{
  1625. Xint y,x;
  1626. X
  1627. X#ifdef PANEL_DEBUG
  1628. X    if(!dfp)
  1629. X    {
  1630. X        dfp = fopen("p.log","w");
  1631. X        fputs("-------\n",dfp);
  1632. X    }
  1633. X    fprintf(dfp,"\n--> %s\n",text);
  1634. X#endif
  1635. X
  1636. X    wmove(stdscr,LINES - 1,0);
  1637. X    wprintw(stdscr,"%-20.20s",text);
  1638. X
  1639. X}    /* end of saywhat */
  1640. X
  1641. X/*+-------------------------------------------------------------------------
  1642. X    mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them
  1643. X--------------------------------------------------------------------------*/
  1644. XPANEL *
  1645. Xmkpanel(rows,cols,tly,tlx)
  1646. Xint rows;
  1647. Xint cols;
  1648. Xint tly;
  1649. Xint tlx;
  1650. X{
  1651. XWINDOW *win = newwin(rows,cols,tly,tlx);
  1652. XPANEL *pan;
  1653. X
  1654. X    if(!win)
  1655. X        return((PANEL *)0);
  1656. X    if(pan = new_panel(win))
  1657. X        return(pan);
  1658. X    delwin(win);
  1659. X    return((PANEL *)0);
  1660. X}    /* end of mkpanel */
  1661. X
  1662. X/*+-------------------------------------------------------------------------
  1663. X    rmpanel(pan)
  1664. X--------------------------------------------------------------------------*/
  1665. Xvoid
  1666. Xrmpanel(pan)
  1667. XPANEL *pan;
  1668. X{
  1669. XWINDOW *win = pan->win;
  1670. X    del_panel(pan);
  1671. X    delwin(win);
  1672. X}    /* end of rmpanel */
  1673. X
  1674. X/*+-------------------------------------------------------------------------
  1675. X    pflush()
  1676. X--------------------------------------------------------------------------*/
  1677. Xvoid
  1678. Xpflush()
  1679. X{
  1680. X    update_panels();
  1681. X    doupdate();
  1682. X}    /* end of pflush */
  1683. X
  1684. X/*+-------------------------------------------------------------------------
  1685. X    fill_panel(win)
  1686. X--------------------------------------------------------------------------*/
  1687. Xfill_panel(pan)
  1688. XPANEL *pan;
  1689. X{
  1690. XWINDOW *win = pan->win;
  1691. Xchar num = *(pan->user + 1);
  1692. Xint y,x;
  1693. X
  1694. X    box(win,'|','-');
  1695. X    wmove(win,1,1);
  1696. X    wprintw(win,"-pan%c-",num);
  1697. X    for(y = 2; y < getmaxy(win) - 1; y++)
  1698. X    {
  1699. X        for(x = 1; x < getmaxx(win) - 1; x++)
  1700. X        {
  1701. X            wmove(win,y,x);
  1702. X            waddch(win,num);
  1703. X        }
  1704. X    }
  1705. X}    /* end of fill_panel */
  1706. X
  1707. X/*+-------------------------------------------------------------------------
  1708. X    main(argc,argv)
  1709. X--------------------------------------------------------------------------*/
  1710. Xmain(argc,argv)
  1711. Xint argc;
  1712. Xchar **argv;
  1713. X{
  1714. Xint itmp;
  1715. Xregister y,x;
  1716. Xlong atol();
  1717. X
  1718. X    if((argc > 1) && atol(argv[1]))
  1719. X        nap_msec = atol(argv[1]);
  1720. X
  1721. X    initscr();
  1722. X
  1723. X    for(y = 0; y < LINES - 1; y++)
  1724. X    {
  1725. X        for(x = 0; x < COLS; x++)
  1726. X            wprintw(stdscr,"%d",(y + x) % 10);
  1727. X    }
  1728. X    for(y = 0; y < 5; y++)
  1729. X    {
  1730. X        p1 = mkpanel(10,10,0,0);
  1731. X        w1 = panel_window(p1);
  1732. X        set_panel_userptr(p1,"p1");
  1733. X
  1734. X        p2 = mkpanel(14,14,5,5);
  1735. X        w2 = panel_window(p2);
  1736. X        set_panel_userptr(p2,"p2");
  1737. X
  1738. X        p3 = mkpanel(6,8,12,12);
  1739. X        w3 = panel_window(p3);
  1740. X        set_panel_userptr(p3,"p3");
  1741. X
  1742. X        p4 = mkpanel(10,10,10,30);
  1743. X        w4 = panel_window(p4);
  1744. X        set_panel_userptr(p4,"p4");
  1745. X
  1746. X        p5 = mkpanel(10,10,13,37);
  1747. X        w5 = panel_window(p5);
  1748. X        set_panel_userptr(p5,"p5");
  1749. X
  1750. X        fill_panel(p1);
  1751. X        fill_panel(p2);
  1752. X        fill_panel(p3);
  1753. X        fill_panel(p4);
  1754. X        fill_panel(p5);
  1755. X        hide_panel(p4);
  1756. X        hide_panel(p5);
  1757. X        pflush();
  1758. X        wait_a_while(nap_msec);
  1759. X
  1760. X        saywhat("h3 s1 s2 s4 s5;");
  1761. X        move_panel(p1,0,0);
  1762. X        hide_panel(p3);
  1763. X        show_panel(p1);
  1764. X        show_panel(p2);
  1765. X        show_panel(p4);
  1766. X        show_panel(p5);
  1767. X        pflush();
  1768. X        wait_a_while(nap_msec);
  1769. X
  1770. X        saywhat("s1;");
  1771. X        show_panel(p1);
  1772. X        pflush();
  1773. X        wait_a_while(nap_msec);
  1774. X
  1775. X        saywhat("s2;");
  1776. X        show_panel(p2);
  1777. X        pflush();
  1778. X        wait_a_while(nap_msec);
  1779. X
  1780. X        saywhat("m2;");
  1781. X        move_panel(p2,10,10);
  1782. X        pflush();
  1783. X        wait_a_while(nap_msec);
  1784. X
  1785. X        saywhat("s3;");
  1786. X        show_panel(p3);
  1787. X        pflush();
  1788. X        wait_a_while(nap_msec);
  1789. X
  1790. X        saywhat("m3;");
  1791. X        move_panel(p3,5,5);
  1792. X        pflush();
  1793. X        wait_a_while(nap_msec);
  1794. X
  1795. X        saywhat("b3;");
  1796. X        bottom_panel(p3);
  1797. X        pflush();
  1798. X        wait_a_while(nap_msec);
  1799. X
  1800. X        saywhat("s4;");
  1801. X        show_panel(p4);
  1802. X        pflush();
  1803. X        wait_a_while(nap_msec);
  1804. X
  1805. X        saywhat("s5;");
  1806. X        show_panel(p5);
  1807. X        pflush();
  1808. X        wait_a_while(nap_msec);
  1809. X
  1810. X        saywhat("t3;");
  1811. X        top_panel(p3);
  1812. X        pflush();
  1813. X        wait_a_while(nap_msec);
  1814. X
  1815. X        saywhat("t1;");
  1816. X        top_panel(p1);
  1817. X        pflush();
  1818. X        wait_a_while(nap_msec);
  1819. X
  1820. X        saywhat("t2;");
  1821. X        top_panel(p2);
  1822. X        pflush();
  1823. X        wait_a_while(nap_msec);
  1824. X
  1825. X        saywhat("t3;");
  1826. X        top_panel(p3);
  1827. X        pflush();
  1828. X        wait_a_while(nap_msec);
  1829. X
  1830. X        saywhat("t4;");
  1831. X        top_panel(p4);
  1832. X        pflush();
  1833. X        wait_a_while(nap_msec);
  1834. X
  1835. X        for(itmp = 0; itmp < 6; itmp++)
  1836. X        {
  1837. X            saywhat("m4;");
  1838. X            wmove(w4,3,1);
  1839. X            waddstr(w4,mod[itmp]);
  1840. X            move_panel(p4,4,itmp*10);
  1841. X            wmove(w5,4,1);
  1842. X            waddstr(w5,mod[itmp]);
  1843. X            pflush();
  1844. X            wait_a_while(nap_msec);
  1845. X            saywhat("m5;");
  1846. X            wmove(w4,4,1);
  1847. X            waddstr(w4,mod[itmp]);
  1848. X            move_panel(p5,7,(itmp*10) + 6);
  1849. X            wmove(w5,3,1);
  1850. X            waddstr(w5,mod[itmp]);
  1851. X            pflush();
  1852. X            wait_a_while(nap_msec);
  1853. X        }
  1854. X
  1855. X        saywhat("m4;");
  1856. X        move_panel(p4,4,itmp*10);
  1857. X        pflush();
  1858. X        wait_a_while(nap_msec);
  1859. X
  1860. X        saywhat("t5;");
  1861. X        top_panel(p5);
  1862. X        pflush();
  1863. X        wait_a_while(nap_msec);
  1864. X
  1865. X        saywhat("t2;");
  1866. X        top_panel(p2);
  1867. X        pflush();
  1868. X        wait_a_while(nap_msec);
  1869. X
  1870. X        saywhat("t1;");
  1871. X        top_panel(p1);
  1872. X        pflush();
  1873. X        wait_a_while(nap_msec);
  1874. X
  1875. X        saywhat("d2;");
  1876. X        rmpanel(p2);
  1877. X        pflush();
  1878. X        wait_a_while(nap_msec);
  1879. X
  1880. X        saywhat("h3;");
  1881. X        hide_panel(p3);
  1882. X        pflush();
  1883. X        wait_a_while(nap_msec);
  1884. X
  1885. X        saywhat("d1;");
  1886. X        rmpanel(p1);
  1887. X        pflush();
  1888. X        wait_a_while(nap_msec);
  1889. X
  1890. X        saywhat("d4; ");
  1891. X        rmpanel(p4);
  1892. X        pflush();
  1893. X        wait_a_while(nap_msec);
  1894. X
  1895. X        saywhat("d5; ");
  1896. X        rmpanel(p5);
  1897. X        pflush();
  1898. X        wait_a_while(nap_msec);
  1899. X        if(nap_msec == 1)
  1900. X            break;
  1901. X        nap_msec = 100L;
  1902. X    }
  1903. X    endwin();
  1904. X    exit(0);
  1905. X}    /* end of main */
  1906. X
  1907. X/* vi: set tabstop=4 shiftwidth=4: */
  1908. X/* end of ptest.c */
  1909. SHAR_EOF
  1910. chmod 0644 panel/ptest.c ||
  1911. echo 'restore of panel/ptest.c failed'
  1912. Wc_c="`wc -c < 'panel/ptest.c'`"
  1913. test 6409 -eq "$Wc_c" ||
  1914.     echo 'panel/ptest.c: original size 6409, current size' "$Wc_c"
  1915. fi
  1916. # ============= panel/Makefile ==============
  1917. if test -f 'panel/Makefile' -a X"$1" != X"-c"; then
  1918.     echo 'x - skipping panel/Makefile (File already exists)'
  1919. else
  1920. echo 'x - extracting panel/Makefile (Text)'
  1921. sed 's/^X//' << 'SHAR_EOF' > 'panel/Makefile' &&
  1922. X#  CHK=0xFD12
  1923. XCFLAGS = -O
  1924. X#CFLAGS = -O -DLINT_ARGS
  1925. X
  1926. XSHARFLS = \
  1927. X    README\
  1928. X    Makefile\
  1929. X    panel.3\
  1930. X    config.h\
  1931. X    libpanel.h\
  1932. X    libpanel.c
  1933. X
  1934. XOBJ = ptest.o libpanel.o
  1935. X
  1936. Xptest: $(OBJ)
  1937. X    cc -o $@ $(OBJ) -lcurses -lx
  1938. X
  1939. X$(OBJ): Makefile libpanel.h
  1940. X
  1941. Xshar:
  1942. X    shar -n libpanel -a $(SHARFLS) > libpanel.sh
  1943. X
  1944. Xclean:
  1945. X    rm -rf $(OBJ) core a.out cscope.out tags
  1946. X
  1947. Xclobber: clean
  1948. X    rm -rf ptest
  1949. SHAR_EOF
  1950. chmod 0644 panel/Makefile ||
  1951. echo 'restore of panel/Makefile failed'
  1952. Wc_c="`wc -c < 'panel/Makefile'`"
  1953. test 363 -eq "$Wc_c" ||
  1954.     echo 'panel/Makefile: original size 363, current size' "$Wc_c"
  1955. fi
  1956. # ============= siotools/Makefile ==============
  1957. if test ! -d 'siotools'; then
  1958.     echo 'x - creating directory siotools'
  1959.     mkdir 'siotools'
  1960. fi
  1961. if test -f 'siotools/Makefile' -a X"$1" != X"-c"; then
  1962.     echo 'x - skipping siotools/Makefile (File already exists)'
  1963. else
  1964. echo 'x - extracting siotools/Makefile (Text)'
  1965. sed 's/^X//' << 'SHAR_EOF' > 'siotools/Makefile' &&
  1966. X#  CHK=0x041A
  1967. X#-----------------------------------
  1968. X# Makefile for uusnap & siomon
  1969. X# wht@n4hgf.Mt-Park.GA.US
  1970. X#-----------------------------------
  1971. X#+:EDITS:*/
  1972. X#:07-15-1992-14:33-wht@n4hgf-2.60 release - u386mon+siotools merge
  1973. X#:06-22-1992-13:25-wht@n4hgf-revisit for 3.2v4
  1974. X#:12-04-1989-18:28-wht-release to comp.sources.misc
  1975. X#:11-23-1989-20:46-wht-creation
  1976. X
  1977. XSHELL = /bin/sh
  1978. X
  1979. X# CFLAGS2 options:
  1980. X# -DSTANDALONE_NLIST: to compile to not use u386mon's nlsym
  1981. X#               this makes for long druding nlists
  1982. X# -DSIO_IS_FAS: is how I get the stuff to work with my FAS configuration
  1983. X#               study the code, especially ../ttynm.h
  1984. XCFLAGS2 = -DSIO_IS_FAS
  1985. X
  1986. X# SCO CC
  1987. XCC=cc
  1988. XCFLAGS = \
  1989. X    -O \
  1990. X    $(CFLAGS2)
  1991. X
  1992. X# SCO UNIX 3.2->3.2v4 gcc
  1993. X#CC = gcc
  1994. X#CFLAGS = \
  1995. X#    $(CFLAGS2) \
  1996. X#    -traditional -O \
  1997. X#    -g \
  1998. X#    -fstrength-reduce -fpcc-struct-return -fwritable-strings \
  1999. X#    -finline-functions -fforce-mem -fforce-addr \
  2000. X#    -W -Wunused -Wpointer-arith -Wcast-qual -Wshadow -Wcomment -Wswitch\
  2001. X#    -D_NO_PROTOTYPE -D_SVID -D_KR \
  2002. X#    -DM_BITFIELDS -DM_COFF -DM_I386 -DM_I86 -DM_I86SM \
  2003. X#    -DM_INTERNAT -DM_SDATA -DM_STEXT -DM_SYS3 -DM_SYS5 \
  2004. X#    -DM_SYSIII -DM_SYSV -DM_UNIX -DM_WORDSWAP -DM_XENIX -Dunix -Di386\
  2005. X#    -DM_TERMINFO
  2006. X
  2007. X# get shared library stuff first, then opendir/etc from libc.a not libx.a
  2008. X# then get nap/rdchk from libx.a
  2009. XLIB=-ltinfo -lc_s -lc -lx
  2010. X
  2011. X# local bin directory (for make install)
  2012. XLBIN=/usr/local/bin
  2013. X
  2014. XSIOMON_OBJ = \
  2015. X    siomon.o\
  2016. X    kmemsio.o \
  2017. X    ../libnlsym.o \
  2018. X    utoa.o \
  2019. X    wingets.o \
  2020. X    wintty.o
  2021. X
  2022. XUUSNAP_OBJ = \
  2023. X    uusnap.o\
  2024. X    kmemsio.o \
  2025. X    ../libnlsym.o \
  2026. X    utoa.o \
  2027. X    wingets.o \
  2028. X    wintty.o
  2029. X
  2030. Xall: uusnap siomon
  2031. X
  2032. Xuusnap: $(UUSNAP_OBJ)
  2033. X    $(CC) $(CFLAGS) $(UUSNAP_OBJ) -o $@ $(LIB)
  2034. X
  2035. Xsiomon: $(SIOMON_OBJ)
  2036. X    $(CC) $(CFLAGS) $(SIOMON_OBJ) -o $@ $(LIB)
  2037. X
  2038. X../libnlsym.o:
  2039. X    cd ..;make libnlsym.o
  2040. X
  2041. Xinstall: all
  2042. X    cp siomon $(LBIN)
  2043. X    -if [ -x /usr/bin/mcs ]; then /usr/bin/mcs -d $(LBIN)/siomon; fi
  2044. X    strip $(LBIN)/siomon
  2045. X    chown root $(LBIN)/siomon
  2046. X    chgrp uucp $(LBIN)/siomon
  2047. X    chmod 4111 $(LBIN)/siomon
  2048. X    cp uusnap $(LBIN)
  2049. X    -if [ -x /usr/bin/mcs ]; then /usr/bin/mcs -d $(LBIN)/uusnap; fi
  2050. X    strip $(LBIN)/uusnap
  2051. X    chown root $(LBIN)/uusnap
  2052. X    chgrp uucp $(LBIN)/uusnap
  2053. X    chmod 4111 $(LBIN)/uusnap
  2054. X
  2055. XSHARFLAGS = -F -n siotools -a -s wht@n4hgf.Mt-Park.GA.US -l 50 -o siotools
  2056. Xshar:
  2057. X    shar $(SHARFLAGS) \
  2058. X    README \
  2059. X    Makefile \
  2060. X    kmemsio.c \
  2061. X    kmemsio.h \
  2062. X    siomon.c \
  2063. X    utoa.c \
  2064. X    utoa.h \
  2065. X    uusnap.c \
  2066. X    wingets.c \
  2067. X    wintio.c \
  2068. X    wintio.h \
  2069. X    wintty.c \
  2070. X    wintty.h 
  2071. X
  2072. Xneat:
  2073. X    rm -f *\# *~ *.orig *.rej *.out *.log core ,* cscope.out tags
  2074. X
  2075. Xclean: neat
  2076. X    rm -f *.o *.a 
  2077. X
  2078. Xclobber: clean
  2079. X    rm -f uusnap siomon
  2080. SHAR_EOF
  2081. chmod 0644 siotools/Makefile ||
  2082. echo 'restore of siotools/Makefile failed'
  2083. Wc_c="`wc -c < 'siotools/Makefile'`"
  2084. test 2546 -eq "$Wc_c" ||
  2085.     echo 'siotools/Makefile: original size 2546, current size' "$Wc_c"
  2086. fi
  2087. true || echo 'restore of siotools/README failed'
  2088. echo End of part 7, continue with part 8
  2089. exit 0
  2090.  
  2091. exit 0 # Just in case...
  2092.