home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume33 / u386mon / part07 < prev    next >
Encoding:
Text File  |  1992-11-20  |  54.4 KB  |  2,086 lines

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