NOAA

Geophysical Fluid
Dynamics Laboratory

Skip to: [content] [navigation]
If you are using Navigator 4.x or Internet Explorer 4.x or Omni Web 4.x , this site will not render correctly!

Vis > utilities > Other Useful Utilities

Other Useful Utilities

availcols
A utility for printing the number of free color cells in the root window's colormap.
byteswap
A utility for swapping the bytes of all the words in a binary data file.
GNU enscript
A utility to convert text files to PostScript with a color syntax-highlighting capability for many programming languages.
GNU ls
A replacement for the shell ls command that can color-code directory listings!
maker2html
Converts a FrameMaker document into HTML as a complete web page.
man2html
Encapsulates a man formatted help topic in HTML.
NEdit
A mouse-based text editor that's easy to use and customize with a color syntax-highlighting capability for many programming languages.
snoop
A tool for magnifying pixels on the screen.
TkcxHelp
An interactive tool for finding appropriate Explorer modules using a keyword search.
TkFind
An interactive (GUI) version of the Unix find command.
xcmap
A utility for displaying the colormap of the root window.
xdiskusage
A utility for displaying a directory's disk usage.
XFTP
A GUI tool for simplifying FTP operations.
zip & unzip
Tools for manipulating ZIP archive files.

availcols

DESCRIPTION

availcols is a utility that prints how many color cells are free in the root window's (simply the background of the screen) colormap. On the SGI, the root window uses an 8-bit colormap by default for maximum compatiblity with all X applications even though the machine is able to easily display 24-bit color. Many programs try to share this colormap rather than create their own custom colormaps to also conserve system resources. The 256 colors can eventually run out and when this happens new applications that you try to run will probably have color schemes different than you would expect. In order to avoid these problems, it is best to try and run programs which use lots of colors in 24-bit mode if at all possible.

HOW TO INVOKE

(Located in /net/hnv/graphics/xwindow/)
To see the number of free color cells:
  • availcols
or to also clear all the unallocated ones to a particular color:
  • availcols black

HINTS

The xcmap program (see below) is useful in conjunction with availcols in order to see exactly what the root window's colormap looks like.

byteswap

DESCRIPTION

byteswap is a utility for swapping the byte values within all the words of a data file creating a new file. Byteswapping just amounts to switching the places of the first byte and the last byte, the second byte and the second-to-last byte, etc. within a word. byteswap assumes a default word size of 4 bytes, but it could also be 2 or 8.

Byteswapping is a common problem when binary data files are used on a big-endian machine which were created on a little-endian machine and vice versa. Big-endian machines, such as the Crays and RISC-based SGIs and Suns, store words in memory in MSB order meaning that the most significant byte of a word has the first address. Little-endian machines, such as Intel x86-compatibles and DEC Alphas, store words in memory in LSB order meaning that the least significant byte of a word has the first address. Unlike unformatted IEEE, not all data files have to be manually byteswapped between different endian machines. For files such as netCDF, GIF, TIFF, SGI RGB, etc., information in them tells reader programs how to interpret their bytes correctly regardless of the machine on which they originated.

HOW TO INVOKE

To byteswap a file with the default 4-byte words:
  • /home/hnv/pub/{linux:irix}/byteswap infile outfile
To byteswap a file with 2-byte words:
  • /home/hnv/pub/{linux:irix}/byteswap infile outfile -w 2
To byteswap a file with 8-byte words:
  • /home/hnv/pub/{linux:irix}/byteswap infile outfile -w 8

HINTS

DOWNLOAD

byteswap is now available to the public via FTP. Be sure to read the enclosed LICENSE agreement before using it.

GNU enscript

DESCRIPTION

GNU enscript is a utility that converts text files into PostScript for printing similar to a2ps. However, enscript has many more options, most significant of which is the ability to do color syntax highlighting of program code for many different languages. Printing of highlighted text can already be done directly out of Emacs, so enscript is probably most useful for those using other text editors, particularly NEdit.

PLUSES

MINUSES

More difficult to customize the color syntax-highlighting language modes than in NEdit.

HOW TO INVOKE

A good set of options to use with enscript is in this example:

  • /home/hnv/pub/irix/enscript --fancy-header=custom2 -H3 -j \
    -f Courier8 -E --color=nedit --mark-wrapped-lines=arrow \
    input.F > output.ps
    
The "--fancy-header=custom1" option puts a header called "custom1" at the top of each PostScript page; "custom2" is another possible choice. The "-j" option puts a thin black border around the text. The "-H3" option puts light gray horizontal bars behind the text spaced 3 lines apart and 3 lines high. The "-f Courier8" option specifies to use an 8pt. Courier font for the text. The "-E" option turns on the color syntax highlighting of program code. By default, enscript will try to guess what language mode to use based on the input file's extension (".f" and ".F" indicate Fortran77, ".f90" and ".F90" indicate Fortran90, ".c" indicates C, ".csh" indicates C-shell, etc.). In order to directly specify what language mode to use, just put the name of the mode after the option (i.e. "-Efortran90"). A list of all available language modes (except for fortran90 which was added at GFDL) is available via a link on the enscript home page. The "--color=nedit" option specifies to use the nedit color model for syntax highlighting. This can be a similar style to how the NEdit text editor does its color syntax highlighting. For the greatest similarity, try to get the most recent language modes in this configuration file:

  • cp /home/hnv/.nedit ~

This may overwrite one's customizations, so it may be a good idea to diff the files first and see what has changed. Another color model is emacs, which should be similar to the highlighting built into the Emacs environment. Finally, the "--mark-wrapped-lines=arrow" option puts small arrows at the ends of long lines which wrap onto subsequent lines. Many other options are described in the man page below, but here are some examples of actual source code (from grads2nc) processed with enscript and available for viewing as the final PostScript:

read_grads2nc.c.ps (/home/hnv/pub/enscript --fancy-header=custom1 -H3 -j -f Courier7 \
-E --color=nedit --mark-wrapped-lines=arrow -u"grads2nc" \
--ul-position="+125-25" -2 -r read_grads2nc.c > read_grads2nc.c.ps)
write_grads2nc.F.ps (/home/hnv/pub/enscript --fancy-header=custom2 -H3 -j -f Courier8 \
-E --color=nedit --mark-wrapped-lines=arrow -u"grads2nc" \
--ul-position="+125-25" write_grads2nc.F > write_grads2nc.F.ps)

HINTS

DOCUMENTATION

GNU ls

DESCRIPTION

GNU ls is a replacement for SGI's command-line ls program. It is basically functionally identical to the old ls except that it also supports color-coded directory listings. Different types of files in a directory can be displayed using different colors rather than the standard foreground color for everything.

PLUSES

Color-coded directory listings!

HOW TO INVOKE

Since getting a directory listing is a fairly frequent operation, it is probably best to have GNU ls available locally. The first step is to make a copy somewhere on one's local disk:

  • cp /home/hnv/pub/irix/gls /net//

Then put an alias statement (to override SGI's ls) and a color definition statement (which maps file types to ANSI color numbers using the LS_COLORS environment variable) at the end of one's "~/.cshrc-sgi-" file:

  • alias ls "/net//gls -CF --color=tty"
  • setenv LS_COLORS "ex=33:di=31:ln=36:or=36;4:*.o=35:*.a=35:*.so=35:*.gz=32:*.Z=32:*.zip=32"

The "-CF" options on GNU ls are the same as for SGI's ls and the "--color=tty" option turns on color-coding when the output is sent to the terminal. If the output is redirected elsewhere (such as to a file) then it functions the same as SGI's ls to avoid any potential problems with embedded color codes. Note that the "setenv" statement above is very long and it should all be on one line. The man page further below has a DISPLAY COLORIZATION section which explains the format of the "LS_COLORS" string if further customization is desired. The above example sets the mapping from file types to colors as follows:

File Type Color
executable  yellow 
directory red
symbolic link cyan
objects and libraries (".o", ".a", and ".so")  purple 
compressed (".gz", ".Z", and ".zip") green

This alias will take effect when a new shell is started and so GNU ls will be transparently called whenever the regular SGI ls is used.

HINTS

The color-coded directory listings are most effective with a dark (preferably black) background in the command shell.

DOCUMENTATION

man page

maker2html

DESCRIPTION

maker2html converts a FrameMaker document into HTML format as a complete web page. Although, FrameMaker has HTML conversion capabilities already built-in via WebWorks HTML Lite, there are some significant limitations to it such as not being able to handle graphics, equations, or tables. In addition, it doesn't provide direct control over the exact HTML code that maps to each FrameMaker tag; one can only choose from a list of predefined HTML sequences which is frequently insufficient for accurate representation. There is also no way to save a customized set of mappings for a document. maker2html addresses many of these limitations, but has some limitations of its own; the most notable of which are that it will generally only recognize text in the main text frame and only recognize graphics in an anchored frame.

maker2html does its conversion using a global set of mappings and assuming some default FrameMaker tags. In order to produce the best output web page, it will most likely be necessary to customize the mappings according to the formatting that each paragraph tag represents in a document. (It may also be necessary to know a little bit about HTML; a good introduction is on this WWW Help Page.) These mapping customizations are put in a file called ".maker2html" in the same directory as the document and apply to all documents to be converted in that directory. As an example, the customization file used to convert the FrameMaker documents comprising the GFDL Annual Report to HTML is as follows:

    HTMLTAGS:
    
    1Heading_maker2html      <P>&nbsp;&nbsp;PARA</P>
    2Heading_maker2html      <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PARA</P>
    Activ+Plans_maker2html   <CENTER><H4>PARA</H4></CENTER>
    BodyAR_maker2html        <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PARA</P>
    Chapter_maker2html       <H3>PARA</H3>
    GoalsBody_maker2html     <P><UL><I>PARA</I></UL></P>
    HeadGOALS_maker2html     <P><CENTER>PARA</CENTER></P>
    names_maker2html         <P><UL><I>PARA</I></UL></P>
    
    ############################################################################
    
    GENERICTAGS:
    
    1Heading      1Heading_maker2html
    2Heading      2Heading_maker2html
    Activ+Plans   Activ+Plans_maker2html
    BodyAR        BodyAR_maker2html
    Chapter       Chapter_maker2html
    GoalsBody     GoalsBody_maker2html
    HeadGOALS     HeadGOALS_maker2html
    names         names_maker2html
        
This format uses an intermediate set of generic tags to map the FrameMaker paragraph tags to HTML code. The "HTMLTAGS:" section maps those arbitrarily-named generic formatting tags (left column) to a sequence of HTML codes (right column). The "PARA" directives in the HTML code specify where the blocks of text having particular FrameMaker paragraph tags will be inserted. Then the "GENERICTAGS:" section uses those generic tags to map from the real FrameMaker paragraph tags (left column) found in the document.

When constructing a ".maker2html" file, it is not absolutely necessary to include an "HTMLTAGS:" section. The definitions in the global mappings file /home/hnv/pub/irix/maker2html_src/global.mappings can certainly be used if they appear suitable, which avoids some potential (although minor) HTML programming. In order to use them, just select the one that best represents each FrameMaker paragraph tag and then put the appropriate name in the right-hand column of the "GENERICTAGS:" section. Of course, it will also be necessary to get a list of all the paragraph tags used in a FrameMaker document and then put them in the left-hand column of the "GENERICTAGS:" section. Fortunately, maker2html will display a list of all the used ones in its processing diagnostic output for easy cut-and-paste.

PLUSES

Nicely converts graphics, equations, and tables!

MINUSES

HOW TO INVOKE

To convert a document with maker2html:

  • /home/hnv/pub/irix/maker2html input.fm

The HTML file that is produced will be in the same directory as the input FrameMaker document and will have a ".html" extension. Any generated figures (as GIF files) will be placed in a "figures" subdirectory within the current directory. Figure generation can take quite a while so it is only done once by default; there is a command-line switch for regenerating them if necessary. There will also be some intermediate files left after conversion which can then be safely deleted ("*.commands", "*.mif", "maker2html.log").

maker2html has a library of small GIF images that it can use to represent special characters in the text. If a generated web page uses any of these images then their paths will have to be changed in the HTML code since the default location for them is in a directory ("/home/hnv/pub/irix/maker2html_src/icons_char/") which will not be accessible to an outside user loading the page through the web server. A utility is available called clean_maker2html which will copy all the referenced character images to the "figures" subdirectory within the current directory and update the paths in the HTML file:

  • /home/hnv/pub/clean_maker2html input.html output.html

This utility also has an option for removing all the HTML target tags from the output file:

  • /home/hnv/pub/clean_maker2html -t input.html output.html

If the file is not referenced from a FrameMaker "table of contents" document (also processed with maker2html) then it is safe to remove all the targets which only clutter the file, especially within an HTML editor like that built into Netscape.

HINTS

See the FrameMaker Notes page for some general FrameMaker tips and information about document publishing.

DOCUMENTATION

man2html

DESCRIPTION

man formatted help can be quickly encapsulated with HTML for online documentation. Its output is a single HTML file for each man topic piped into it.

HOW TO INVOKE

HINTS

DOCUMENTATION

man page

NEdit

DESCRIPTION

NEdit is a very polished GUI text editor written at Fermilab. SGI even thinks highly enough of this program to bundle it with versions of IRIX starting at 6.3. Its functionality falls somewhere between the simple Jot and the complex Emacs. NEdit's best features are probably its intuitive and well-designed interface (taking advantage of SGI's enhanced Motif widgets), high level of customizability, and extremely useful color syntax highlighting for many different programming languages. Sure, Emacs can do color syntax highlighting as well, but NEdit's implementation actually allows it to be modified interactively and easily within the program's menus.

Another notable feature is the ability to copy text directly out of the NEdit window and then paste it into Netscape Gold's web-page editor window. This seems to be the only way to bring arbitrary (non-HTML) text into that editor without using the xclipboard program. Directly copying and pasting from the command shell, Jot, or Emacs doesn't seem to work for some reason.

PLUSES

MINUSES

Keyboard menu shortcuts do not work when either the Num Lock, Caps Lock, or Scroll Lock is on... IRIX 5.3 Motif bug?

HOW TO INVOKE

To start NEdit:
  • /home/hnv/pub/irix/nedit sample.F
Any files specified on the command-line will each be opened into separate windows.

HINTS

Here are two sample configuration styles to make NEdit appear and function as in the two images above. For the first sample, just add this line to one's "~/.Xdefaults" file:
  #include "/home/hnv/pub/irix/nedit_style1.ad"
then:
  • cp /home/hnv/pub/dotnedit_style1 ~/.nedit
Do these same two steps for the second sample configuration, but just replace the 1 in the filenames with a 2. The most recent configuration (particularly for updated language modes) is "/home/hnv/.nedit".

NEdit's icon can also be changed by putting an SGI RGB image (85x67 pixels) called "nedit.icon" in one's "~/.icons" directory. To install a sample icon:

  • cp /home/hnv/.icons/nedit.icon ~/.icons/
It may be necessary to restart the window manager in order for the icon change to take effect; select "Restart 4Dwm" from the "Main Menu", which is accessible with the right-mouse button on the screen's background.

DOCUMENTATION

snoop

DESCRIPTION

snoop is a very fast GL-based pixel magnification tool. It's quite useful for viewing small details which might otherwise be hard to see as a result of the high resolution of the screen. A pop-up menu (accessible with the right mouse button in the snoop window) provides options for changing magnification, single/double buffering, displaying the actual pixel values under the cursor, and snooping with the arrow keys instead of the mouse.

PLUSES

Very fast since it's based on GL (hardware accelerated).

HOW TO INVOKE

To start snoop, select it from the "Utilities" menu off the "Main Menu" on the screen's background (accessible with the right mouse button), or just enter:
  • (IRIX) snoop

HINTS

Switch to single-buffer mode (24-bit) in order to get a more accurate color representation of the magnified pixels. The default is double-buffer mode (12-bit) which introduces dithering to enhance its limited color resolution. Note: This 12-bit limitation applies to the Indigo2/Indigo XZ as well as the low-end Personal Irises, although higher-end graphics subsystems can double-buffer in 16-bit or 24-bit.

DOCUMENTATION

man page

TkcxHelp

DESCRIPTION

This program searches for keywords in the help files of Explorer modules. Any number of words may be searched for by entering them (separated by spaces) into the "Keywords" text widget at the bottom of the window. The case of the keywords is ignored by default during searching. Case can be considered by unchecking "Ignore Key Case" in the "Options" menu. Pressing the "Find" button will start the search. The found help files can be viewed by double-clicking on one or by drag-selecting one or more and then pressing "View".

TkcxHelp searches for module help files in the following directories at GFDL:

  • /usr/explorer/modules
  • /usr/explorer/opengl/modules
  • /usr/explorer/scribe
  • /usr/explorer/maps
  • /usr/explorer/unsupported/modules
  • /home/hnv/explorer/modules
  • /home/hnv/explorer/redrock.ncsa.uiuc.edu/General
  • /home/hnv/explorer/redrock.ncsa.uiuc.edu/Grid
  • /home/hnv/explorer/ftp.epcc.ed.ac.uk
  • /home/hnv/explorer/phoenix.ocf.llnl.gov
  • /home/hnv/explorer/www.iijnet.or.jp

PLUSES

Easy way to find an Explorer module that performs a desired action.

MINUSES

Cannot prematurely abort the keyword search.

HOW TO INVOKE

TkcxHelp uses the Tcl/Tk libraries that are found through environment variables. These variables can be set and the program run with a compact command-line call such as:
  • (setenv TCL_LIBRARY /home/hnv/pub/tcl/tcllib; \
     setenv TK_LIBRARY /home/hnv/pub/tcl/tklib; \
     /home/hnv/explorer/tkcxhelp) &

HINTS

Send e-mail to the author regarding any comments or suggestions for improvement.

DOCUMENTATION

Built-in help pages

TkFind

DESCRIPTION

TkFind is basically a GUI version of the Unix find command. It looks through specified directory paths for all the files that match a particular search pattern. The search can be modified with various options such as matching a user, file permissions, size, date, etc. The actual find command constructed with all these options is shown as well as the results from the previous find at the bottom of the main window. Before the search is started, sorting options can be selected regarding how the matching files should be listed. They can be sorted by name, time, and size in a verbose or compact format with relative or absolute path names.

Once a list of matching files have been found, Unix shell commands can be executed on this list. Possible operations include searching the found files for specific strings (the grep command) compressing them, storing them in a cpio or tar archive, etc. Most shell commands (from the "Other" selection in the "Options...Apply Command" sub-menu) should work reasonably well from within TkFind. See the "Options" selection in the help menu for a more detailed explanation as to how the list of matching files is processed.

The cpio and tar commands are particularly noteworthy since they have their own execution window. This window allows these operations (along with the find) to be saved as a script. The script can be run immediately, at a specific time, or can even be submitted to NQS on the T90 as a batch job. Also on the T90, TkFind creates scripts that know how to deal with files in the archive filesystem using the dmget and dmput commands.

The first example image above shows an expanded view of TkFind running on the T90. Its search was for all files in a local directory that end with ".nc" and do not contain the string "test" in their names and are greater than 1,000,000 bytes in size. The other two example images show TkFind running on an Indigo2 and a Personal Iris. Different colors are used in order to make it easy to see on what system TkFind is running. See below for more information on color options.

PLUSES

HOW TO INVOKE

Although TkFind uses the Tcl/Tk libraries, it is no longer necessary to set environment variables for them. Just run the following simple wrapper script which takes care of everything on either an SGI or the T90:

  • ~hnv/pub/tcl/tkfind

TkFind has several command-line options for specifying some of its window colors. By default, when TkFind starts up, it makes a minimal check to see on what kind of system it is running and then adjusts the colors accordingly. It uses a green scheme for the Indigo2, a purple scheme for the Indigo and Personal Irises, and a gray scheme for everything else (such as the T90). If the defaults are not satisfactory then they can be changed with the following options:

  • -bgc color
  • Sets the background color.
  • -fgc color
  • Sets the foreground color.
  • -abgc color
  • Sets the active background color.
  • -selc color
  • Sets the selected color.
  • -menuc color
  • Sets the menu color.
  • -green
  • Uses the green color scheme.
  • -purple
  • Uses the purple color scheme.
  • -gray
  • Uses the gray color scheme.
    Colors are specified by either a name (refer to "/usr/lib/X11/rgb.txt" for a complete list) or a hexadecimal string of the form "#rrggbb" where "rr" is the red component, "gg" is the green, and "bb" is the blue.

    HINTS

    DOCUMENTATION

    DOWNLOAD

    Due to a few requests, TkFind is now available to the public via FTP. Be sure to read the enclosed README file and LICENSE agreement before trying to use it. Certain program features are quite specific to the GFDL computing environment, so some code modifications will inevitably be necessary when it's used elsewhere...

    xcmap

    DESCRIPTION

    xcmap brings up a window displaying all the colors in the colormap of the root window of the SGI. The colors are shown as a grid of 16x16 rectangles. You can click on any cell with the left mouse button to see its index number and its RGB values. The RGB values are printed in 16-bit hexadecimal and since the range is normally 8-bit, the two characters for each component are repeated. In the example image above, all the black rectangles (except for the one in the upper left-hand corner) are the unallocated color cells.

    HOW TO INVOKE

    HINTS

    Use xcmap in conjunction with availcols (see above) for maximum utility.

    DOCUMENTATION

    man page

    xdiskusage

    DESCRIPTION

    This provides a more effective view of disk usage as compared with the command du. A distribution of the disk usage for a specific directory is graphically displayed with comprehensive labeling (sub-directory names and usages). Examining at a depth of 11 sub-directories is also possible. Printing and sorting the contents are additional features.

    HOW TO INVOKE

    MINUSES

    As slow as du when scanning the directories.

    DOCUMENTATION

    man page

    XFTP

    DESCRIPTION

    XFTP provides a very easy way of doing file transfers between different machines. It is far more convenient than the command-line ftp plus it has advantages over Netscape's FTP capabilities. These include being able to see both the source and target hosts/directories simultaneously and transferring multiple files in one operation. XFTP even saves a list of the recently visited remote/anonymous hosts.

    PLUSES

    Much easier to use than the old command-line ftp!

    HOW TO INVOKE

    DOCUMENTATION

    zip & unzip

    DESCRIPTION

    zip and unzip are two programs for manipulating ZIP archive files. These files are compatible with the ".zip" files commonly found on PCs. A ZIP archive is just a collection of smaller files gathered into a larger one with built-in compression. The typical Unix equivalent would be a ".tar" file compressed with gzip. zip creates and modifies the archive files and unzip extracts their contents. These programs are useful when large files or collections of smaller files have to be transported between machines (namely from an SGI to a PC, and vice versa) using floppy disks.

    HOW TO INVOKE

    DOCUMENTATION

    smaller bigger reset
    last modified: August 31 2006.