home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xnetload / part01 < prev    next >
Encoding:
Text File  |  1992-03-31  |  40.7 KB  |  1,498 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: rsmith@PIONEER.ARC.NASA.GOV (Roger Smith RCS)
  4. Subject: v17i051: Xwindow based ethernet load monitor, Part01/01
  5. Message-ID: <1992Apr1.150146.5949@msi.com>
  6. Originator: dcmartin@snoopy
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. Date: Wed, 1 Apr 1992 15:01:46 GMT
  10. Approved: dcmartin@msi.com
  11.  
  12. Submitted-by: rsmith@PIONEER.ARC.NASA.GOV (Roger Smith RCS)
  13. Posting-number: Volume 17, Issue 51
  14. Archive-name: xnetload/part01
  15.  
  16. # This is a shell archive (produced by shar 3.49)
  17. # To extract the files from this archive, save it to a file, remove
  18. # everything above the "!/bin/sh" line above, and type "sh file_name".
  19. #
  20. # made 04/01/1992 15:00 UTC by dcmartin@snoopy
  21. # Source directory /home/fascet/csx/src/xnetloadRPC
  22. #
  23. # existing files will NOT be overwritten unless -c is specified
  24. #
  25. #                                                                          
  26. #                                                                          
  27. #
  28. # This shar contains:
  29. # length  mode       name
  30. # ------ ---------- ------------------------------------------
  31. #    313 -rw-r--r-- CHANGES
  32. #    624 -rw-r--r-- Imakefile
  33. #  10573 -rw-r--r-- Makefile
  34. #    187 -rw-r--r-- XNetload.ad
  35. #    386 -rw-r--r-- display.c
  36. #   1777 -rw-r--r-- ether.h
  37. #   2713 -rw-r--r-- ether_clnt.c
  38. #   2061 -rw-r--r-- ether_xdr.c
  39. #    625 -rw-r--r-- get_load.c
  40. #    152 -rw-r--r-- misc.h
  41. #   2316 -rw-r--r-- rpc_stuff.c
  42. #    924 -rw-r--r-- xload.bit
  43. #   5617 -rw-r--r-- xload.c
  44. #   4086 -rw-r--r-- xnetload.man
  45. #
  46. if test -r _shar_seq_.tmp; then
  47.     echo 'Must unpack archives in sequence!'
  48.     echo Please unpack part `cat _shar_seq_.tmp` next
  49.     exit 1
  50. fi
  51. # ============= CHANGES ==============
  52. if test -f 'CHANGES' -a X"$1" != X"-c"; then
  53.     echo 'x - skipping CHANGES (File already exists)'
  54.     rm -f _shar_wnt_.tmp
  55. else
  56. > _shar_wnt_.tmp
  57. echo 'x - extracting CHANGES (Text)'
  58. sed 's/^X//' << 'SHAR_EOF' > 'CHANGES' &&
  59. The following changes have been made to this directory since R3:
  60. X
  61. X      o    Now use Athena StripChart widget.
  62. X
  63. X      o Understands WM_DELETE_WINDOW.
  64. X
  65. X      o 3-26-92 Modified from xload to xnetload by Roger Smith,
  66. X      Sterling Software at NASA-Ames Research Center,
  67. X    Mountain View, Calif. rsmith@proteus.arc.nasa.gov
  68. SHAR_EOF
  69. chmod 0644 CHANGES ||
  70. echo 'restore of CHANGES failed'
  71. Wc_c="`wc -c < 'CHANGES'`"
  72. test 313 -eq "$Wc_c" ||
  73.     echo 'CHANGES: original size 313, current size' "$Wc_c"
  74. rm -f _shar_wnt_.tmp
  75. fi
  76. # ============= Imakefile ==============
  77. if test -f 'Imakefile' -a X"$1" != X"-c"; then
  78.     echo 'x - skipping Imakefile (File already exists)'
  79.     rm -f _shar_wnt_.tmp
  80. else
  81. > _shar_wnt_.tmp
  82. echo 'x - extracting Imakefile (Text)'
  83. sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
  84. X        DEPLIBS = XawClientDepLibs
  85. LOCAL_LIBRARIES = XawClientLibs
  86. X           SRCS = xload.c get_load.c display.c rpc_stuff.c ether_clnt.c ether_xdr.c
  87. X           OBJS = xload.o get_load.o display.o rpc_stuff.o ether_clnt.o ether_xdr.o
  88. X
  89. AllTarget(xnetload)
  90. NormalProgramTarget(xnetload,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES), /**/)
  91. InstallProgramWithFlags(xnetload, $(BINDIR), $(INSTKMEMFLAGS))
  92. InstallManPage(xnetload,$(MANDIR))
  93. X
  94. InstallAppDefaults(XNetload)
  95. X
  96. DependTarget()
  97. X
  98. CCxnetload:   $(SRCS)
  99. X    #load $(CFLAGS) $(SRCS) $(DEPLIBS) $(LDOPTIONS)  $(LOCAL_LIBRARIES) $(LDLIBS) $(LOCAL_X_LIBRARIES) $(EXTRA_LOAD_FLAGS)
  100. X    #link
  101. SHAR_EOF
  102. chmod 0644 Imakefile ||
  103. echo 'restore of Imakefile failed'
  104. Wc_c="`wc -c < 'Imakefile'`"
  105. test 624 -eq "$Wc_c" ||
  106.     echo 'Imakefile: original size 624, current size' "$Wc_c"
  107. rm -f _shar_wnt_.tmp
  108. fi
  109. # ============= Makefile ==============
  110. if test -f 'Makefile' -a X"$1" != X"-c"; then
  111.     echo 'x - skipping Makefile (File already exists)'
  112.     rm -f _shar_wnt_.tmp
  113. else
  114. > _shar_wnt_.tmp
  115. echo 'x - extracting Makefile (Text)'
  116. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  117. # Makefile generated by imake - do not edit!
  118. # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  119. #
  120. # The cpp used on this machine replaces all newlines and multiple tabs and
  121. # spaces in a macro expansion with a single space.  Imake tries to compensate
  122. # for this, but is not always successful.
  123. #
  124. X
  125. # -------------------------------------------------------------------------
  126. # Makefile generated from "Imake.tmpl" and <Imakefile>
  127. # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  128. #
  129. # Platform-specific parameters may be set in the appropriate <vendor>.cf
  130. # configuration files.  Site-specific parameters should be set in the file
  131. # site.def.  Full rebuilds are recommended if any parameters are changed.
  132. #
  133. # If your C preprocessor does not define any unique symbols, you will need
  134. # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  135. # "make World" the first time).
  136. #
  137. X
  138. # -------------------------------------------------------------------------
  139. # site-specific configuration parameters that need to come before
  140. # the platform-specific parameters - edit site.def to change
  141. X
  142. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  143. X
  144. # -------------------------------------------------------------------------
  145. # platform-specific configuration parameters - edit sun.cf to change
  146. X
  147. # platform:  $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
  148. X
  149. # operating system:  SunOS 4.1.1
  150. X
  151. # $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
  152. X
  153. # -------------------------------------------------------------------------
  154. # site-specific configuration parameters that go after
  155. # the platform-specific parameters - edit site.def to change
  156. X
  157. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  158. X
  159. X            SHELL = /bin/sh
  160. X
  161. X              TOP = .
  162. X      CURRENT_DIR = .
  163. X
  164. X               AR = ar clq
  165. X  BOOTSTRAPCFLAGS =
  166. X               CC = cc
  167. X               AS = as
  168. X
  169. X         COMPRESS = compress
  170. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  171. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  172. X          INSTALL = install
  173. X               LD = ld
  174. X             LINT = lint
  175. X      LINTLIBFLAG = -C
  176. X         LINTOPTS = -axz
  177. X               LN = ln -s
  178. X             MAKE = make
  179. X               MV = mv
  180. X               CP = cp
  181. X
  182. X           RANLIB = ranlib
  183. X  RANLIBINSTFLAGS =
  184. X
  185. X               RM = rm -f
  186. X            TROFF = psroff
  187. X         MSMACROS = -ms
  188. X              TBL = tbl
  189. X              EQN = eqn
  190. X     STD_INCLUDES =
  191. X  STD_CPP_DEFINES =
  192. X      STD_DEFINES =
  193. X EXTRA_LOAD_FLAGS =
  194. X  EXTRA_LIBRARIES =
  195. X             TAGS = ctags
  196. X
  197. X    SHAREDCODEDEF = -DSHAREDCODE
  198. X         SHLIBDEF = -DSUNSHLIB
  199. X
  200. X    PROTO_DEFINES =
  201. X
  202. X     INSTPGMFLAGS =
  203. X
  204. X     INSTBINFLAGS = -m 0755
  205. X     INSTUIDFLAGS = -m 4755
  206. X     INSTLIBFLAGS = -m 0644
  207. X     INSTINCFLAGS = -m 0444
  208. X     INSTMANFLAGS = -m 0444
  209. X     INSTDATFLAGS = -m 0444
  210. X    INSTKMEMFLAGS = -m 4755
  211. X
  212. X      PROJECTROOT = /usr/X11/R5
  213. X
  214. X     TOP_INCLUDES = -I$(INCROOT)
  215. X
  216. X      CDEBUGFLAGS = -O
  217. X        CCOPTIONS = -pipe
  218. X
  219. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  220. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  221. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  222. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  223. X
  224. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  225. X
  226. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  227. X
  228. X   LDCOMBINEFLAGS = -X -r
  229. X      DEPENDFLAGS =
  230. X
  231. X        MACROFILE = sun.cf
  232. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  233. X
  234. X    IMAKE_DEFINES =
  235. X
  236. X         IRULESRC = $(CONFIGDIR)
  237. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  238. X
  239. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  240. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  241. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  242. X
  243. # -------------------------------------------------------------------------
  244. # X Window System Build Parameters
  245. # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  246. X
  247. # -------------------------------------------------------------------------
  248. # X Window System make variables; this need to be coordinated with rules
  249. X
  250. X          PATHSEP = /
  251. X        USRLIBDIR = /usr/X11/R5/lib
  252. X           BINDIR = /usr/X11/R5/bin
  253. X          INCROOT = /usr/X11/R5/include
  254. X     BUILDINCROOT = $(TOP)
  255. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  256. X      BUILDINCTOP = ..
  257. X           INCDIR = $(INCROOT)/X11
  258. X           ADMDIR = /usr/adm
  259. X           LIBDIR = $(USRLIBDIR)/X11
  260. X        CONFIGDIR = $(LIBDIR)/config
  261. X       LINTLIBDIR = $(USRLIBDIR)/lint
  262. X
  263. X          FONTDIR = $(LIBDIR)/fonts
  264. X         XINITDIR = $(LIBDIR)/xinit
  265. X           XDMDIR = $(LIBDIR)/xdm
  266. X           TWMDIR = $(LIBDIR)/twm
  267. X          MANPATH = /usr/X11/R5/man
  268. X    MANSOURCEPATH = $(MANPATH)/man
  269. X        MANSUFFIX = n
  270. X     LIBMANSUFFIX = 3
  271. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  272. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  273. X           NLSDIR = $(LIBDIR)/nls
  274. X        PEXAPIDIR = $(LIBDIR)/PEX
  275. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  276. X       FONTCFLAGS = -t
  277. X
  278. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  279. X
  280. X            IMAKE = imake
  281. X           DEPEND = makedepend
  282. X              RGB = rgb
  283. X
  284. X            FONTC = bdftopcf
  285. X
  286. X        MKFONTDIR = mkfontdir
  287. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  288. X
  289. X        CONFIGSRC = $(TOP)/config
  290. X       DOCUTILSRC = $(TOP)/doc/util
  291. X        CLIENTSRC = $(TOP)/clients
  292. X          DEMOSRC = $(TOP)/demos
  293. X           LIBSRC = $(TOP)/lib
  294. X          FONTSRC = $(TOP)/fonts
  295. X       INCLUDESRC = $(TOP)/X11
  296. X        SERVERSRC = $(TOP)/server
  297. X          UTILSRC = $(TOP)/util
  298. X        SCRIPTSRC = $(UTILSRC)/scripts
  299. X       EXAMPLESRC = $(TOP)/examples
  300. X       CONTRIBSRC = $(TOP)/../contrib
  301. X           DOCSRC = $(TOP)/doc
  302. X           RGBSRC = $(TOP)/rgb
  303. X        DEPENDSRC = $(UTILSRC)/makedepend
  304. X         IMAKESRC = $(CONFIGSRC)
  305. X         XAUTHSRC = $(LIBSRC)/Xau
  306. X          XLIBSRC = $(LIBSRC)/X
  307. X           XMUSRC = $(LIBSRC)/Xmu
  308. X       TOOLKITSRC = $(LIBSRC)/Xt
  309. X       AWIDGETSRC = $(LIBSRC)/Xaw
  310. X       OLDXLIBSRC = $(LIBSRC)/oldX
  311. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  312. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  313. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  314. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  315. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  316. X         FSLIBSRC = $(FONTSRC)/lib/fs
  317. X    FONTSERVERSRC = $(FONTSRC)/server
  318. X     EXTENSIONSRC = $(TOP)/extensions
  319. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  320. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  321. X
  322. # $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
  323. X
  324. SHLIBLDFLAGS = -assert pure-text
  325. PICFLAGS = -pic
  326. X
  327. X  DEPEXTENSIONLIB =
  328. X     EXTENSIONLIB = -lXext
  329. X
  330. X          DEPXLIB = $(DEPEXTENSIONLIB)
  331. X             XLIB = $(EXTENSIONLIB) -lX11
  332. X
  333. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  334. X           XMULIB = -lXmu
  335. X
  336. X       DEPOLDXLIB =
  337. X          OLDXLIB = -loldX
  338. X
  339. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  340. X         XTOOLLIB = -lXt
  341. X
  342. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  343. X           XAWLIB = -lXaw
  344. X
  345. X        DEPXILIB =
  346. X           XILIB = -lXi
  347. X
  348. X        SOXLIBREV = 4.10
  349. X          SOXTREV = 4.10
  350. X         SOXAWREV = 5.0
  351. X        SOOLDXREV = 4.10
  352. X         SOXMUREV = 4.10
  353. X        SOXEXTREV = 4.10
  354. X      SOXINPUTREV = 4.10
  355. X
  356. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  357. X         XAUTHLIB =  -lXau
  358. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  359. X         XDMCPLIB =  -lXdmcp
  360. X
  361. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  362. X           PHIGSLIB =  -lphigs
  363. X
  364. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  365. X          XBSDLIB =  -lXbsd
  366. X
  367. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  368. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  369. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  370. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  371. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  372. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  373. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  374. X
  375. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  376. X
  377. X         DEPLIBS1 = $(DEPLIBS)
  378. X         DEPLIBS2 = $(DEPLIBS)
  379. X         DEPLIBS3 = $(DEPLIBS)
  380. X
  381. # -------------------------------------------------------------------------
  382. # Imake rules for building libraries, programs, scripts, and data files
  383. # rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  384. X
  385. # -------------------------------------------------------------------------
  386. # start of Imakefile
  387. X
  388. X        DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  389. LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  390. X           SRCS = xload.c get_load.c display.c rpc_stuff.c ether_clnt.c ether_xdr.c
  391. X           OBJS = xload.o get_load.o display.o rpc_stuff.o ether_clnt.o ether_xdr.o
  392. X
  393. all:: xnetload
  394. X
  395. xnetload: $(OBJS) $(DEPLIBS)
  396. X    $(RM) $@
  397. X    $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
  398. X
  399. clean::
  400. X    $(RM) xnetload
  401. X
  402. install:: xnetload
  403. X    @if [ -d $(DESTDIR) $(BINDIR) ]; then set +x; \
  404. X    else (set -x; $(MKDIRHIER) $(DESTDIR) $(BINDIR)); fi
  405. X    $(INSTALL) -c $(INSTPGMFLAGS)  $(INSTKMEMFLAGS) xnetload $(DESTDIR) $(BINDIR)
  406. X
  407. install.man:: xnetload.man
  408. X    @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  409. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  410. X    $(INSTALL) -c $(INSTMANFLAGS) xnetload.man $(DESTDIR)$(MANDIR)/xnetload.$(MANSUFFIX)
  411. X
  412. install:: XNetload.ad
  413. X    @if [ -d $(DESTDIR)$(XAPPLOADDIR) ]; then set +x; \
  414. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(XAPPLOADDIR)); fi
  415. X    $(INSTALL) -c $(INSTAPPFLAGS) XNetload.ad $(DESTDIR)$(XAPPLOADDIR)/XNetload
  416. X
  417. depend::
  418. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  419. X
  420. CCxnetload:   $(SRCS)
  421. X    #load $(CFLAGS) $(SRCS) $(DEPLIBS) $(LDOPTIONS)  $(LOCAL_LIBRARIES) $(LDLIBS) $(LOCAL_X_LIBRARIES) $(EXTRA_LOAD_FLAGS)
  422. X    #link
  423. X
  424. # -------------------------------------------------------------------------
  425. # common rules for all Makefiles - do not edit
  426. X
  427. emptyrule::
  428. X
  429. clean::
  430. X    $(RM_CMD) "#"*
  431. X
  432. Makefile::
  433. X    -@if [ -f Makefile ]; then set -x; \
  434. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  435. X    else exit 0; fi
  436. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  437. X
  438. tags::
  439. X    $(TAGS) -w *.[ch]
  440. X    $(TAGS) -xw *.[ch] > TAGS
  441. X
  442. saber:
  443. X    # load $(ALLDEFINES) $(SRCS)
  444. X
  445. osaber:
  446. X    # load $(ALLDEFINES) $(OBJS)
  447. X
  448. # -------------------------------------------------------------------------
  449. # empty rules for directories that do not have SUBDIRS - do not edit
  450. X
  451. install::
  452. X    @echo "install in $(CURRENT_DIR) done"
  453. X
  454. install.man::
  455. X    @echo "install.man in $(CURRENT_DIR) done"
  456. X
  457. Makefiles::
  458. X
  459. includes::
  460. X
  461. # -------------------------------------------------------------------------
  462. # dependencies generated by makedepend
  463. X
  464. SHAR_EOF
  465. chmod 0644 Makefile ||
  466. echo 'restore of Makefile failed'
  467. Wc_c="`wc -c < 'Makefile'`"
  468. test 10573 -eq "$Wc_c" ||
  469.     echo 'Makefile: original size 10573, current size' "$Wc_c"
  470. rm -f _shar_wnt_.tmp
  471. fi
  472. # ============= XNetload.ad ==============
  473. if test -f 'XNetload.ad' -a X"$1" != X"-c"; then
  474.     echo 'x - skipping XNetload.ad (File already exists)'
  475.     rm -f _shar_wnt_.tmp
  476. else
  477. > _shar_wnt_.tmp
  478. echo 'x - extracting XNetload.ad (Text)'
  479. sed 's/^X//' << 'SHAR_EOF' > 'XNetload.ad' &&
  480. XXNetload.input:                false
  481. XXNetload*Label*Justify:            left
  482. *label.label:                "Ethernet Load %"
  483. *JumpScroll:                1
  484. *minScale:                10
  485. XXNetload*internalBorderWidth:        0
  486. XXNetload*showGrip:            FALSE
  487. X
  488. SHAR_EOF
  489. chmod 0644 XNetload.ad ||
  490. echo 'restore of XNetload.ad failed'
  491. Wc_c="`wc -c < 'XNetload.ad'`"
  492. test 187 -eq "$Wc_c" ||
  493.     echo 'XNetload.ad: original size 187, current size' "$Wc_c"
  494. rm -f _shar_wnt_.tmp
  495. fi
  496. # ============= display.c ==============
  497. if test -f 'display.c' -a X"$1" != X"-c"; then
  498.     echo 'x - skipping display.c (File already exists)'
  499.     rm -f _shar_wnt_.tmp
  500. else
  501. > _shar_wnt_.tmp
  502. echo 'x - extracting display.c (Text)'
  503. sed 's/^X//' << 'SHAR_EOF' > 'display.c' &&
  504. /*
  505. X * display.c
  506. X *
  507. X *
  508. X */
  509. #include <stdio.h>
  510. #include <signal.h>    
  511. #include <X11/Xlib.h>
  512. #include <X11/Xatom.h>
  513. #include "misc.h"
  514. X
  515. #define STR_LEN (256)
  516. X
  517. static char HostName[STR_LEN];
  518. static int IntervalVal = 0;
  519. static int IntervalChanged = TRUE;
  520. X
  521. void SetHost( host )
  522. char *host;
  523. {
  524. X    strncpy( HostName, host, STR_LEN );
  525. }
  526. X
  527. void SetInterval( inter )
  528. int inter;
  529. {
  530. X    IntervalVal = inter;
  531. }
  532. SHAR_EOF
  533. chmod 0644 display.c ||
  534. echo 'restore of display.c failed'
  535. Wc_c="`wc -c < 'display.c'`"
  536. test 386 -eq "$Wc_c" ||
  537.     echo 'display.c: original size 386, current size' "$Wc_c"
  538. rm -f _shar_wnt_.tmp
  539. fi
  540. # ============= ether.h ==============
  541. if test -f 'ether.h' -a X"$1" != X"-c"; then
  542.     echo 'x - skipping ether.h (File already exists)'
  543.     rm -f _shar_wnt_.tmp
  544. else
  545. > _shar_wnt_.tmp
  546. echo 'x - extracting ether.h (Text)'
  547. sed 's/^X//' << 'SHAR_EOF' > 'ether.h' &&
  548. /*
  549. X * Please do not edit this file.
  550. X * It was generated using rpcgen.
  551. X */
  552. X
  553. #include <rpc/types.h>
  554. X
  555. #define NBUCKETS 16
  556. #define NPROTOS 6
  557. #define HASHSIZE 256
  558. X
  559. struct ethertimeval {
  560. X    u_int tv_seconds;
  561. X    u_int tv_useconds;
  562. };
  563. typedef struct ethertimeval ethertimeval;
  564. bool_t xdr_ethertimeval();
  565. X
  566. struct etherstat {
  567. X    ethertimeval e_time;
  568. X    u_int e_bytes;
  569. X    u_int e_packets;
  570. X    u_int e_bcast;
  571. X    u_int e_size[NBUCKETS];
  572. X    u_int e_proto[NPROTOS];
  573. };
  574. typedef struct etherstat etherstat;
  575. bool_t xdr_etherstat();
  576. X
  577. struct etherhmem_node {
  578. X    int h_addr;
  579. X    u_int h_cnt;
  580. X    struct etherhmem_node *h_nxt;
  581. };
  582. typedef struct etherhmem_node etherhmem_node;
  583. bool_t xdr_etherhmem_node();
  584. X
  585. typedef etherhmem_node *etherhmem;
  586. bool_t xdr_etherhmem();
  587. X
  588. struct etheraddrs {
  589. X    ethertimeval e_time;
  590. X    u_int e_bytes;
  591. X    u_int e_packets;
  592. X    u_int e_bcast;
  593. X    etherhmem e_addrs[HASHSIZE];
  594. };
  595. typedef struct etheraddrs etheraddrs;
  596. bool_t xdr_etheraddrs();
  597. X
  598. struct addrmask {
  599. X    int a_addr;
  600. X    int a_mask;
  601. };
  602. typedef struct addrmask addrmask;
  603. bool_t xdr_addrmask();
  604. X
  605. #define ETHERPROG ((u_long)100010)
  606. #define ETHERVERS ((u_long)1)
  607. #define ETHERPROC_GETDATA ((u_long)1)
  608. extern etherstat *etherproc_getdata_1();
  609. #define ETHERPROC_ON ((u_long)2)
  610. extern void *etherproc_on_1();
  611. #define ETHERPROC_OFF ((u_long)3)
  612. extern void *etherproc_off_1();
  613. #define ETHERPROC_GETSRCDATA ((u_long)4)
  614. extern etheraddrs *etherproc_getsrcdata_1();
  615. #define ETHERPROC_GETDSTDATA ((u_long)5)
  616. extern etheraddrs *etherproc_getdstdata_1();
  617. #define ETHERPROC_SELECTSRC ((u_long)6)
  618. extern void *etherproc_selectsrc_1();
  619. #define ETHERPROC_SELECTDST ((u_long)7)
  620. extern void *etherproc_selectdst_1();
  621. #define ETHERPROC_SELECTPROTO ((u_long)8)
  622. extern void *etherproc_selectproto_1();
  623. #define ETHERPROC_SELECTLNTH ((u_long)9)
  624. extern void *etherproc_selectlnth_1();
  625. SHAR_EOF
  626. chmod 0644 ether.h ||
  627. echo 'restore of ether.h failed'
  628. Wc_c="`wc -c < 'ether.h'`"
  629. test 1777 -eq "$Wc_c" ||
  630.     echo 'ether.h: original size 1777, current size' "$Wc_c"
  631. rm -f _shar_wnt_.tmp
  632. fi
  633. # ============= ether_clnt.c ==============
  634. if test -f 'ether_clnt.c' -a X"$1" != X"-c"; then
  635.     echo 'x - skipping ether_clnt.c (File already exists)'
  636.     rm -f _shar_wnt_.tmp
  637. else
  638. > _shar_wnt_.tmp
  639. echo 'x - extracting ether_clnt.c (Text)'
  640. sed 's/^X//' << 'SHAR_EOF' > 'ether_clnt.c' &&
  641. /*
  642. X * Please do not edit this file.
  643. X * It was generated using rpcgen.
  644. X */
  645. X
  646. #include <rpc/rpc.h>
  647. #include "ether.h"
  648. X
  649. /* Default timeout can be changed using clnt_control() */
  650. static struct timeval TIMEOUT = { 25, 0 };
  651. X
  652. etherstat *
  653. etherproc_getdata_1(argp, clnt)
  654. X    void *argp;
  655. X    CLIENT *clnt;
  656. {
  657. X    static etherstat res;
  658. X
  659. X    bzero((char *)&res, sizeof(res));
  660. X    if (clnt_call(clnt, ETHERPROC_GETDATA, xdr_void, argp, xdr_etherstat, &res, TIMEOUT) != RPC_SUCCESS) {
  661. X        return (NULL);
  662. X    }
  663. X    return (&res);
  664. }
  665. X
  666. void *
  667. etherproc_on_1(argp, clnt)
  668. X    void *argp;
  669. X    CLIENT *clnt;
  670. {
  671. X    static char res;
  672. X
  673. X    bzero((char *)&res, sizeof(res));
  674. X    if (clnt_call(clnt, ETHERPROC_ON, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  675. X        return (NULL);
  676. X    }
  677. X    return ((void *)&res);
  678. }
  679. X
  680. void *
  681. etherproc_off_1(argp, clnt)
  682. X    void *argp;
  683. X    CLIENT *clnt;
  684. {
  685. X    static char res;
  686. X
  687. X    bzero((char *)&res, sizeof(res));
  688. X    if (clnt_call(clnt, ETHERPROC_OFF, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  689. X        return (NULL);
  690. X    }
  691. X    return ((void *)&res);
  692. }
  693. X
  694. etheraddrs *
  695. etherproc_getsrcdata_1(argp, clnt)
  696. X    void *argp;
  697. X    CLIENT *clnt;
  698. {
  699. X    static etheraddrs res;
  700. X
  701. X    bzero((char *)&res, sizeof(res));
  702. X    if (clnt_call(clnt, ETHERPROC_GETSRCDATA, xdr_void, argp, xdr_etheraddrs, &res, TIMEOUT) != RPC_SUCCESS) {
  703. X        return (NULL);
  704. X    }
  705. X    return (&res);
  706. }
  707. X
  708. etheraddrs *
  709. etherproc_getdstdata_1(argp, clnt)
  710. X    void *argp;
  711. X    CLIENT *clnt;
  712. {
  713. X    static etheraddrs res;
  714. X
  715. X    bzero((char *)&res, sizeof(res));
  716. X    if (clnt_call(clnt, ETHERPROC_GETDSTDATA, xdr_void, argp, xdr_etheraddrs, &res, TIMEOUT) != RPC_SUCCESS) {
  717. X        return (NULL);
  718. X    }
  719. X    return (&res);
  720. }
  721. X
  722. void *
  723. etherproc_selectsrc_1(argp, clnt)
  724. X    addrmask *argp;
  725. X    CLIENT *clnt;
  726. {
  727. X    static char res;
  728. X
  729. X    bzero((char *)&res, sizeof(res));
  730. X    if (clnt_call(clnt, ETHERPROC_SELECTSRC, xdr_addrmask, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  731. X        return (NULL);
  732. X    }
  733. X    return ((void *)&res);
  734. }
  735. X
  736. void *
  737. etherproc_selectdst_1(argp, clnt)
  738. X    addrmask *argp;
  739. X    CLIENT *clnt;
  740. {
  741. X    static char res;
  742. X
  743. X    bzero((char *)&res, sizeof(res));
  744. X    if (clnt_call(clnt, ETHERPROC_SELECTDST, xdr_addrmask, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  745. X        return (NULL);
  746. X    }
  747. X    return ((void *)&res);
  748. }
  749. X
  750. void *
  751. etherproc_selectproto_1(argp, clnt)
  752. X    addrmask *argp;
  753. X    CLIENT *clnt;
  754. {
  755. X    static char res;
  756. X
  757. X    bzero((char *)&res, sizeof(res));
  758. X    if (clnt_call(clnt, ETHERPROC_SELECTPROTO, xdr_addrmask, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  759. X        return (NULL);
  760. X    }
  761. X    return ((void *)&res);
  762. }
  763. X
  764. void *
  765. etherproc_selectlnth_1(argp, clnt)
  766. X    addrmask *argp;
  767. X    CLIENT *clnt;
  768. {
  769. X    static char res;
  770. X
  771. X    bzero((char *)&res, sizeof(res));
  772. X    if (clnt_call(clnt, ETHERPROC_SELECTLNTH, xdr_addrmask, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  773. X        return (NULL);
  774. X    }
  775. X    return ((void *)&res);
  776. }
  777. SHAR_EOF
  778. chmod 0644 ether_clnt.c ||
  779. echo 'restore of ether_clnt.c failed'
  780. Wc_c="`wc -c < 'ether_clnt.c'`"
  781. test 2713 -eq "$Wc_c" ||
  782.     echo 'ether_clnt.c: original size 2713, current size' "$Wc_c"
  783. rm -f _shar_wnt_.tmp
  784. fi
  785. # ============= ether_xdr.c ==============
  786. if test -f 'ether_xdr.c' -a X"$1" != X"-c"; then
  787.     echo 'x - skipping ether_xdr.c (File already exists)'
  788.     rm -f _shar_wnt_.tmp
  789. else
  790. > _shar_wnt_.tmp
  791. echo 'x - extracting ether_xdr.c (Text)'
  792. sed 's/^X//' << 'SHAR_EOF' > 'ether_xdr.c' &&
  793. /*
  794. X * Please do not edit this file.
  795. X * It was generated using rpcgen.
  796. X */
  797. X
  798. #include <rpc/rpc.h>
  799. #include "ether.h"
  800. X
  801. bool_t
  802. xdr_ethertimeval(xdrs, objp)
  803. X    XDR *xdrs;
  804. X    ethertimeval *objp;
  805. {
  806. X    if (!xdr_u_int(xdrs, &objp->tv_seconds)) {
  807. X        return (FALSE);
  808. X    }
  809. X    if (!xdr_u_int(xdrs, &objp->tv_useconds)) {
  810. X        return (FALSE);
  811. X    }
  812. X    return (TRUE);
  813. }
  814. X
  815. bool_t
  816. xdr_etherstat(xdrs, objp)
  817. X    XDR *xdrs;
  818. X    etherstat *objp;
  819. {
  820. X    if (!xdr_ethertimeval(xdrs, &objp->e_time)) {
  821. X        return (FALSE);
  822. X    }
  823. X    if (!xdr_u_int(xdrs, &objp->e_bytes)) {
  824. X        return (FALSE);
  825. X    }
  826. X    if (!xdr_u_int(xdrs, &objp->e_packets)) {
  827. X        return (FALSE);
  828. X    }
  829. X    if (!xdr_u_int(xdrs, &objp->e_bcast)) {
  830. X        return (FALSE);
  831. X    }
  832. X    if (!xdr_vector(xdrs, (char *)objp->e_size, NBUCKETS, sizeof(u_int), xdr_u_int)) {
  833. X        return (FALSE);
  834. X    }
  835. X    if (!xdr_vector(xdrs, (char *)objp->e_proto, NPROTOS, sizeof(u_int), xdr_u_int)) {
  836. X        return (FALSE);
  837. X    }
  838. X    return (TRUE);
  839. }
  840. X
  841. bool_t
  842. xdr_etherhmem_node(xdrs, objp)
  843. X    XDR *xdrs;
  844. X    etherhmem_node *objp;
  845. {
  846. X    if (!xdr_int(xdrs, &objp->h_addr)) {
  847. X        return (FALSE);
  848. X    }
  849. X    if (!xdr_u_int(xdrs, &objp->h_cnt)) {
  850. X        return (FALSE);
  851. X    }
  852. X    if (!xdr_pointer(xdrs, (char **)&objp->h_nxt, sizeof(etherhmem_node), xdr_etherhmem_node)) {
  853. X        return (FALSE);
  854. X    }
  855. X    return (TRUE);
  856. }
  857. X
  858. bool_t
  859. xdr_etherhmem(xdrs, objp)
  860. X    XDR *xdrs;
  861. X    etherhmem *objp;
  862. {
  863. X    if (!xdr_pointer(xdrs, (char **)objp, sizeof(etherhmem_node), xdr_etherhmem_node)) {
  864. X        return (FALSE);
  865. X    }
  866. X    return (TRUE);
  867. }
  868. X
  869. bool_t
  870. xdr_etheraddrs(xdrs, objp)
  871. X    XDR *xdrs;
  872. X    etheraddrs *objp;
  873. {
  874. X    if (!xdr_ethertimeval(xdrs, &objp->e_time)) {
  875. X        return (FALSE);
  876. X    }
  877. X    if (!xdr_u_int(xdrs, &objp->e_bytes)) {
  878. X        return (FALSE);
  879. X    }
  880. X    if (!xdr_u_int(xdrs, &objp->e_packets)) {
  881. X        return (FALSE);
  882. X    }
  883. X    if (!xdr_u_int(xdrs, &objp->e_bcast)) {
  884. X        return (FALSE);
  885. X    }
  886. X    if (!xdr_vector(xdrs, (char *)objp->e_addrs, HASHSIZE, sizeof(etherhmem), xdr_etherhmem)) {
  887. X        return (FALSE);
  888. X    }
  889. X    return (TRUE);
  890. }
  891. X
  892. bool_t
  893. xdr_addrmask(xdrs, objp)
  894. X    XDR *xdrs;
  895. X    addrmask *objp;
  896. {
  897. X    if (!xdr_int(xdrs, &objp->a_addr)) {
  898. X        return (FALSE);
  899. X    }
  900. X    if (!xdr_int(xdrs, &objp->a_mask)) {
  901. X        return (FALSE);
  902. X    }
  903. X    return (TRUE);
  904. }
  905. SHAR_EOF
  906. chmod 0644 ether_xdr.c ||
  907. echo 'restore of ether_xdr.c failed'
  908. Wc_c="`wc -c < 'ether_xdr.c'`"
  909. test 2061 -eq "$Wc_c" ||
  910.     echo 'ether_xdr.c: original size 2061, current size' "$Wc_c"
  911. rm -f _shar_wnt_.tmp
  912. fi
  913. # ============= get_load.c ==============
  914. if test -f 'get_load.c' -a X"$1" != X"-c"; then
  915.     echo 'x - skipping get_load.c (File already exists)'
  916.     rm -f _shar_wnt_.tmp
  917. else
  918. > _shar_wnt_.tmp
  919. echo 'x - extracting get_load.c (Text)'
  920. sed 's/^X//' << 'SHAR_EOF' > 'get_load.c' &&
  921. #include <stdio.h>
  922. #include <X11/Xos.h>
  923. #include <X11/Intrinsic.h>
  924. X
  925. extern float GetNetLoad();
  926. extern int   GetStatData();
  927. /* ARGSUSED */
  928. void 
  929. GetLoadPoint( w, closure, call_data )
  930. Widget    w;        /* unused */
  931. XXtPointer closure;    /* unused */
  932. XXtPointer call_data;    /* pointer to (double) return value */
  933. {
  934. X    double *loadavg = (double *)call_data;
  935. X    long    temp;
  936. X    float load;
  937. X    int i;
  938. X
  939. X    i = GetStatData();
  940. X    if ( i == 0 ) return;
  941. X    load = (float)GetNetLoad();
  942. X    *loadavg = (double)load;
  943. }
  944. X
  945. static xload_error(str1, str2)
  946. char *str1, *str2;
  947. {
  948. X    (void) fprintf(stderr,"xload: %s %s\n", str1, str2);
  949. X    exit(-1);
  950. }
  951. X
  952. SHAR_EOF
  953. chmod 0644 get_load.c ||
  954. echo 'restore of get_load.c failed'
  955. Wc_c="`wc -c < 'get_load.c'`"
  956. test 625 -eq "$Wc_c" ||
  957.     echo 'get_load.c: original size 625, current size' "$Wc_c"
  958. rm -f _shar_wnt_.tmp
  959. fi
  960. # ============= misc.h ==============
  961. if test -f 'misc.h' -a X"$1" != X"-c"; then
  962.     echo 'x - skipping misc.h (File already exists)'
  963.     rm -f _shar_wnt_.tmp
  964. else
  965. > _shar_wnt_.tmp
  966. echo 'x - extracting misc.h (Text)'
  967. sed 's/^X//' << 'SHAR_EOF' > 'misc.h' &&
  968. #ifndef _MISC_H
  969. #define _MISC_H
  970. /*
  971. X * misc.h
  972. X *
  973. X */
  974. X
  975. #define TRUE        (1)
  976. #define FALSE        (0)
  977. X
  978. #define MWIN_W        (400)
  979. #define MWIN_H        (50)
  980. X
  981. X
  982. #endif _MISC_H
  983. X
  984. SHAR_EOF
  985. chmod 0644 misc.h ||
  986. echo 'restore of misc.h failed'
  987. Wc_c="`wc -c < 'misc.h'`"
  988. test 152 -eq "$Wc_c" ||
  989.     echo 'misc.h: original size 152, current size' "$Wc_c"
  990. rm -f _shar_wnt_.tmp
  991. fi
  992. # ============= rpc_stuff.c ==============
  993. if test -f 'rpc_stuff.c' -a X"$1" != X"-c"; then
  994.     echo 'x - skipping rpc_stuff.c (File already exists)'
  995.     rm -f _shar_wnt_.tmp
  996. else
  997. > _shar_wnt_.tmp
  998. echo 'x - extracting rpc_stuff.c (Text)'
  999. sed 's/^X//' << 'SHAR_EOF' > 'rpc_stuff.c' &&
  1000. /*
  1001. X *
  1002. X *
  1003. X *
  1004. X *
  1005. X */
  1006. #include <stdio.h>
  1007. #include <rpc/rpc.h>
  1008. #include "ether.h"
  1009. X
  1010. #define NDPROTO 0
  1011. #define ICMPPROTO 1
  1012. #define UDPPROTO 2
  1013. #define TCPPROTO 3
  1014. #define ARPPROTO 4
  1015. #define OTHERPROTO 5
  1016. X
  1017. X
  1018. static CLIENT *Client;
  1019. static etherstat PrevStatData = { { 0, 0 }, 0, 0, 0,
  1020. X                  { 0, 0, 0, 0, 0, 0, 0, 0, 
  1021. X                    0, 0, 0, 0, 0, 0, 0, 0 },
  1022. X                  { 0, 0, 0, 0, 0, 0 } };
  1023. static etherstat *StatData = NULL;
  1024. static double TimeDelta = 1.0;
  1025. X
  1026. void InitRPC( host )
  1027. char *host;
  1028. {
  1029. X
  1030. X    Client = clnt_create( host, ETHERPROG, ETHERVERS, "udp" );
  1031. X
  1032. X    if( Client == NULL ) {
  1033. X        fprintf( stderr, "xtr: Could not create connection to " );
  1034. X        fprintf( stderr, "'%s'\n", host );
  1035. X        exit( 1 );
  1036. X    }
  1037. }
  1038. X
  1039. void TurnOnEther()
  1040. {
  1041. X    int dummy;
  1042. X
  1043. X    etherproc_on_1( &dummy, Client );
  1044. }
  1045. X
  1046. void TurnOffEther()
  1047. {
  1048. X    int dummy;
  1049. X
  1050. X    etherproc_off_1( &dummy, Client );
  1051. }
  1052. int GetStatData()
  1053. {
  1054. X        int dummy;
  1055. X    double start_secs, stop_secs;
  1056. X
  1057. X        if( StatData != NULL ) {
  1058. X                PrevStatData = *StatData;
  1059. X        }
  1060. X
  1061. X        if ((StatData = etherproc_getdata_1( &dummy, Client )) == 0) return ( 0 );
  1062. X    gettimeofday(&StatData->e_time, (struct timezone *) 0);
  1063. X    start_secs = (double)PrevStatData.e_time.tv_seconds + 
  1064. X                 (double)PrevStatData.e_time.tv_useconds/1000000.0;
  1065. X    stop_secs = (double)StatData->e_time.tv_seconds + 
  1066. X                (double)StatData->e_time.tv_useconds/1000000.0;
  1067. X        TimeDelta = stop_secs - start_secs;
  1068. X
  1069. X        if( TimeDelta <= 0 ) {
  1070. X                TimeDelta = 1.0;
  1071. X        }
  1072. X    return ( 1 );
  1073. }
  1074. X
  1075. float GetNetLoad()
  1076. {
  1077. X    long bits;
  1078. X    int delta;
  1079. X    float nload;
  1080. X    static short firstTime=1;
  1081. X
  1082. X    if (firstTime){
  1083. X        PrevStatData = *StatData;
  1084. X        firstTime=0;
  1085. X    }
  1086. X    bits = (StatData->e_bytes - PrevStatData.e_bytes) * 8;
  1087. /*    delta = (StatData->e_time.tv_seconds - PrevStatData.e_time.tv_seconds);*/
  1088. X    if ( TimeDelta )
  1089. X        nload = (float)((( (double)bits / TimeDelta ) / 
  1090. X                ((double)(10 * 1024 * 1024))) * 100.0);
  1091. X    else
  1092. X        nload = 0;
  1093. X    nload /= 10.0;
  1094. X
  1095. /* occasionally a glitch comes through and we go way over 100%. the following
  1096. X   limits the output to 100%. */
  1097. X
  1098. X    if ( nload > 10.0 ) nload = 10.0;
  1099. #ifdef DEBUG
  1100. X    printf ("newbytes=%d, oldbytes=%d, deltabytes=%d, deltatime=%lf, load=%f\n", 
  1101. X        StatData->e_bytes,
  1102. X        PrevStatData.e_bytes,
  1103. X        StatData->e_bytes - PrevStatData.e_bytes,
  1104. X        TimeDelta,
  1105. X        nload);  
  1106. #endif
  1107. X    return( nload );
  1108. X
  1109. }
  1110. SHAR_EOF
  1111. chmod 0644 rpc_stuff.c ||
  1112. echo 'restore of rpc_stuff.c failed'
  1113. Wc_c="`wc -c < 'rpc_stuff.c'`"
  1114. test 2316 -eq "$Wc_c" ||
  1115.     echo 'rpc_stuff.c: original size 2316, current size' "$Wc_c"
  1116. rm -f _shar_wnt_.tmp
  1117. fi
  1118. # ============= xload.bit ==============
  1119. if test -f 'xload.bit' -a X"$1" != X"-c"; then
  1120.     echo 'x - skipping xload.bit (File already exists)'
  1121.     rm -f _shar_wnt_.tmp
  1122. else
  1123. > _shar_wnt_.tmp
  1124. echo 'x - extracting xload.bit (Text)'
  1125. sed 's/^X//' << 'SHAR_EOF' > 'xload.bit' &&
  1126. #define xload_width 32
  1127. #define xload_height 32
  1128. #define xload_x_hot 15
  1129. #define xload_y_hot 16
  1130. static char xload_bits[] = {
  1131. X   0x00, 0x00, 0xc0, 0x03, 0x1e, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf8, 0x03,
  1132. X   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x03,
  1133. X   0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0xff, 0x03, 0x00, 0xc0, 0xff, 0x03,
  1134. X   0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0x03,
  1135. X   0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0x03, 0x00, 0xf8, 0xff, 0x03,
  1136. X   0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03,
  1137. X   0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0xff, 0x03, 0x00, 0xfe, 0xff, 0x03,
  1138. X   0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03,
  1139. X   0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x03,
  1140. X   0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0x03,
  1141. X   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03};
  1142. SHAR_EOF
  1143. chmod 0644 xload.bit ||
  1144. echo 'restore of xload.bit failed'
  1145. Wc_c="`wc -c < 'xload.bit'`"
  1146. test 924 -eq "$Wc_c" ||
  1147.     echo 'xload.bit: original size 924, current size' "$Wc_c"
  1148. rm -f _shar_wnt_.tmp
  1149. fi
  1150. # ============= xload.c ==============
  1151. if test -f 'xload.c' -a X"$1" != X"-c"; then
  1152.     echo 'x - skipping xload.c (File already exists)'
  1153.     rm -f _shar_wnt_.tmp
  1154. else
  1155. > _shar_wnt_.tmp
  1156. echo 'x - extracting xload.c (Text)'
  1157. sed 's/^X//' << 'SHAR_EOF' > 'xload.c' &&
  1158. #ifndef lint
  1159. static char rcsid[] = "$XConsortium: xload.c,v 1.26 89/12/11 15:53:27 kit Exp $";
  1160. #endif /* lint */
  1161. X
  1162. #include <stdio.h> 
  1163. #include <X11/Intrinsic.h>
  1164. #include <X11/Xatom.h>
  1165. #include <X11/StringDefs.h>
  1166. #include <X11/Shell.h>
  1167. X
  1168. #include <X11/Xaw/Cardinals.h>
  1169. #include <X11/Xaw/Label.h>
  1170. #include <X11/Xaw/Paned.h>
  1171. #include <X11/Xaw/StripChart.h>
  1172. #include <X11/Xmu/SysUtil.h>
  1173. X
  1174. #include "xload.bit"
  1175. X
  1176. char *ProgramName;
  1177. X
  1178. extern void exit(), GetLoadPoint();
  1179. extern void SetHost(), SetInterval();
  1180. static void quit();
  1181. X
  1182. /*
  1183. X * Definition of the Application resources structure.
  1184. X */
  1185. X
  1186. typedef struct _XNetloadResources {
  1187. X  Boolean show_label;
  1188. } XNetloadResources;
  1189. X
  1190. /*
  1191. X * Command line options table.  Only resources are entered here...there is a
  1192. X * pass over the remaining options after XtParseCommand is let loose. 
  1193. X */
  1194. X
  1195. static XrmOptionDescRec options[] = {
  1196. {"-scale",    "*load.minScale",    XrmoptionSepArg,       NULL},
  1197. {"-update",    "*load.update",        XrmoptionSepArg,       "1"},
  1198. {"-hl",        "*load.highlight",    XrmoptionSepArg,       NULL},
  1199. {"-highlight",    "*load.highlight",    XrmoptionSepArg,       NULL},
  1200. {"-label",    "*label.label",        XrmoptionSepArg, "EtherNet Load %"},
  1201. {"-nolabel",    "*showLabel",            XrmoptionNoArg,          "False"},
  1202. {"-jumpscroll",    "*load.jumpScroll",    XrmoptionSepArg,       NULL},
  1203. };
  1204. X
  1205. /*
  1206. X * The structure containing the resource information for the
  1207. X * Xload application resources.
  1208. X */
  1209. X
  1210. #define Offset(field) (XtOffset(XNetloadResources *, field))
  1211. X
  1212. static XtResource my_resources[] = {
  1213. X  {"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean),
  1214. X     Offset(show_label), XtRImmediate, (caddr_t) TRUE},
  1215. };
  1216. X
  1217. #undef Offset
  1218. X
  1219. static XtActionsRec xload_actions[] = {
  1220. X    { "quit",    quit },
  1221. };
  1222. static Atom wm_delete_window;
  1223. X
  1224. X
  1225. /*
  1226. X * Exit with message describing command line format.
  1227. X */
  1228. X
  1229. void usage()
  1230. {
  1231. X    fprintf (stderr, "usage:  %s [-options ...]\n\n", ProgramName);
  1232. X    fprintf (stderr, "where options include:\n");
  1233. X    fprintf (stderr,
  1234. X      "    -display dpy            X server on which to display\n");
  1235. X    fprintf (stderr,
  1236. X      "    -geometry geom          size and location of window\n");
  1237. X    fprintf (stderr, 
  1238. X      "    -fn font                font to use in label\n");
  1239. X    fprintf (stderr, 
  1240. X      "    -scale number           minimum number of scale lines\n");
  1241. X    fprintf (stderr, 
  1242. X      "    -update seconds         interval between updates\n");
  1243. X    fprintf (stderr,
  1244. X      "    -label string           annotation text\n");
  1245. X    fprintf (stderr, 
  1246. X      "    -bg color               background color\n");
  1247. X    fprintf (stderr, 
  1248. X      "    -fg color               graph color\n");
  1249. X    fprintf (stderr, 
  1250. X      "    -hl color               scale and text color\n");
  1251. X    fprintf (stderr, 
  1252. X      "    -nolabel                removes the label from above the chart.\n");
  1253. X    fprintf (stderr, 
  1254. X      "    -jumpscroll value       number of pixels to scroll on overflow\n");
  1255. X    fprintf (stderr, "\n");
  1256. X    exit(1);
  1257. }
  1258. X
  1259. void main(argc, argv)
  1260. X    int argc;
  1261. X    char **argv;
  1262. {
  1263. X    char host[256], * label;
  1264. X    Widget toplevel, load, pane, label_wid, load_parent;
  1265. X    Arg args[1];
  1266. X    Pixmap icon_pixmap = None;
  1267. X    XNetloadResources resources;
  1268. X    char *targetHost = "localhost";
  1269. X    ProgramName = argv[0];
  1270. X    toplevel = XtInitialize(NULL, "XNetload", 
  1271. X                options, XtNumber(options), &argc, argv);
  1272. X      
  1273. X    XtGetApplicationResources( toplevel, (caddr_t) &resources, 
  1274. X                  my_resources, XtNumber(my_resources),
  1275. X                  NULL, (Cardinal) 0);
  1276. X    if (argc > 2) usage();
  1277. X    
  1278. X    /*
  1279. X     * This is a hack so that f.delete will do something useful in this
  1280. X     * single-window application.
  1281. X     */
  1282. X    XtAppAddActions (XtWidgetToApplicationContext(toplevel),
  1283. X             xload_actions, XtNumber(xload_actions));
  1284. X    XtOverrideTranslations(toplevel,
  1285. X            XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));
  1286. X
  1287. X    XtSetArg (args[0], XtNiconPixmap, &icon_pixmap);
  1288. X    XtGetValues(toplevel, args, ONE);
  1289. X    if (icon_pixmap == None) {
  1290. X    XtSetArg(args[0], XtNiconPixmap, 
  1291. X         XCreateBitmapFromData(XtDisplay(toplevel),
  1292. X                       XtScreen(toplevel)->root,
  1293. X                       xload_bits, xload_width, xload_height));
  1294. X    XtSetValues (toplevel, args, ONE);
  1295. X    }
  1296. X
  1297. X    if (resources.show_label) {
  1298. X      pane = XtCreateManagedWidget ("paned", panedWidgetClass,
  1299. X                    toplevel, NULL, ZERO);
  1300. X
  1301. X      label_wid = XtCreateManagedWidget ("label", labelWidgetClass,
  1302. X                     pane, NULL, ZERO);
  1303. X      
  1304. X      XtSetArg (args[0], XtNlabel, &label);
  1305. X      XtGetValues(label_wid, args, ONE);
  1306. X      
  1307. X      if ( strcmp("label", label) == 0 ) {
  1308. X    (void) XmuGetHostname (host, 255);
  1309. X    XtSetArg (args[0], XtNlabel, host);
  1310. X    XtSetValues (label_wid, args, ONE);
  1311. X      }
  1312. X
  1313. X      load_parent = pane;
  1314. X    }
  1315. X    else
  1316. X      load_parent = toplevel;
  1317. X
  1318. X    load = XtCreateManagedWidget ("load", stripChartWidgetClass,
  1319. X                  load_parent, NULL, ZERO);    
  1320. X    if ( argc == 2 )
  1321. X    targetHost = argv[1];
  1322. X
  1323. X    InitRPC( targetHost );
  1324. X    SetHost( targetHost );
  1325. X    SetInterval( 1 );
  1326. X    TurnOnEther();
  1327. X    XtAddCallback(load, XtNgetValue, GetLoadPoint, NULL);
  1328. X
  1329. X    XtRealizeWidget (toplevel);
  1330. X    wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW",
  1331. X                                    False);
  1332. X    (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
  1333. X                            &wm_delete_window, 1);
  1334. X    XtMainLoop();
  1335. }
  1336. X
  1337. X
  1338. static void quit (w, event, params, num_params)
  1339. X    Widget w;
  1340. X    XEvent *event;
  1341. X    String *params;
  1342. X    Cardinal *num_params;
  1343. {
  1344. X    if (event->type == ClientMessage &&
  1345. X        event->xclient.data.l[0] != wm_delete_window) {
  1346. X        XBell (XtDisplay(w), 0);
  1347. X        return;
  1348. X    }
  1349. X    XCloseDisplay (XtDisplay(w));
  1350. X    exit (0);
  1351. }
  1352. SHAR_EOF
  1353. chmod 0644 xload.c ||
  1354. echo 'restore of xload.c failed'
  1355. Wc_c="`wc -c < 'xload.c'`"
  1356. test 5617 -eq "$Wc_c" ||
  1357.     echo 'xload.c: original size 5617, current size' "$Wc_c"
  1358. rm -f _shar_wnt_.tmp
  1359. fi
  1360. # ============= xnetload.man ==============
  1361. if test -f 'xnetload.man' -a X"$1" != X"-c"; then
  1362.     echo 'x - skipping xnetload.man (File already exists)'
  1363.     rm -f _shar_wnt_.tmp
  1364. else
  1365. > _shar_wnt_.tmp
  1366. echo 'x - extracting xnetload.man (Text)'
  1367. sed 's/^X//' << 'SHAR_EOF' > 'xnetload.man' &&
  1368. .TH XNETLOAD 1 "Release 1" "X Version 11"
  1369. .SH NAME
  1370. xnetload - ethernet load average display for X
  1371. .SH SYNOPSIS
  1372. .ta 6n
  1373. \fBxnetload\fP    [-\fItoolkitoption\fP ...] [-scale \fIinteger\fP] 
  1374. .br
  1375. X    [-update \fIseconds\fP] [-hl \fIcolor\fP] [-highlight \fIcolor\fP] 
  1376. .br
  1377. X    [-jumpscroll \fIpixels\fP] [-label \fIstring\fP] [-nolabel] \fIhost\fP
  1378. .SH DESCRIPTION
  1379. The 
  1380. .I xnetload 
  1381. program displays a periodically updating histogram of the ethernet load average for
  1382. the specified \fIhost\fP. The resulting graph is scaled as 0% to 100%.
  1383. NOTE: \fIThe specified host must be running rpc.etherd.
  1384. .SH OPTIONS
  1385. .PP
  1386. .I Xnetload
  1387. accepts all of the standard X Toolkit command line options (see \fIX(1)\fP).
  1388. The order of the options is unimportant.  \fIxnetload\fP also accepts the
  1389. following additional options:
  1390. .PP
  1391. .TP 8
  1392. .B \-hl \fIcolor\fP or \-highlight \fIcolor\fP
  1393. This option specifies the color of the scale lines.  
  1394. .TP 8
  1395. .B \-jumpscroll \FPnumber of pixels\fP
  1396. The number of pixels to shift the graph to the left when the graph
  1397. reaches the right edge of the window.  The default value is 1/2 the width
  1398. of the current window.  Smooth scrolling can be achieved by setting it to 1.
  1399. .TP 8
  1400. .B \-label \fIstring\fP
  1401. The string to put into the label above the load average.
  1402. .TP 8
  1403. .B \-nolabel
  1404. If this command line option is specified then no label will be
  1405. displayed above the load graph.
  1406. .TP 8
  1407. .B \-scale \fIinteger\fP
  1408. This option specifies the minimum number of tick marks in the histogram,
  1409. where one division represents one load average point.  If the load goes
  1410. above this number, \fIxnetload\fP will create more divisions, but it will never
  1411. use fewer than this number.  The default is 10 (as set by the resource file).
  1412. .PP
  1413. .TP 8
  1414. .B \-update \fIseconds\fP
  1415. This option specifies the frequency in seconds at which \fIxnetload\fP
  1416. updates its display.  The minimum amount of time allowed between updates
  1417. is 1 second. For ethernet load monitoring this should be set to 1.
  1418. .TP 8
  1419. .B  \fIhost\fP
  1420. The \fIhost\fP specification is required. It is the name of any host, reachable
  1421. from the initiating CPU, that is running rpc.etherd
  1422. .SH RESOURCES
  1423. In addition to the resources available to each of the widgets used by 
  1424. \fIxnetload\fP there is one resource defined by the application itself.
  1425. .TP 8
  1426. .B showLabel (\fPclass\fB Boolean)
  1427. If False then no label will be displayed.
  1428. .SH WIDGETS
  1429. In order to specify resources, it is useful to know the hierarchy of
  1430. the widgets which compose \fIxnetload\fR.  In the notation below,
  1431. indentation indicates hierarchical structure.  The widget class name
  1432. is given first, followed by the widget instance name.
  1433. .sp
  1434. .nf
  1435. .ta .5i 1.0i 1.5i 2.0i
  1436. XXnetload  xnetload
  1437. X    Paned  paned
  1438. X        Label  label
  1439. X        StripChart  load
  1440. .fi
  1441. .sp
  1442. .SH ENVIRONMENT
  1443. .PP
  1444. .TP 8
  1445. .B DISPLAY
  1446. to get the default host and display number.
  1447. .TP 8
  1448. .B XENVIRONMENT
  1449. to get the name of a resource file that overrides the global resources
  1450. stored in the RESOURCE_MANAGER property.
  1451. .SH FILES
  1452. /usr/lib/X11/app-defaults/XNetload - specifies required resources
  1453. .SH SEE ALSO
  1454. XX(1), xrdb(1), mem(4), Athena StripChart Widget.
  1455. .SH BUGS
  1456. This program requires the ability to talk to the rpd.etherd daemon, and to
  1457. set the ethernet interface into promiscuous mode. Therefore, the Makefile
  1458. installs the program in /usr/bin/X11/ with root as the owner and with the
  1459. setuid bit set. This may not be necessary on some (most) systems, depending 
  1460. on the ownership of rpc.etherd.
  1461. .PP
  1462. .SH COPYRIGHT
  1463. Taken from the original xload sources distributed with X11R4.
  1464. Original copyright is preserved below:
  1465. .PP
  1466. Copyright 1988, Massachusetts Institute of Technology.
  1467. .br
  1468. See \fIX(1)\fP for a full statement of rights and permissions.
  1469. .SH AUTHORS
  1470. Original xload authors: K. Shane Hartman (MIT-LCS) and Stuart A. Malone (MIT-LCS);
  1471. .br
  1472. with features added by Jim Gettys (MIT-Athena), Bob Scheifler (MIT-LCS),
  1473. Tony Della Fera (MIT-Athena), and Chris Peterson (MIT-LCS).
  1474. .PP
  1475. Modified to the current xnetload form by:
  1476. .br
  1477. Roger Smith, Sterling Software at
  1478. .br
  1479. NASA-Ames Research Center, Mountain View, Ca.
  1480. .PP
  1481. For questions or reporting bugs:
  1482. .br
  1483. rsmith@proteus.arc.nasa.gov
  1484. SHAR_EOF
  1485. chmod 0644 xnetload.man ||
  1486. echo 'restore of xnetload.man failed'
  1487. Wc_c="`wc -c < 'xnetload.man'`"
  1488. test 4086 -eq "$Wc_c" ||
  1489.     echo 'xnetload.man: original size 4086, current size' "$Wc_c"
  1490. rm -f _shar_wnt_.tmp
  1491. fi
  1492. exit 0
  1493. -- 
  1494. --
  1495. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1496. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1497. Sunnyvale, California 94086            at&t: 408/522-9236
  1498.