0% found this document useful (0 votes)
173 views

Overview

MKS, MKS Toolkit, and AlertCentre are registered trademarks of MKS Inc. Technical Support To request customer support, please contact us by one of the means listed below. Include the name and version number of the product, your serial number, and the operating system and version / patch level that you are using.

Uploaded by

zoravars
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
173 views

Overview

MKS, MKS Toolkit, and AlertCentre are registered trademarks of MKS Inc. Technical Support To request customer support, please contact us by one of the means listed below. Include the name and version number of the product, your serial number, and the operating system and version / patch level that you are using.

Uploaded by

zoravars
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

MKS Toolkit

Product Overview & Solutions Guide

MKS Inc.

MKS Toolkit: Product Overview & Solutions Guide


2007 MKS Software Inc.; in Canada copyright owned by MKS Inc. All rights reserved.

MKS, MKS Toolkit, and AlertCentre are registered trademarks of MKS Inc. NuTCRACKER is a registered trademark of MKS Software Inc. All other trademarks referenced are the property of their respective owners.

MKS Inc. 12701 Fair Lakes Circle Suite 350 Fairfax, Virginia 22033 Phone: +1 703 803-3343 Fax: +1 703 803-3344 E-mail: [email protected] 9.1.1-0707

Technical Support
To request customer support, please contact us by one of the means listed below and in your request include the name and version number of the product, your serial number, and the operating system and version/patch level that you are using. Contact MKS customer support at: Web: E-mail: Telephone: Fax:
http://www.mkssoftware.com/support [email protected]

+1-703-803-7660 (9:00am to 7:00pm Eastern, Mon-Fri) +1-703-803-3344

When reporting problems, please provide a test case and test procedure, if possible. If you are following up on a previously reported problem, please include the problem tracking number in your correspondence. Finally, tell us how we can contact you. Please give us your e-mail address and telephone number.

Product Overview & Solutions Guide

iii

iv

MKS Toolkit

Table of Contents
1 Introduction............................................................... 1
The MKS Toolkit Product Family ..........................................................1 MKS Toolkit for Developers ...........................................................2 MKS Toolkit for Enterprise Developers .........................................3 MKS Toolkit for Enterprise Developers 64-bit Edition ..................3 Other MKS Toolkit Products...........................................................3 About This Manual .................................................................................4

2 Getting Started..........................................................5
The MKS Toolkit Start Menu .................................................................5 Launching a Command Window ............................................................7 Getting Help............................................................................................8 Command Syntax....................................................................................9 Case Sensitivity ...............................................................................9 Forward Slashes Versus Backslashes ..............................................9 Path Names...............................................................................9 Command Options....................................................................9 Running Scripts and Programs .............................................................10 The Search Path .............................................................................11 File Associations............................................................................12 MKS Toolkit File Associations ..............................................12 Creating Your Own File Associations....................................13

3 Putting MKS Toolkit to Work for You ................... 15


Developing Software ............................................................................15 Software Development ..................................................................15 Script Development .......................................................................16 Web Development .........................................................................16 Cross-Platform Development ........................................................16 Porting Software from UNIX/Linux Systems ......................................17 Porting to 64-bit Windows ............................................................17 Porting X Applications ..................................................................18 Porting Shared Libraries ................................................................18 Porting Threaded Applications ......................................................19 Porting Daemons ...........................................................................19 Evolving Ported Applications with COM .....................................19 Scripting and Automation .....................................................................20

Product Overview & Solutions Guide

Table of Contents

Shells .............................................................................................20 Awk ...............................................................................................20 Perl.................................................................................................21 Tcl ..................................................................................................21 Scheduling Utilities .......................................................................21 mksrv .............................................................................................22 Connecting to Remote Machines ..........................................................22 Remote Utilities .............................................................................22 Secure Utilities ..............................................................................23 Graphical Tools .............................................................................23 Text Processing.....................................................................................24 The vi Screen Editor ......................................................................24 The sed Utility ...............................................................................24 Searching for Text .........................................................................25 Simple Text Formatting Utilities ...................................................25 Displaying Text Files.....................................................................25 The groff Formatting System ........................................................26 Other Text Manipulation Utilities .................................................26 System Administration .........................................................................27 Application and Network Availability Monitoring .......................27 User and Group Manipulation .......................................................27 Automating Installations................................................................27 Synchronizing Passwords ..............................................................28 Simple Network Management Protocol (SNMP) ..........................28 Windows Management Instrumentation (WMI) ...........................28 Setting and Implementing Corporate Standards ............................28 Controlling Services ......................................................................28 Backups, File Archiving, and Compression .........................................29

4 Additional Information ........................................... 31


The MKS Toolkit Resource Kit............................................................31 System Administration ..................................................................31 Development..................................................................................31 GCC ...............................................................................................32 Sample Sources and Solutions.......................................................32 Other Documentation............................................................................33 MKS Toolkit UNIX to Windows Porting Guide...........................33 Reference Pages.............................................................................33 User Guides and Tutorials .............................................................34 Online Help....................................................................................35 Release Notes ................................................................................35 Articles and White Papers .............................................................35 Knowledge Base ............................................................................35

vi

MKS Toolkit

Table of Contents

A Configuration .......................................................... 37
Registry Database .................................................................................37 Environment Variables .........................................................................37 CCG ...............................................................................................38 COMSPEC.....................................................................................38 HOME ...........................................................................................38 LOGNAME ...................................................................................38 MAKESTARTUP..........................................................................38 MAN_CHM_INDEX ....................................................................39 MAN_HTM_PATHS ....................................................................39 MAN_TXT_INDEX......................................................................39 PATH.............................................................................................39 ROOTDIR .....................................................................................40 SHELL...........................................................................................41 TMPDIR ........................................................................................41 Additional Environment Variables ................................................41 MKS Toolkit Configuration Files.........................................................41 MKS KornShell .............................................................................41 profile.ksh...............................................................................42 profwin.ksh.............................................................................42 environ.ksh .............................................................................42 MKS Bourne-Again Shell .............................................................42 ROOTDIR/etc/profile.ksh ......................................................42 .bash_profile, .bash_login, profile.ksh, .profile......................43 ROOTDIR/etc/bash.bashrc, .bashrc .......................................43 MKS C Shell..................................................................................43 cshrc.csh .................................................................................43 login.csh .................................................................................44 logout.csh ...............................................................................44 MKS Toolkit Control Panel Applet ......................................................44

Index ........................................................................ 47

Product Overview & Solutions Guide

vii

Table of Contents

viii

MKS Toolkit

Introduction

products. This guide is designed to give you a quick overview of the features of the MKS Toolkit product family, to help you get started using this product, and to give you some ideas about what it can do to help you.

Thank you for purchasing one of the award-winning MKS Toolkit

The MKS Toolkit Product Family


MKS Toolkit products enable you to preserve your investments in UNIX software and expertise as you deploy Windows-based workstations and servers, because Toolkit allows you to port scripts, source code, and working environments quickly and easily from UNIX to Windows. MKS Toolkit products also allow pure Windows users to automate routine tasks with scripting and increase productivity with file and text manipulation tools, batch search and replace tools, and scheduling interfaces. MKS Toolkit products provide solutions in the following areas: User Productivity a variety of UNIX shells and over 400 commandline utilities help make your software engineers and system administrators more productive on their Windows machines. Platform Interoperability a selection of connectivity utilities provides you with secure interactive access to both your remote Windows servers and workstations and your UNIX/Linux systems. Application Portability more than 2700 APIs let you port all manner of UNIX/Linux applications to Windows, while maintaining a single source code baseline.

Product Overview & Solutions Guide

Introduction

Over the years, the combination of our products and servicesour solutionshave resulted in an extraordinary track record of success for our customers. No matter where you go in industry, you will find someone who depends on MKS Toolkit products for their success.
MKS Toolkit for Enterprise Developers

MKS Toolkit for Developers Command shells and scripting utilities System administration utilities Graphical and command-line scheduling interfaces Tape backup and archiving utilities Client/server remote utilities Client/server secure utilities Telnet server Software development utilities Web development utilities Tcl shell and built-in commands MKS X/Server Advanced development utilities Non-Graphical APIs Tcl development APIs X, Motif, OpenGL APIs

MKS Toolkit for Developers

MKS Toolkit for Developers, the award winning and industry-leading Windows/UNIX interoperability solution, dramatically improves the compatibility between Windows and UNIX environments. Featuring a comprehensive suite of UNIX and Windows utilities, MKS Toolkit for Developers gives developers and system administrators the power to customize, control, and automate their software development and administrative processes. MKS Toolkit for Developers speeds the software development and administration process and reduces errors by eliminating the time spent on tedious manual tasks. Benefits of MKS Toolkit for Developers include:

For more information about the development capability of MKS Toolkit, see the MKS Toolkit Evaluation Guide for Developers available from the Start Menu.

MKS Toolkit

The MKS Toolkit Product Family

Powerful scripting allows you to simplify and automate the execution of repetitive tasks. New technology integration enables you to easily control and manipulate todays dynamic infrastructures. Component-based architecture provides you with the ability to easily customize a solution configured to the needs of your organization.

MKS Toolkit for Enterprise Developers

MKS Toolkit for Enterprise Developers (formerly NuTCRACKER) is the proven solution for porting robust, mission-critical UNIX applications to Windows. With over 2700 UNIX APIs and a full command-line development environment, MKS Toolkit for Enterprise Developers is the ultimate in UNIX to Windows migration. No other product can match our full support for C, C++, and FORTRAN; for UNIX process management including forking, signals, alarms, and threads; for file system and security management; and for curses, X, Motif, and OpenGL. And no other product matches MKS Toolkit's access to Windows APIs for Windows integration and interoperability. Benefits of MKS Toolkit for Enterprise Developers include: Run UNIX applications as native Windows programs taking full advantage of COM, .NET, and other Windows features. Maintain a single source base across UNIX and Windows systems save time and money for years to come. Cut development time by 70%, 80%, even 90%. Easily deploy ported applications with built-in packaging wizard and a wide variety of UNIX runtime options.

MKS Toolkit for Enterprise Developers 64bit Edition Other MKS Toolkit Products

64-bit Windows is an ideal platform for applications that require large amounts of memory and high-performance such as digital content creation, electronic design automation, data warehousing, mechanical design automation, and advanced scientific and research applications. MKS Toolkit for Enterprise Developers 64-bit Edition simplifies the migration of 32-bit and 64-bit UNIX applications to both Itanium and extended architecture 64bit Windows platforms. There are several products in the MKS Toolkit family aimed at different kinds of people, performing different kinds of tasks. All products in the MKS Toolkit family are unified by our goal of bringing the power of UNIX to Windows.

Product Overview & Solutions Guide

Introduction

MKS Toolkit for Professional Developers a subset of MKS Toolkit for Enterprise Developers, the Professional Developers product is an ideal solution for the migration of non-graphical, character based, UNIX C, C++, and FORTRAN applications and utilities to Windows. MKS Toolkit for Interoperability extending MKS Toolkit for Developers by adding the complete MKS X/Server for displaying X Window System-based graphical applications, including OpenGL and Motif applications, on Windows. A network-capable server can display a graphical application on your Windows workstation from any machine on your network.
For more information about the system administration capabilities of MKS Toolkit, see the MKS Toolkit Evaluation Guide for System Administrators available from the Start menu.

MKS Toolkit for System Administrators a subset of MKS Toolkit for Developers, the System Administrators product is a powerful administration suite that gives you the ability to move data and files between machines, remotely administer systems, and perform backups across multiple platforms. Increase productivity and automate repetitive tasks like password synchronization, adding users and groups, setting up new machines, cloning a system file or a document tree on local or remote systems, and automatically scheduling recurring tasks.

About This Manual


This manual consists of several chapters discussing various aspects of the MKS Toolkit product family: Getting Started on page 5 provides an introduction to various aspects of working with MKS Toolkit. Putting MKS Toolkit to Work for You on page 15 provides an overview of how you can you use MKS Toolkit to create the solutions that meet your computing needs. Additional Information on page 31 describes additional sources of information about using MKS Toolkit. Configuration on page 37 describes how you can customize your MKS Toolkit product.

MKS Toolkit

Getting Started

This chapter describes how to get started with MKS Toolkit. It describes

the MKS Toolkit entries in the Start menu, how to launch a command window, the basics of MKS Toolkit command syntax, and how to run scripts and program from a command line.

The MKS Toolkit Start Menu


When you install MKS Toolkit, several entries are added to the Windows Start menu under the MKS Toolkit program group:
Accessories
For details on these utilities see the appc, gdf, gps, and ugrep reference pages in the online MKS Toolkit Utilities Reference and the online help files for the MKS Toolkit Scheduler, Visual Difference, and Visual Pax.

From the Accessories entry, you can launch several useful graphical tools:
Calculator

This is the Arbritrary Precision Programmable Calculator (appc), a programmable scientific calculator.
Display Free Space

This graphical utility (gdf) displays the amount of free space on the various floppy and hard drives in your system.
Process Status

This graphical utility (gps) displays the current status for each process currently running on your system. You can also terminate processes from this display.
Scheduler

The MKS Toolkit Scheduler is a graphical interface to the Windows Task Scheduler that offers additional scheduling options.

Product Overview & Solutions Guide

Getting Started

Ultragrep

This graphical utility (ugrep) allows you to search for text matching a regular expression in a series of files matching a specified pattern.
Visual Difference

This graphical utility displays the differences between two files.


Visual Pax

This utility combines the archiving and backup functionality of the various MKS Toolkit archiving utilities with a graphical interface.
Configuration
For more information on this applet, see MKS Toolkit Control Panel Applet on page 44.

This entry contains links to various tabs in the MKS Toolkit control panel applet which allow you to view and set configuration information for your MKS Toolkit product.
Development

For more information, see the Deploying Applications chapter in the UNIX to Windows Porting Guide.

On the MKS Toolkit migration products, this entry contains a link to the Deployment Wizard, a tool for packaging applications created using these MKS Toolkit products for deployment.
Documentation

For more information on the documentation provided with your MKS Toolkit see Other Documentation on page 33.

From this entry, you can launch the various online collections of reference pages as well as the online PDF-based user guides and tutorials.
Evaluation Guide

This entry contains links to the MKS Toolkit Evaluation Guide for System Administrators and/or the MKS Toolkit Evaluation Guide for Developers (depending on which MKS product you have installed) as well as links to the editors and shells used in the guides examples and other evaluation-related information.
Remote Connectivity

This entry provides links to the graphical interfaces for launching remote login (rlogin), remote shell (rsh), secure shell (secsh), and Windows telnet connections.
Resource Kit
For more information, seeThe MKS Toolkit Resource Kit on page 31.

This entry contains links for browsing the MKS Toolkit Resource Kit either on the MKS Web site or locally (if you have installed it locally).
Tutorials

On the MKS Toolkit migration products, this entry provides links to brief HTML tutorials on building DLLs and services.

MKS Toolkit

Launching a Command Window

View MKS Toolkit License

This entry displays the licensing information for MKS Toolkit.


Automatic Command Run

This graphical utility lets you set up commands to be run on machine bootup or on login. In addition, the Start menu contains entries for launching the MKS KornShell (sh), the MKS C Shell (csh), MKS Bourne-Again Shell (bash), Secure FTP Connections (a graphical interface to using SFTP), the Tcl Shell (tclsh), the viw text editor, and the xterm utility.

Launching a Command Window


For more information on these shells, see the sh (for MKS KornShell and MKS BourneAgain Shell) and csh (for MKS C Shell) reference pages in the online MKS Toolkit Reference.

Many of the utilities provided in the MKS Toolkit are designed to run from a command line. The easiest way to get a command line is to launch a command window for MKS KornShell, MKS C Shell, or the Bourne-Again Shell (bash). All three shells have entries under the MKS Toolkit program group in the Start menu that launch command windows from which you can run that shells built-in commands, other MKS Toolkit utilities, and even Windows command-line commands. If you would prefer to use the Windows command interpreter (cmd.exe), you can launch a command window for the interpreter for most of the systems from the Start menu. This is usually done with a Start menu item labeled Command Prompt. You can also launch a command window for the Windows command interpreter by selecting the Run... item from the Start menu and typing the name of the appropriate command interpreter in the Open field.

Note When using the Windows command interpreter, some MKS Toolkit

commands which are built into the MKS KornShell, MKS C Shell, or MKS Bourne-Again Shell are not available. These commands are only available when you are using that particular shell.

Product Overview & Solutions Guide

Getting Started

Getting Help
Now that you know how to launch a command window, how can you find out what commands and utilities are available and how do you use them? The answers to both halves of this question can be found in the reference pages provided with all MKS Toolkit products. These reference pages describe the command-line utilities and APIs provided in MKS Toolkit products. Each page is available in two formats: plain text and HTML Help.
For more information, see the man reference page in the online MKS Toolkit Utilities Reference or simply type man man.

To display a plain text reference page, use the man utility. For example:
man ls

displays the reference page for the ls utility in your command window. The man utilitys -h option displays the HTML Help version of a reference page. Unlike the plain text versions, HTML Help reference pages feature color, formatted text, and links to other related reference pages. To display the HTML Help version of the ls reference page, use:
man -h ls

For more information on the reference page collections provided with MKS Toolkit, see Reference Pages on page 33.

For convenience, related HTML Help reference pages are grouped into collections. For example, when you display the HTML Help reference page for ls, the table of contents (or index) to the left of the page display shows that you are viewing only one of many available pages. The title bar informs us that this is the MKS Toolkit Utilities Reference, one of the reference page collections installed with MKS Toolkit. Others include:
MKS Toolkit Tcl Reference MKS Toolkit UNIX APIs Reference MKS Toolkit Curses Reference

You can also access these collections from the Start menu. To see a list of all reference pages that deal with a particular topic, try the man -k command which searches a database of one line descriptions for a specified keyword. For example:
man -k SNMP

displays a list of reference pages and their one-line descriptions that contain the string SNMP. Finally, MKS Toolkit includes the standard HTML reference pages available for Perl. These HTML pages can also viewed from the Start menu (as the MKS Toolkit Perl Reference) or with the man utility. To view them with the man utility, use the -H option. For example:
man -H mksperl

MKS Toolkit

Command Syntax

displays the main Perl reference page with a framed Table of Contents for all the Perl pages.

Command Syntax
Here are some guidelines about the command syntax of MKS Toolkit utilities.

Case Sensitivity

MKS Toolkit utilities are generally case-sensitive. This means that they distinguish between uppercase and lowercase letters on the command line. For example, you may find a command with both a -f and a -F optionthe uppercase option is entirely different from the lowercase. You will find that the majority of MKS Toolkit input is entered in lowercase; for example, most command options are lowercase. The use and meaning of slashes is one of the trickiest aspects of using MKS Toolkit. It affects how both path names and command options are entered on the command line.

Forward Slashes Versus Backslashes

Path Names
Windows command interpreters use the backslash character (\) to separate directory names from file names. MKS Toolkit utilities accept either forward slashes (/) or backslashes (\). For example, both
cat \mks\etc\profile.ksh

and
cat /mks/etc/profile.ksh

have exactly the same effect when using a standard Windows command interpreter.
For more information on how the MKS KornShell interprets backslashes, see the online Using the MKS KornShell document.

The use of slashes becomes important when using MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell.To these command interpreters, the backslash has a special meaning; thus you should avoid using backslashes in path names. Throughout the rest of this chapter, we use forward slashes in path names passed to MKS Toolkit commands.

Command Options
Standard Windows command line utilities usually specify command options with a forward slash (/) followed by one or more characters. For example
dir /w

Product Overview & Solutions Guide

Getting Started

displays the contents of a directory. Since MKS Toolkit already uses the forward slash character as a separator in path names, the hyphen (-) is used to mark command options, for example
ls -x

to display the contents of a directory.

Note If you invoke standard Windows command line utilities from the MKS KornShell, MKS C Shell, or MKS Bourne-Again Shell, you must remember that non-MKS Toolkit commands use backslashes for path names and forward slashes for options.

Since the backslash (\) character is special to the MKS KornShell C Shell, and MKS Bourne-Again Shell, you must type two backslashes (\\) whenever you want to pass a single backslash to these shells.

Running Scripts and Programs


In most cases, running a Windows program from the MKS KornShell, the MKS C Shell, the MKS Bourne-Again Shell, or a standard Windows command interpreter is as simple as typing the path name of the program to be run. For example,
c:\work\doit.exe

executes the doit.exe program in the c:\work directory from a standards Windows command interpreter, while
c:/work/doit.exe

does the same thing from the MKS KornShell, MKS C Shell, or MKS Bourne-Again Shell. To execute an MKS KornShell script from a standard Windows command interpreter, you can use the sh command. For example, to run the MKS KornShell script c:/work/doit.ksh, you can type:
sh c:/work/doit.ksh

Similarly, you can use the csh command to run a MKS C Shell script from a standard Windows command interpreter. For example:
csh c:/work/doit.csh

runs the MKS C Shell script doit.csh in the c:/work directory.

10

MKS Toolkit

Running Scripts and Programs

Finally, you can use the bash command to run a MKS Bourne-Again Shell script from a standard Windows command interpreter. For example:
bash c:/work/doit.sh

The Search Path

In the examples given so far, the full path name has been given for the scripts and programs being run. However, it is more common to simply type the script or program name and have the shell or command interpreter locate the file using its search path. The search path is the list of directories that the shell or command interpreter searches when looking for a file name that matches the name of the program or script. For the MKS KornShell, the MKS C Shell, and MKS Bourne-Again Shell, the PATH environment variable contains a list of the directories that are searched when just a file name is entered. For the cmd.exe command interpreter, the Path environment variable contains this information.
Note When your current directory (represented as .) is not in your PATH or Path and you want to run a program or script in that directory, you must enter the file name as ./file.

The MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell feature extra rules for locating programs and scripts when no file extension is given. First the shells search for the file in the search path using the extensions given in the SHPATHEXT (for MKS KornShell and MKS Bourne-Again Shell) or CSHPATHEXT (for MKS C Shell) environment variables. If the file is not found, the shells then search for the file using the extension list in PATHEXT plus .ksh, .sh, and no extension for the MKS KornShell and MKS Bourne-Again Shell, or .csh and no extension for the MKS C Shell. If a match is still not found, the shells search for the file with a.bat, .com, .cmd, or .exe extension. Once the shell finds a matching file name, the program or script is executed. Files with .bat, .com, .cmd, and .exe extensions are executed as they would be under the standard Windows command interpreters, while other files are treated as treated as scripts for the shell being run unless their extension is a registered file association (see File Associations) in which case, the file is executed using the associated application.
The reference page for each utility in the online MKS Toolkit Utilities Reference specifies whether that utility uses PATHEXT.

The PATHEXT environment variable is also used by various other MKS Toolkit utilities when searching for matching file names. Running the MKS KornShell script setupPATHEXT.sh, which is located in the ROOTDIR/etc directory, ensures that PATHEXT contains all the standard MKS Toolkit file extensions (.awk, .cpi, .cpio, .csh, .gz, .ksh, .mk, .pax, .pl, .sed,

Product Overview & Solutions Guide

11

Getting Started

.sh, .tar, and .z). Once you understand how KornShell scripts work, you

can modify this script to set up any extensions that you want searched for by those MKS Toolkit shells and utilities that use PATHEXT. .
For more information, see ROOTDIR on page 40. Note Throughout the MKS Toolkit documentation, ROOTDIR is used in path names to indicate the value of the ROOTDIR environment variable, which is the

directory in which you installed MKS Toolkit. When entering such a path name, replace ROOTDIR with either the actual path name assigned to it or use $ROOTDIR (with MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell) or %ROOTDIR% (with Windows command interpreters command.com and cmd.exe).

File Associations

Windows maintains a list of registered file associations that allows a given file extension to be associated with a given file type which in turn is associated with a given application. This allows you to launch an application and load the specified file by simply clicking on the file name in the Windows Explorer or by simply typing the file name on the command line of a shell or command interpreter. For example, if you have Microsoft Word installed on your system, typing file.doc on the command line launches Microsoft Word with file.doc open.

MKS Toolkit File Associations


When you install a member of the MKS Toolkit product family, several MKS Toolkit-specific file associations are automatically registered. The following table shows the registered file extensions, their associated file types, and the MKS Toolkit utilities used to run files with those extensions:
Extension .awk .csh .ksh .pl .sh File Type mks_awk mks_csh mks_shell mks_perl mks_shell_sh Associated MKS Toolkit Utility MKS AWK (awk) MKS C Shell (csh) MKS KornShell (sh) MKS Perl (perl) MKS KornShell (sh)

12

MKS Toolkit

Running Scripts and Programs

This next table shows the optional file associations that may or may not be registered based on your choices during installation:
Extension .cpi .cpio .gz .mk .pax .tar .Z File Type mks_vpax mks_vpax mks_gunzip mks_make mks_vpax mks_vpax mks_uncompress Associated MKS Toolkit Utility Visual Pax (vpax) Visual Pax (pax) gunzip MKS Make (make) Visual Pax (vpax) Visual Pax (vpax) uncompress

To see a complete a list of file extensions registered on your system and their associated file type, type assoc. To see a complete list of file types registered on your system and the command line used to execute each, type ftype. To ensure that all the standard MKS Toolkit file associations are set up (with the exception of any extensions that may already be registered), you can run the MKS KornShell script setupassocs.sh, which is located in the ROOTDIR/etc directory. Once you understand how KornShell scripts work, you can modify this script to set up associations for other extensions.

Creating Your Own File Associations


You can also use the ftype and assoc commands to create your own file associations. Whether you need to use just one or both of these commands depends upon the existing extensions and file types registered on your system. For example, if you want files with a .shl extension to also be recognized as MKS KornShell files, you simply type
assoc .shl mks_shell

And since mks_shell is already a registered file type associated with the MKS KornShell, this is all you need.
For details on how this command line works, see the ksh reference page in the online MKS Toolkit Utilities Reference.

Similarly, if, for some reason, you want to use the Korn-compatible (as opposed to the standard POSIX-compatible) version of the MKS KornShell (ksh) to run files of the mks_shell file type, you would type
ftype mks_shell ksh.exe -H -- %L %*

Product Overview & Solutions Guide

13

Getting Started

to specify the command line to be used to execute these files.

Note When Windows executes such command lines, it replaces %1 with the

short name of the file, %L with the long name of the file, and %* with the names of any arguemnts given to the file.

Finally, suppose you wanted to run files with the .rsh extension using the restricted version of the MKS KornShell. First, you would create a new file type (for example, mks_rsh) and associate it with the appropriate command line:
ftype mks_rsh resh.exe -H -- %L %*

Next, you would associate the .ksh extension with this file type:
assoc .rsh mks_rsh

And thats it. Now, clicking on (or entering on the command line) a script with a .rsh extension runs that script using the resh command.

14

MKS Toolkit

Putting MKS Toolkit to Work for You

MKS Toolkit contains a powerful collection of tools that can be combined


to create solutions. The large number of tools and the large range of computing needs they meet can be a bit daunting. This chapter provides a brief sampling of some of the ways that you can use MKS Toolkit to create the solutions you need.

Developing Software
MKS Toolkit development products offer a complete development and interoperability environment on Windows.

Software Development

MKS Toolkit is an ideal solution for software developers and offers many tools and utilities that simplify daily development tasks: Command line build utilities (make, cc, ar, ld), for migrating and unifying your builds across UNIX and Windows. This includes versions of the widely used GNU Make (gmake) and the GCC compiler. GNU Make is available on the MKS Toolkit CD in the /samples/GNU/makeversion directory, while a version of the GCC compiler tailored for use with the MKS Toolkit environment can be found in the MKS Toolkit Resource Kit. Standard editing and scripting tools for editing source code, make files, and for building complex development environments (vi, grep, find, awk, sed, Perl). MKS Toolkit also includes a graphical version of vi, vi for Windows (viw) that responds to the standard vi commands, but supports standard Windows features such as font control and printer integration the best of both worlds. You can even use viw as your editor of choice in Microsoft Visual Studio. Source differencing tools for determining the scope of changes in your source code (diff, diffh, bdiff), including a side-by-side visual differencing tool (vdiff32). 15

For more information on the utilities mentioned here and their availability in MKS Toolkit products, see the appropriate reference pages in the online MKS Toolkit Utilities Reference and MKS Toolkit Perl Reference.

Product Overview & Solutions Guide

Putting MKS Toolkit to Work for You For more information, see Scheduling Utilities on page 21.

Graphical and command-line scheduling interfaces for easily and automatically starting repetitive tasks, such as nightly builds, backups, and automated test runs. Scripting is an excellent way to solve many computing tasks. MKS Toolkit ships with many commands and utilitiesawk, sed, Perl, Tcl (Tool Command Language), MKS C Shell, MKS KornShell (with enhancements for creating graphical scripts), MKS Bourne-Again Shell and moreto allow you to quickly and easily create powerful and robust solutions for your organization. MKS Toolkit scripts can be written as stand alone utilities or combined with other scripts, MKS Toolkit utilities, or third party commands and applications to help automate routine tasks and increase productivity. Whether you develop HTML, maintain Web pages, or develop Web-based or e-business applications, MKS Toolkit offers many commands to assist with your Internet/Intranet development tasks. MKS Toolkit for Developers and all higher products allow you to manipulate HTML and other Web content as well as pull and push content from local or remote servers with utilities like web, htdiff, htsplit, htstrip, url, mkurl, PScript, and mkscgi. Combined with the scripting and automation tools described on page 24, you can easily automate many routine Web development tasks. The MKS Toolkit migration products implement all of the most frequently used commands, utilities, and APIs of the UNIX 98 and UNIX 03 specifications. They then add hundreds of frequently used platform-specific APIs, commands and utilities to provide greater compatibility with Solaris, HP-UX, AIX, IRIX, Linux and legacy UNIX flavors (for example, SunOS). Applications migrated with these MKS Toolkit products run natively in the Windows subsystem, just like other Windows applications, and can take advantage of all Windows features, including COM, the registry, and Windows Help.

Script Development

For more information, see Text Processing on page 24.

Web Development
For more information on these utilities, see the appropriate reference pages in the online MKS Toolkit Reference and MKS Perl Reference.

Cross-Platform Development
For details on cross-platform development, see the UNIX to Windows Porting Guide. For details on APIs, seethe online MKS Toolkit UNIX APIs Reference, MKS Toolkit Curses Reference, and MKS Toolkit Tcl Reference.

16

MKS Toolkit

Porting Software from UNIX/Linux Systems

Porting Software from UNIX/Linux Systems


MKS Toolkit development products offer a complete development and interoperability environment on Windows. Including over 2700 UNIX APIs necessary to run UNIX/Linux applications and over 300 commands and utilities necessary to run scripts. Because the MKS Toolkit migration products include the MKS Toolkit UNIX APIs and a command-line development environment on Windows, it reduces the complexity of a port from UNIX to Windows to the complexity that many developers are already used to: that of porting from UNIX to UNIX. The basic porting process includes:
For details on each of the steps involved please refer to the The Porting Process chapter in the UNIX to Windows Porting Guide.

Gaining access to the source code on Windows. Examining make files, header files, and source code for porting issues. Compiling and linking. Fixing linkage issues. Debugging. Porting scripts. Integrating with Windows. Distributing the application.

Porting to 64-bit Windows

MKS Toolkit for Enterprise Developers 64-bit Edition simplifies the migration of 32-bit and 64-bit UNIX applications to 64-bit Windows enabling you to deploy your UNIX/Linux applications on both Extended Architecture (for example, AMD64) and Itanium-based platforms. 64-bit Windows is an ideal platform for applications that require large amounts of memory and high-performance such as digital content creation, electronic design automation, data warehousing, mechanical design automation, and advanced scientific and research applications. For an application to migrate to 64-bit Windows, it should be 64-bit clean. What is meant by 64-bit clean? Consider this example:
char *aa = "Hello"; int bb = aa;

For more information on MKS Toolkit for Enterprise Developers 64-bit Edition and porting 64-bit UNIX applications to Windows, see the Porting Applications to 64-bit Windows chapter in the UNIX to Windows Porting Guide.

In truth, this is not very good code, but assignments of pointers to integers can be found throughout legacy UNIX code. The size of an integer in a 64bit environment is 32-bits. So this assignment only functions if the pointer happens to reside below the 32-bit boundary. A 64-bit clean source tree uses

Product Overview & Solutions Guide

17

Putting MKS Toolkit to Work for You

intptr_t or uintptr_t for all types that are to be assigned a pointer value. MKS Toolkit for Enterprise Developers 64-bit Edition (TKEDEV64) ensures that these types are correct for both 32 and 64-bit environments.
For more information on the clean64 utility, see the clean64 reference pages in the online MKS Toolkit Utilities Reference

There is, however, a small fly in the ointment. Win64 defines the size of long to be 32-bits while most 64-bit UNIX implementations define it as 64bits. Thus source that uses long and expects it to be able to assign pointers to the long values would be broken. Thus MKS Toolkit provides the clean64 utility. clean64 can parse all source code and convert long to intptr_t and unsigned long to uintptr_t. This is entirely portable to UNIX and ensures compatibility between UNIX 64-bit ports and TKEDEV64. There are other integer and pointer issues. Consider:
char *aa = "hello"; printf("%x\n", aa);

Since %x expects an integer, the result is truncated to 32-bits. The correct %p should be used to be 64-bit clean. It is also good practice to correctly include headers. For example, malloc() is assumed to return int without the inclusion of malloc.h and in a 64-bit environment, pointer can easily exceed the size of an int. MKS provides some help in this area by optionally forcing malloc() to always return pointers about the 4G boundary during the early stages of your port.
More information on data structure sizes can be found at the following location: http://
unix.org/version2/ whatsnew/login_64bit.html.

Data structure sizes might be different between a 32-bit and a 64-bit version of a product. In particular, 8 byte alignment of structures in memory is often required. To make the source 64-bit clean, the size would have to be normalized if shared across the network or perhaps in a file. The Microsoft compiler is quite helpful in tracking down any 32/64-bit assignments.

Porting X Applications
For more information, see the Porting X Applications chapter in the UNIX to Windows Porting Guide.

MKS Toolkit for Enterprise Developers contains a standard X development environment based on X11R6 and Motif 2.1.30. MKS Toolkit for Enterprise Developers comes with several sample X clients in the samples directory of the MKS Toolkit CD. To run any of these X applications, you must have an X server (such as MKS X/Server) installed on your system. Using the MKS Toolkit migration products, you can easily port a C-language shared library for use with an MKS Toolkit ported application.

Porting Shared Libraries

18

MKS Toolkit

Porting Software from UNIX/Linux Systems For more information, see the Porting Shared Libraries chapter in the UNIX to Windows Porting Guide.

You can also build a shared library that is usable outside a MKS Toolkit ported application, for example, linked with a native Windows application, dynamically loaded into a Visual Basic application, or implementing a COM object or ActiveX control. The MKS Toolkit migration products include examples that demonstrate how to port a shared library to Windows using the product. You can find these examples in the samples/tutorial/dll directory on the MKS Toolkit CD.

Porting Threaded Applications

The MKS Toolkit migration products implement the POSIX threading API (PThreads) as defined in POSIX 1003.1 (1996) (formerly known as POSIX 1003.1c), along with a subset of the extensions added to the UNIX 98 specification (also known as Aspen Threads). POSIX threads are implemented on native Windows threads. This provides optimum interoperability with the Windows operating environment and significantly reduces the overhead for threads performance. However, Windows does not support all the features necessary to implement all the advanced optional POSIX threads features. Threads are kernel-level objects in Windows, and each thread is scheduled in relation to all other threads in the system. Windows 2000/XP/2003/Vista supports SMP hardware implementations, providing true concurrent threading. MKS Toolkit implements all core POSIX thread functions, as well as the core thread-safe (re-entrant) functions, as specified in POSIX 1003.1 (1996).

For more information, see the Porting Threaded Applications chapter in the UNIX to Windows Porting Guide.

Porting Daemons
For more information, see the Porting Daemons chapter in the UNIX to Windows Porting Guide.

Easily port a daemon process from a UNIX/Linux system to Windows with the MKS Toolkit migration products. Windows refers to these processes as services. Windows provides a Service Control Manager that controls starting and stopping services. The MKS Toolkit migration products come with a service framework for building services from your daemon programs, along with a copy of the UNIX inetd daemon ported using this framework. You can find this framework in the samples/tutorial/service directory on the MKS Toolkit CD. This framework lets you build a single service binary that works on virtually all Windows operating systems.

Evolving Ported Applications with COM

After porting your UNIX application to Windows using the MKS Toolkit migration products, there are many ways to evolve your application to take more advantage of the Windows platform. For example, with MKS Toolkit and Microsofts reusable Component Object Model (COM) technology and you can create reusable COM objects from existing UNIX applications.

Product Overview & Solutions Guide

19

Putting MKS Toolkit to Work for You For more information, see the Evolving Applications with COM chapter in the MKS Toolkit UNIX to Windows Porting Guide.

To wrap UNIX/Linux code as a COM object, you must understand the concepts discussed in Building Standalone DLLs in the UNIX to Windows Porting Guide. You can, however, understand most of the COM concepts without reading about standalone DLLs.

Scripting and Automation


One of the main strengths of MKS Toolkit is its ability to create scripts that can be easily modified and updated. Such scripts make it easy to repeat tasks that need to be performed multiple times. When combined with the MKS Toolkit scheduling utilities, it becomes simple to create complex tasks that are repeated at scheduled times and intervals, such as builds or nightly backups.

Shells
For more information, see the sh (MKS KornShell and MKS Bourne-Again Shell) and csh (MKS C Shell) reference pages in the online MKS Toolkit Utilities Reference and the Using the MKS KornShell document. For more information on installing examples, see Sample Sources and Solutions on page 32

The MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell contain similar sets of built-in commands that can be combined to form shell scripts. Shell scripts are designed to be easily run from the command line. In addition to the normal command line scripting available in these shells, the MKS KornShell also contains several commands that allow you to create graphical shell scripts, that is, scripts that take advantage of Windows graphical capabilities, such as dialog boxes, drop down lists, check boxes, and so on. Many of the items available under Accessories in the MKS Toolkit Start menu were created using these commands. Additional shell script examples, if installed, can be in the ROOTDIR/
samples/dlg and ROOTDIR/samples/sh directories.

MKS Toolkit also includes tclsh, the Tcl shell (see Tcl below) and pdksh is included as a sample on the MKS Toolkit CD in the samples/ tools directory. The awk scripting language is designed primarily for manipulating text files, especially for extracting information and presenting it in a given format. awk is ideally suited for manipulating text files that contain information in an organized format, such as text database.
awk differs from many scripting languages in that it automatically loops

Awk

For more information, see the awk reference page in the online MKS Toolkit Utilities Reference and the Using MKS AWK document.

through the files provided as input line-by-line and breaks each line into fields. Actions are normally defined to take place when certain conditions are met (for example, a line contains a string matching a regular expression or a specific line number in the file is reached).

20

MKS Toolkit

Scripting and Automation For more information, see The MKS Toolkit Resource Kit on page 31.

It is not unusual for awk scripts to be called from shell scripts, especially when creating the equivalent of command-line utilities. The outer shell script processes the command line arguments and passes the necessary information to the awk script. The cgrep utility in the MKS Toolkit Resource Kit is an example of this. In addition to MKS AWK (awk), MKS Toolkit also includes GNU AWK (gawk) in the samples directory on the MKS Toolkit CD.

Perl
For more information on Perl and PScript, see the online MKS Toolkit Perl Reference.

Perl is an eclectic but popular scripting language that borrows syntaxes and commands from the C programming language, awk, sed, shell scripting languages, and many other places. Perls wide range of commands and functions and the ability to add extensions make it ideal for tasks such as quick prototyping, system utilities, software tools, system management tasks, database access, networking, and Web programming. For example, the COM module provided in the MKS Toolkit version, lets Perl communicate with Windows COM objects. In addition to Perls standard command line abilities, MKS Toolkit includes PScript which allows Perl to be embedded in HTML web pages.

Tcl

Tcl (Tool Command Language) is a very simple scripting language that is easily extensible, has a consistent command syntax, and features a wide range of commands. It is highly portable and is ideally suited as an integration tool, that is, a tool that is used by one application to communicate with another. In truth, Tcl is actually both a scripting language that can be run from the Tcl shell (tclsh) and a library of routines, the Tcl development APIs, that can be embedded in C applications. The ability to embed Tcl in C applications allows Tcl to serve as the command language for the C application. tclsh and the scripting language are available in all MKS Toolkit products, while the embeddable library is only available with the MKS Toolkit migration products. The MKS Toolkit Scheduling Suite includes command-line utilities and the graphical MKS Toolkit Scheduler that serve as interfaces to the Windows Task Scheduler. Using these interfaces provides greater feedback and flexibility than is available with the Windows Task Scheduler. The at command-line utility schedules a task to run at a specified time. The batch command-line utility schedules a task to run immediately. The crontab command-line utility lets you create, edit, and view a text file that contains the scheduling information for one or more tasks.

For more information, see the online MKS Toolkit Tcl Reference.

Scheduling Utilities
For more information on these utilities, see the MKS Toolkit Scheduling Solutions Guide available from the Start menu and the appropriate reference pages in the online MKS Toolkit Utilities Reference.

Product Overview & Solutions Guide

21

Putting MKS Toolkit to Work for You

The taskrun command-line utility schedules a task to run at a specified time and sends the output and errors produced by the task to a specified location. This command is primarily intended for use by the at, batch, and crontab utilities although it can also be used directly. The wts command-line utility is similar to the at utility, but allows you to schedule a task to run on a remote machine and to remove or edit an existing task.
For more information, see the MKS Toolkit Scheduler online help.

The MKS Toolkit Scheduler graphical utility (tksched) allows you to schedule tasks using a graphical interface that features greater scheduling feedback and flexibility than the Windows Task Scheduler. The mksrv command-line utility lets you run any program or script as a service. Once set up as a service, the program or script can be run automatically on system start-up and can be stopped and restarted like any other service.

mksrv

Connecting to Remote Machines


The connectivity components available in the MKS Toolkit products provide you with the means to interactively access remote Windows, UNIX, and Linux machines.

Remote Utilities

All MKS Toolkit products come with remote utilities (rsh, rexec, rlogin, rcp) for accessing other UNIX and Windows machines. They also include the server-side components for these utilities (rshd, rexecd, telnetd) so that your Windows machine can accept remote requests. The rsh and rexec utilities execute commands on a remote machine. The rexec utility is used to execute a single command, while rsh creates a shell on the remote machine and executes a command in that shell. These utilities have corresponding Windows services (rshd and rexecd) that let your Windows machine respond to rsh and rexec requests from other machines. The rconfig, grconfig, and rsetup utilities are provided to set-up and configure the remote utilities and services. In addition, MKS Toolkit products include the rcp (remote copy) command for moving files between machines. It uses the same mechanism as rsh, so if you can rsh to another machine, you can easily copy files. You can even do third-party copies where neither the source nor the target files reside on your machine.

For more information on the remote utilities, see the MKS Toolkit Connectivity Solutions Guide available from the Start menu and the appropriate reference pages in the online MKS Toolkit Utilities Reference.

22

MKS Toolkit

Connecting to Remote Machines For information on setting up a .rhosts file, see the rhosts reference pages in the online MKS Toolkit Utilities Reference.

If you need to do more than execute a command on a remote machine or copy a file to or from it, you will want to start a login session on it. Assuming that your .rhosts file on that machine has been configured correctly, use the rlogin command followed by the name of the machine you want to log in to. For example,
rlogin solaris2

Using rlogin, you can establish a remote session on any machine that is running an rlogind service (or daemon). MKS Toolkit includes a rlogind service and most UNIX machines run rlogind by default. MKS Toolkit also includes telnetd, a telnet service which lets a user on a remote machine connect to your machine in a manner similar to rlogin. Finally, the xterm X terminal emulator lets you connect to machines using X windows without the need to run an X server (such as MKS X/Server) on your machine.

Secure Utilities

For environments that require secure and encrypted connections to remote machines, all MKS Toolkit products contain a suite of secure remote utilities (secsh, sftp, scp) and the corresponding server-side components (secshd, sftp-server). The secure utilities are intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel. The secure X11 feature of secsh allows you to run graphical X based applications through the secure transport.
sftp is an interactive file transfer program, similar to ftp, which performs all file copy operations over the encrypted secsh transport.

For more information on the secure utilities and Visual SFTP, see the MKS Toolkit Connectivity Solutions Guide available from the Start menu and the appropriate reference pages in the online MKS Toolkit Utilities Reference.

Finally, there is Visual SFTP. Visual SFTP is a powerful Windows Explorer extension that lets you easily drag and drop files through a secure connection just as easily as you would on your local network. Seamlessly integrated with Windows Explorer, Visual SFTP lets you open one or multiple connections and transfer or manipulate files found on remote Windows, UNIX/Linux, or any other system that supports the SSH protocol.

Graphical Tools

With MKS X/Server, MKS offers an X server for displaying X Window System-based graphical applications, including OpenGL and Motif applications, on Windows.

Product Overview & Solutions Guide

23

Putting MKS Toolkit to Work for You For more information, see the X Server data sheet on the MKS Web site. If MKS X/Server is installed, see MKS X/Server Help in the MKS XServer program group on the Start menu.

Fully network-capable, MKS X/Server can display applications on Windows from a UNIX host, and is bundled with MKS Toolkit for Interoperability and MKS Toolkit for Enterprise Developers. MKS X/Server is also available as an add-on to all other MKS Toolkit products. A Japanese version of MKS X/ Server is also available. As discussed previously, all MKS Toolkit products also contain xterm (and kterm for Japanese users).

Text Processing
For more information, see the Text Processing chapter of the Basics of the MKS Toolkit document available from the Start Menu.

One of the basic functions of the MKS Toolkit is text processing. Since most MKS Toolkit utilities use text files in some way, creating and manipulating such files is a useful skill when creating almost any kind of MKS Toolkitbased solution. MKS Toolkit provides several text processing utilities to handle any variety of text processing jobs, such as editors like the fully interactive vi editor, simple text formatting utilities like c, banner, or fmt, and complex formatting systems like groff and its related utilities.

The vi Screen Editor


For more information, see the vi reference page in the online MKS Toolkit Utilities Reference.

vi is a complex and powerful text editing tool. From simple text entry to complex text processing tasks like macros, vi can handle it all. You can even call other MKS Toolkit commands from within vi to perform their

actions on a selected portion of text. To help you in learning how to use vi, the ROOTDIR/sample/guide directory contains an interactive tutorial in the files browse.v, edit.v, doc.v, and program.v. To use the tutorial, simply view the files in the order listed using vi itself. In addition to the standard vi editor, MKS Toolkit also includes vi for Windows (viw), which adds Windows functionality such as mousecontrolled cut-and-paste, scrollbars, and printing to vis standard features. When you need to perform the same editing task (such as replacing one text string with another) on multiple files, a utility like sed comes in handy. The sed utility is a non-interactive stream editor. You do not use it in an interactive session like vi, but rather provide it with a list of editing commands either in a file or on the command line, and sed then provides those commands on a specified group of text files.

For more information, see the viw online help.

The sed Utility


For more information, see the sed reference page in the online MKS Toolkit Utilities Reference.

24

MKS Toolkit

Text Processing

Searching for Text


For information on the grep family utilities and regular expression, see the grep, ugrep, and regexp reference pages in the online MKS Toolkit Utilities Reference.

Often, when dealing with a large number of text files, its useful to be able to quickly see which files contain a specified string of text or a string of text that matches a specified pattern known as a regular expression. For such purposes, MKS Toolkit contains the grep family of utilities. The fgrep utility searches for lines in files that contain a specified string of text; the egrep utility searches for lines in files that contain a string that matches an enhanced regular expression; and the grep utility, by default, searches for lines in files that contain a string that matches a basic regular expressions.With the use of options, these utilities can simply report a list of files that contain matching strings or the number of lines in each file that contain matches. Finally, the Ultragrep graphical utility (ugrep) lets you search a selection of files that match a given pattern for lines that contain a string that matches a regular expression. MKS Toolkit contains several utilities designed to provide text formatting capabilities including: The c utility arranges text in a file into a multiple columns. The shorter the lines, the more columns c can create. The banner utility takes a string of text and creates large versions of the characters in the string using xs to draw the characters. This utility can be used to produce small signs or posters. The fmt utility is a simple text formatter that can format a text file into tidy paragraph. It has the option of creating different styles of paragraphs and, if desired, justifying lines so that they are the same length. fmt is useful for formatting short notes or e-mail messages. The fold utility breaks lines in a text file at a specified point or at the last blank before that point. fold can make a file that contains lines longer than the screen width more readable. The expand utility replaces tabs in a text file with an appropriate number of spaces to preserve the files formatting. The unexpand utility replaces spaces with tabs in a similar manner. The nl utility adds line numbers to each line of a text file. The pr utility formats a text file with pagination and adds headers and footers.

Simple Text Formatting Utilities


For information on these utilities, see the appropriate reference pages in the online MKS Toolkit Utilities Reference.

Displaying Text Files

MKS Toolkit contains several utilities for displaying text files including: The cat utility simply displays a text file without any breaks. cat is most useful for short files.

Product Overview & Solutions Guide

25

Putting MKS Toolkit to Work for You For information on these utilities, see the appropriate reference pages in the online MKS Toolkit Utilities Reference.

The more and pg utilities display a text file one screenful at a time, pausing for input at the end of each screen. Both utilities also provide the capability to search for a text string. The head and tail utilities display a specified number of lines at the beginning and end of text files, respectively. This is useful when you only want to see a certain number of lines to identify the files contents.

The groff Formatting System


For more information on the groff formatting system, see the man pages for groff and related utilities in the samples directory on the MKS Toolkit CD.

The GNU groff formatting system consists of the groff utility and its related utilities. It takes a text file containing special mark-up commands and produces output in a variety formats such as PostScript and HTML. In addition to the standard formatting commands available, groff also lets you define macro packages that let you simplify the mark-up of your text file by assigning groups of commands to a single new command. The groff formatting system includes several pre-defined macro packages for purposes such as writing man pages, papers, and memos. These groff formatting system (including groff, the related utilities, and the pre-defined provided as samples in the samples directory on the MKS Toolkit CD.

Other Text Manipulation Utilities


For information on these utilities, see the appropriate reference pages in the MKS Toolkit Utilities Reference.

In addition to the utilities already described, MKS Toolkit contains a variety of utilities that manipulate text files. The wc command displays the number of lines, words, and characters in a text file. The flip command converts UNIX-style text file to Window-style and vice versa. The csplit and split utilities break a text file into smaller text files. csplit uses specified criteria to determine where the file is split, while split simply breaks the file into smaller files of a given number of lines. The sort utility sorts the lines in a text file based on specified criteria. The spell utility spell-checks a text file using both a dictionary provided with MKS Toolkit and user dictionaries. The tr utility translates characters. Two strings are provided on the command line. When a character in the input file occurs in the first string; it is replaced by the corresponding character in the second string. The cut utility extracts specified fields or characters from each line of the input file.

26

MKS Toolkit

System Administration

The paste utility concatenates corresponding lines from the specified input files.

System Administration
MKS Toolkit allows you to set up user accounts, group associations, system permissions, end-user desktops, manage services, network mounts, the registry, monitor your system, network, and applications as well as a myriad of other system administration tasks.

Application and Network Availability Monitoring


For more information, see the AlertCentre Add-on page on the MKS web site at
www.mkssoftware/products/ ac/default.asp.

The AlertCentre Add-on to MKS Toolkit products is a complete solution for monitoring, alerting and corrective action automation scheduling. AlertCentre can monitor your mission-critical systems and applications 24 hours a day, seven days a week to provide you with the peace of mind of knowing that your network, applications, and Internet/Intranet-based information systems are running normally. Available as a download from the MKS web site and easily customized to fit your needs, the AlertCentre Add-on triggers actions to be taken upon failures or system events. Using these actions, you can alert people of failures and critical system status through e-mail, cell phone, page, SNMP trap, or another method that youve defined. AlertCentre can also trigger monitors, scripts, and programs as actions, letting you take automated corrective actions. As we all know, the Information Technology (IT) industry is plagued with a notoriously high turnover rate. Solving this problem, that's for Human Resources. Dealing with the rapid turnover, however, is a system administrators task. Finding more efficient and automated ways to manage these user and group accounts would save enough time to allow system administrators to concentrate on the really tough issues facing IT. Deploying applications has to be one of the most time consuming processes that falls within the system administration realm. Any process or tool that can help push updates and new applications to your users desktops can only be a good thing. Did you know you could automate the installation of the MKS Toolkit products themselves? Combining the power of the MKS Toolkit utilities with the standard installer lets you easily deploy MKS Toolkit throughout your organizations.

User and Group Manipulation


See User and Group Manipulation on the MKS Web site under White Papers at www.mkssoftware.com/docs.

Automating Installations
See Automating the MKS Toolkit Installation on the MKS Web site under White Papers at www.mkssoftware.com/docs.

Product Overview & Solutions Guide

27

Putting MKS Toolkit to Work for You

Synchronizing Passwords
For more information, see the MKS Toolkit Evaluation Guide for System Administrator available from the Start menu.

Many system administrators have both UNIX and Windows machines to administer. Their users must access both kinds of machines, but want only one password and do not want to have to change their passwords two or more times. How important is password synchronization in a mixed environment and how can you ensure that passwords changed on either UNIX or Windows are propagated back to the other systems? MKS Toolkit can help. You have a managed network and have added several Windows boxes and you need them all to play well with your Network Management software. Windows comes with built in SNMP protocol support and provide some counters to permit the workstation (or server) to be considered a managed node. MKS Toolkit contains a full suite of SNMP command line utilities to help you better manage your Windows machine in this environment.

Simple Network Management Protocol (SNMP)


See Network Management and SNMP on the MKS Web site under White Papers at
www.mkssoftware.com/docs.

Windows Management Instrumentation (WMI)

Windows Management Instrumentation (WMI), as with any COM interface, can be accessed using MKS Perl. Perl is particularly well suited as a scripting language for COM. The MKS Toolkit Evaluation Guide for System Administrators has a sample of calling WMI to retrieve network adapter settings. For more information, see http://msdn.microsoft.com/library/
backgrnd/html/wmicim.htm.

Setting and Implementing Corporate Standards


See the reference pages for desktop, registry, and mount in the online MKS Toolkit Utilities Reference.

You have hundreds of existing users and you want to add an icon to all of their desktops; or you want to map a drive for every user logging into all machines on the network. The built-in Windows GUI tools allow you to make these kinds of modifications, but you have to visit each machine serially to affect the necessary changes. How do you make bulk edits to remote registries or user profiles? The power of MKS Toolkit scripting, combined with such utilities as desktop, registry, and mount, can be used to solve large numbers of one-time or repetitive tasks. Have you ever wanted to start a service on a remote machine from the command line or a script? NET does not control remote machines. Why try to remember all the NET command options when all you need is our service command to fully manage all services locally or on a remote machine? In

Controlling Services

28

MKS Toolkit

Backups, File Archiving, and Compression

one script you can enumerate all the services, grep (text search) for the one you want, stop it, use registry to update the Windows registry, and restart your services.

Backups, File Archiving, and Compression


MKS Toolkit provides many utilities that can be combined with the scripting capabilities of MKS KornShell, MKS C Shell, or Perl to create fully automated backup scripts that MKS Toolkit Scheduler can run at preset times.
For more information on creating backup solutions with MKS Toolkit, see the online MKS Toolkit Backup and Tape Handling Solutions Guide available from the Start menu.

At the heart of the MKS Toolkit solution are the archiving utilities: tar, cpio, pax, and Visual Pax. An archive is a collection of files and directories that have been combined into a single file, usually for the purpose of backup or transfer. With these utilities, you can create archives of any set of files and directories and restore these archives on any Windows system as well as on many other operating systems. These utilities use standard archive formats, which makes transferring archives between operating systems a reasonably simple task. The MKS Toolkit versions of these utilities (unlike other Windows-based versions) also let you preserve Windows 2000/XP/2003/ Vista security information while remaining 100% compatibility with standard archives. In addition, the MKS Toolkit contains other utilities that can be useful when performing backups and archiving files:

For more information on these utilities, see the appropriate reference pages in the online MKS Toolkit Utilities Reference.

The find utility selects files and directories meeting a given criteria (such as all files changed since a given date). This makes it easy to perform selective and incremental backups. The dd utility can copy a disk block by block. You can use it to create an exact copy of the disks image (also referred to as mirroring a disk). The mt utility can be used to pass control information to and from tape devices installed in your Windows system. The zip and gzip utilities are compression and file packaging tools. They are analogous to a combination of the UNIX commands tar and compress and are compatible with PKZIP (Phil Katz's ZIP for MSDOS systems). Companion programs (unzip, gunzip) unpack zip/gzip archives. The zip/gzip and unzip/gunzip programs can work with archives

Product Overview & Solutions Guide

29

Putting MKS Toolkit to Work for You

produced by PKZIP, and PKZIP and PKUNZIP can work with archives produced by zip/gzip. The compression utilities are useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily compressing unused files or directories. The bzip2 (and corresponding bunzip2) compresses specified files using a mix of Burrows-Wheeler block-sorting and Huffman coding. This process often achieves greater compression than the more conventional approaches used by other compression utilities.
For information on related utilities, see the mkszip, uncompress, gzcat, pcat, bz2cat, bzip2recover, bzdiff, bzcmp, bzmore, bzless, bzgrep, bzegrep, and bzfgrep reference pages in the online MKS Toolkit Utilities Reference.

The pack (and corresponding unpack) utility compresses specified files using a Huffman minimal redundancy code on a byte basis. Huffman compression is a lossless compression algorithm that is ideal for compressing text or program files. It is most commonly used in the file formats JPEG and MPEG. The remote utilities and services (rlogin, rsh, rcp, rexec, rlogind, rshd, and rexecd) let you communicate with remote systems. You can use these utilities to back up files and directories on remote machines. Likewise, if you require a secure environment, you can use the secure utilities and services (secsh, secshd, scp, sftp, and sftp-server) for remote communications. As mentioned above, MKS Toolkit Scheduler lets you schedule your backup command or script to run at desired times. MKS Toolkit Scheduler is a graphical scheduling interface. You can launch the program by either clicking Start > Programs > MKS Toolkit > Accessories > Scheduler or typing tksched at the command line. MKS Toolkit Scheduler offers a wide variety of scheduling options. For example, you can schedule a program or script to run at a given time on a given day or on a recurring basis, such as the first Friday of every month. You can also choose to run a program or script on a recurring basis over a given time period (for example, every hour between 1:00 a.m. and 6:00 a.m.). Additionally, if you do not want scheduled events to be run, you can temporarily disable MKS Toolkit Scheduler and reenable it at a later time.

30

MKS Toolkit

Additional Information

This chapter describes additional sources of information about MKS


Toolkit.

The MKS Toolkit Resource Kit


The MKS Toolkit Resource Kit is a valuable collection of tools, code, and information to help you with your system administration and development needs. This kit is the result of years of experience by our Consulting Services staff in supporting hundreds of customers.
For more information on the MKS Toolkit Resource Kit, see
www.mkssoftware.com/ reskit.

The MKS Toolkit Resource Kit is shipped with the MKS Toolkit migration products and is downloadable for all MKS Toolkit customers from the MKS Web site. The MKS Toolkit Resource Kit is a dynamic entity and the downloadable self-extracting version is always up-to-date. For system administrators using MKS Toolkit, the Resource Kit offers the following additional material: Custom utilities and scripts for many system administration tasks, including: manipulating user accounts managing groups batch modification of permissions reporting on disk usage

System Administration

Development

For developers using MKS Toolkit, the Resource Kit offers the following additional material: Sample scripts.

Product Overview & Solutions Guide

31

Additional Information

UNIX Application Programming Interfaces with their Windows implementations (C source code) that can be used to help you complete your port. Additional UNIX libraries ported to Windows with MKS Toolkit. Additional UNIX utilities ported with MKS Toolkit that you may find useful on Windows. Tutorials to help you port, integrate, evolve, and modernize your UNIX application. A special MKS Toolkit version of the Microsoft ATL COM AppWizard, to assist you in creating COM components from UNIX/Linux software.

GCC

In addition to the development-related features listed above, the MKS Toolkit Resource Kit also features a version of the widely used GCC compiler that has been specifically tailored for use with the MKS Toolkit migration environment. In addition to the MKS Toolkit Resource Kit, there are two other sources for example sources and solutions: Installed Examples When you install a MKS Toolkit product, you have the option of also installing sample scripts for MKS Toolkit utilities, such as awk, dlg, sh, and csh. These examples are installed in the ROOTDIR/samples directory. If you did not install these examples during your initial installation of MKS Toolkit, you can install them later by running the MKS Toolkit Installer. Samples on the MKS Toolkit CD The samples directory on the MKS Toolkit CD contains a variety of sample sources for use with the MKS Toolkit migration products. MKS Toolkit Evaluation Guides When you install a MKS Toolkit product, you have the option of also installing the MKS Toolkit Evaluation Guide(s). Depending on which product you are installing, the MKS Toolkit Evaluation Guide for System Administrators, the MKS Toolkit Evaluation Guide for

Sample Sources and Solutions

32

MKS Toolkit

Other Documentation

Developers, or both are installed. Various scripts associated with the guides are also installed. These guides provide a series of examples designed to introduce you to the wide range of functionality in the MKS Toolkit product family, as it applies to either system administrators or developers.

Other Documentation
This book is only part of the documentation for the MKS Toolkit product family. The following sections describe

MKS Toolkit UNIX to Windows Porting Guide Reference Pages

The MKS Toolkit UNIX to Windows Porting Guide describes how you can use these two products to develop, port, migrate, and deploy UNIX/Linux applications. While aimed primarily at users of MKS Toolkit migration products, all members of the MKS Toolkit product family include this document as a PDF file that can be accessed from the Start menu. All MKS Toolkit products include a collection of reference pages describing the command-line utilities and APIs provided. The HTML Help versions of these reference pages can accessed via either the Start menu or the man -h command. The plain text versions can be accessed with the man command. MKS Toolkit Utilities Reference The MKS Toolkit Utilities Reference describes most commands and utilities provided with all members of the MKS Toolkit product family. It can also be accessed by typing tkutil.chm on the command line. MKS Toolkit Tcl Reference The MKS Toolkit Tcl Reference describes the commands and procedures of the Tcl scripting language provided with all members of the MKS Toolkit product family as well as the Tcl development APIs provided with the MKS Toolkit migration products. It can also be accessed by typing tcltk.chm on the command line. MKS Toolkit UNIX APIs Reference The MKS Toolkit UNIX APIs Reference describes the UNIX APIs provided with the MKS Toolkit migration products. It can also be accessed by typing tkapi.chm on the command line.

Product Overview & Solutions Guide

33

Additional Information

MKS Toolkit Curses Reference The MKS Toolkit Curses Reference describes the Curses APIs and utilities provided with the MKS Toolkit migration products. It can also be accessed by typing tkcurses.chm on the command line. In addition to these HTML Help reference pages, MKS Toolkit also includes a standard set of Perl documentation in HTML that can be accessed through the Start menu or with the man -H command. MKS Toolkit Perl Reference The MKS Toolkit Perl Reference describes the Perl scripting language provided with all members of the MKS Toolkit product family. It uses HTML frames to provide a convenient table of contents similar to that available for the HTML Help pages. This framed environment can also be accessed by typing man -H mksperl on the command line.

User Guides and Tutorials

All members of the MKS Toolkit product family include several user guides and tutorials that can be accessed from the Start menu. The documents included are: Basics of the MKS Toolkit This document provides an introduction to some of the over 300 commands and utilities included with the MKS Toolkit product family. Using the MKS KornShell This document provides an introduction to the basic features of the MKS KornShell and also describes some of the unique graphical features of the shell. Using MKS AWK This document provides an introduction to the AWK scripting language in general and MKS AWK in particular. Using MKS Make This document is an introduction to using the MKS make utility. MKS Toolkit Backup and Tape Handling Solutions Guide This document describes the various archiving tools provided with MKS Toolkit and how they can be combined with other MKS Toolkit utilities to meet your backup and tape handling needs. MKS Toolkit Connectivity Solutions Guide This document describes how to configure and use the tools in the MKS Toolkit Connectivity Suite which includes the remote utilities and

34

MKS Toolkit

Other Documentation

services, the secure utilities and services, the telnetd service, and the xterm utility. MKS Toolkit Scheduling Solutions Guide This document provides an introduction to the MKS Toolkit Scheduling Suite (the MKS Toolkit Scheduler and the at, batch, crontab, taskrun, and wts utilities) and shows how you can combine these tools with other MKS Toolkit utilities to create a variety of scheduling solutions.

Online Help

Most graphical utilities in MKS Toolkit (for example, Visual Difference, Visual Pax, vi for Windows (viw), and the MKS Toolkit Scheduler) feature their own online help that can be launched from within the application. All members of the MKS Toolkit product family come with a set of release notes that provides additional installation and configuration information as well as a summary of changes and fixes made since the last release. Over the years, a variety of white papers and articles have been written dealing with aspects of the MKS Toolkit. These documents have been collected on the MKS Web site and new ones are being added on an ongoing basis. These documents cover a wide selection of MKS Toolkit tools and abilities. Topics range from installing MKS Toolkit in an unusual environment to using its utilities for system administration to integrating standard databases with MKS Toolkit scripts. While these documents may not provide you with a complete solution for your particular situation they are often useful for seeing how various aspects of the MKS Toolkit can be used together to solve similar problems. MKS has also accumulated a lot of technical knowledge about the MKS Toolkit. This information has been sorted and stored in the MKS Toolkit Knowledge Base, a searchable database. In addition to the database itself, the MKS Web site also features answers to a variety of Frequently Asked Questions (FAQ) on various topics concerning MKS Toolkit and related products.

Release Notes

Articles and White Papers


Articles and white papers are found in the Product Documentation section of the MKS Web site at
www.mkssoftware.com/docs.

Knowledge Base
The MKS Toolkit Knowledge Base and FAQ lists are found on the MKS Web site at
www.mkssoftwarecom/ support/kb.

Product Overview & Solutions Guide

35

Additional Information

36

MKS Toolkit

Configuration

For more information about installing your MKS Toolkit, see the Release Notes.

Once you have installed your MKS Toolkitusually as easy as putting the

CD in your drive and following the on-screen instructionsyou may want to customize it to meet your needs. This chapter describes ways in which MKS Toolkit can be configured.

Registry Database
When configuring a member of the MKS Toolkit product family, the MKS Toolkit installation adds several entries to the registry database. These entries include global variables, housekeeping commands, and services as well information needed to customize the internal operations of the operation system. MKS Toolkit utilities run from a command interpreter (MKS KornShell, MKS C Shell, MKS Bourne-Again Shell, Windows Command Prompt, and so on) inherit the environment set up in the registry database.

Environment Variables
For more about environment variables, see the envvar reference page and the ENVIRONMENT VARIABLES section of individual utility reference pages in the online MKS Toolkit Utilities Reference as well as the Environment Variables chapter of the MKS Toolkit UNIX to Windows Porting Guide.

Certain environment variables should be correctly set for the MKS Toolkit Utilities to work properly. To display a list of all the environment variables currently set on your system, use the env command. The following sections describe many of these environment variables in more detail.

Product Overview & Solutions Guide

37

Configuration

CCG

CCG points to the cc configuration file to enable compilers for use with MKS make. The configuration file corresponding to the Microsoft Visual C++ compiler is automatically installed as compiler.ccg, and cc automatically looks for the file ROOTDIR/etc/compiler.ccg.

If you want to change compilers permanently, modify the ROOTDIR/etc/ generic.ccg file to suit your compiler and then copy it to ROOTDIR/etc/ compiler.ccg. Sample value: ROOTDIR/etc/compiler.ccg

COMSPEC

The COMSPEC (on Windows 2000/XP/2003/Vista, ComSpec) variable is usually set up by your operating system to point to the native command interpreter, cmd.exe. The MKS KornShell uses COMSPEC to run scripts with a .bat or.cmd extension, depending on your operating system. Sample value: C:\WINDOWS\system32\cmd.exe

HOME

HOME points to the path name of the home directory assigned to a particular user. If it is not set, HOME defaults to the current working directory.

Since Windows 2000/XP/2003/Vista users do not necessarily have a unique home directory, the default profile.ksh on these systems sets HOME to a directory based on USERNAME. Sample value: C:/Documents and Settings/robin

LOGNAME

The LOGNAME environment variable tells the system who you are. You must set LOGNAME if you intend to use mailx, since mailx needs to know a login name to see if you have mail waiting and to send out mail in your name. The default profile.ksh sets LOGNAME to a value of %USERNAME%. Sample value: Robin

MAKESTARTUP

MAKESTARTUP points to the name of the default rules file (startup file). The default rules file (ROOTDIR/etc/startup.mk) contains macro definitions

and options for the default compiler, as well as various meta-rules. If this environment variable is not set, MKS make looks for the file ROOTDIR/ etc/startup.mk, which is installed with MKS make. If you want to change compilers permanently, modify the ROOTDIR/etc/ generic.mk file to suit your compiler and then copy it to ROOTDIR/etc/ startup.mk. Sample value: ROOTDIR/etc/startup.mk

38

MKS Toolkit

Environment Variables

MAN_CHM_INDEX

When you use the man -h command to display the HTML Help version of a reference page, man uses the MAN_CHM_INDEX environment variable to locate the index files (with the .idx extension) that indicate precisely which reference page to display. This variable is normally set during installation and should only be changed if the reference pages are moved from their installed location. Sample value: ROOTDIR/etc/chm/tkutil.idx;ROOTDIR/etc/chm/
tcltk.idx

MAN_HTM_PATHS

When you use the man -H command to display HTML reference pages (such as those provided for Perl), man uses the MAN_HTM_PATHS environment variable to locate those files. Sample value: ROOTDIR/etc/htm/perl;ROOTDIR/etc/htm/perl/ pod;ROOTDIR/etc/htm/perl/ext;ROOTDIR/etc/htm/perl/lib

MAN_TXT_INDEX

Like the MAN_CHM_INDEX environment variable, MAN_TXT_INDEX is used by the man command to locate the index files used for displaying plain text reference pages Sample value: ROOTDIR/etc/tkutil.idx;ROOTDIR/etc/tcltk.idx

PATH

Whenever you run a program, the system must locate the file containing that particular program. The PATH environment variable defines the search path that is used by the current shell. The names of directories to be searched are listed in the value assigned to PATH. You can use the which command to display the full path to the version of the executable is being accessed. For example, which sort. For example, if you want the current shell to search the directories c:/bin and c:/mks (in that order) using command.com or cmd.exe, you could set your PATH with the command:
set PATH=c:\bin;c:\mks

If you are using the MKS KornShell, define your current path with:
export PATH="$ROOTDIR/bin;c:/mks"

Since the order of directories specified in the search path is significant, you should always specify the directory containing MKS Toolkit executables before any directories containing commands with a similar name. For example, the native sort programs are inferior to the MKS Toolkit sort. In general, you want to ensure that you are getting MKS Toolkit commands when name duplication exists.

Product Overview & Solutions Guide

39

Configuration

On Windows 2000/XP/2003/Vista systems, the situation is slightly more complicated. These systems store their environment variables in mixed case, but ignores the case differences. Thus, the environment variables Path and PATH are identical. MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell distinguish between Path and PATH; all MKS Toolkit commands that are run from these shells use PATH. The default profile.ksh for Windows 2000/XP/2003/Vista includes the directories listed in the Path environment variable in the MKS Toolkit's PATH, so commands run from MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell search the Path as part of the PATH.
Note UNIX systems use the colon (:) to separate path names in PATH. However, because Windows uses the colon (:) as part of the drive identifier, MKS Toolkit uses the semicolon (;) instead to separate path names in PATH and other similar lists of path names.

Sample value: ROOTDIR/bin; ROOTDIR/bin/X11; ROOTDIR/bin/


mksnt

ROOTDIR

MKS Toolkit needs a way to determine the device and directory where other MKS Toolkit commands and files are stored. This directory is called the MKS Toolkit's root directory. Programs and information files are kept in subdirectories of this root directory. For example, MKS Toolkit commands are, by convention, found in ROOTDIR/mksnt or ROOTDIR/bin. You can choose any directory to serve as the MKS Toolkit's root directory. Most people accept the installers default value, which is c:/Program Files/MKS Toolkit. When entering a path name that is shown in the documentation as including
ROOTDIR, you must replace ROOTDIR with one of two values:

the actual path name that is assigned to the ROOTDIR environment variable. For example, if ROOTDIR is set to c:/mks, and the documentation refers to ROOTDIR/etc, enter c:/mks/etc. This method works with the Windows command interpreters, MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell. the string $ROOTDIR. Using the same example as the first method, you would enter the ROOTDIR/etc path name as $ROOTDIR/etc. This method only works with MKS KornShell, MKS C Shell, and MKS Bourne-Again Shell, which know to interpret the string $ROOTDIR as the value of the ROOTDIR environment variable. When working from the Windows command prompt, use %ROOTDIR% instead.

40

MKS Toolkit

MKS Toolkit Configuration Files

Sample value: c:/Program Files/MKS Toolkit

SHELL

The MKS KornShell is commonly called by other MKS Toolkit programs, and it should be available as ROOTDIR/mksnt/sh.exe. If you customize your system and place sh.exe in a different location, you must set the environment variable SHELL to point to the correct location of the shell. Sample value: ROOTDIR/mksnt/sh.exe

TMPDIR

MKS Toolkit utilities need to create temporary files for certain operations. These files are placed in the directory named by the TMPDIR environment variable. You can point TMPDIR to a RAM disk for greater speed. By default TMPDIR is set to the Windows temp directory. As a result of system reboots or other events, programs can be shut down without the opportunity to remove the temporary files that they created. Hence, from time to time, you may want to remove old files that have been left in this directory. Sample value: c:/temp

Additional Environment Variables

Besides the variables listed previously, there are additional environment variables that affect applications created using the MKS Toolkit migration products. For a description of these environment variables, see the Environment Variables chapter of the MKS Toolkit UNIX to Windows Porting Guide.

MKS Toolkit Configuration Files


When you install a member of the MKS Toolkit product family, several configuration files are installed, some in the ROOTDIR/etc directory and others in your home directory. The following sections describe these configuration files as well as additional files that can be used to configure the various shells provided in the MKS Toolkit.

MKS KornShell

The following files are used by the MKS KornShell (sh):

Product Overview & Solutions Guide

41

Configuration

profile.ksh
The MKS KornShell script in the file ROOTDIR/etc/profile.ksh is executed whenever a login version of the MKS KornShell is invoked (with sh -L). If this file does not exist, the shell looks for ROOTDIR/etc/ profile and runs it instead if present. In turn, either ROOTDIR/etc/ profile.ksh or ROOTDIR/etc/profile invokes the Windows-specific profwin.ksh. Additionally, the MKS Toolkit installation program places a user-specific
profile.ksh file in the users home directory. If this file does not exist, the shell first looks for a file name .profile in the users home directory and

runs it instead if present. If neither of these two files is found, the shell looks for a file named profile.ksh (and if not found, one named .profile) in the current directory and executes it if found. The file in ROOTDIR/etc is executed for all users while the file in the users home directory is only executed for that specific user.

profwin.ksh
The MKS KornShell script in the file ROOTDIR/etc/profwin.ksh is invoked by ROOTDIR/etc/profile.ksh to set up Windows-specific attributes of the MKS KornShell.

environ.ksh
The MKS Toolkit installation program places a file named environ.ksh in the users home directory. When that user invokes a login version of the MKS KornShell, this file is executed after the profile.ksh and profwin.ksh files. By changing the value of the ENV environment variable, which is initially set to point to environ.ksh, you can have another MKS KornShell script executed in place of environ.ksh.

MKS BourneAgain Shell

The following files are used by the MKS Bourne-Again Shell (bash):

ROOTDIR/etc/profile.ksh
As with the MKS KornShell, the script in the file ROOTDIR/etc/ profile.ksh is executed whenever a login version of bash is invoked. If this file does not exist, bash looks for ROOTDIR/etc/profile and runs it instead if present. In turn, either ROOTDIR/etc/profile.ksh or ROOTDIR/etc/profile invokes the Windows-specific profwin.ksh as described for the MKS KornShell. This file is executed for all users.

42

MKS Toolkit

MKS Toolkit Configuration Files

.bash_profile, .bash_login, profile.ksh, .profile


After running the script in ROOTDIR/etc/profile.ksh or ROOTDIR/ etc/profile, bash looks in order for the files .bash_profile, .bash_login, profile.ksh, and .profile in the users home directory and executes the first one found. If the -noprofile option is specified, none of these files are executed.

ROOTDIR/etc/bash.bashrc, .bashrc
When bash is invoked as a non-login shell, the script in the file ROOTDIR/ etc/bash.bashrc is executed if present. bash then looks for the file .bashrc in the users home directory and executes it if present. If this file does not exist, bash executes the file specified by the ENV environment variable (normally, environ.ksh in the users home directory) if present. MKS Toolkit does not install a .bashrc file in the users home directory. The file in $ROOTDIR/etc contains bash commands to be executed for all users, while the file in the users home directory is only executed for the specific user. If the -norc option is specified, neither of these files are executed. If the rcfile file option is given, the specified file is executed instead of either of these files.

ROOTDIR/etc/bash.bash_logout, .bash_logout
When a login version of the MKS Bourne-Again Shell is exited, the script ROOTDIR/etc/bash.bash_logout is executed if present. Additionally, the .bash_logout file in the users home directory is also executed if present. The file in ROOTDIR/etc version of this file contains bash commands that are to be executed for all users, while the file in the users home directory contains commands to only be executed for that user.

MKS C Shell

The following files are used by the MKS C Shell (csh):

cshrc.csh
Like profile.ksh for the MKS KornShell, the file ROOTDIR/etc/ cshrc.csh is a MKS C Shell script that is executed whenever the MKS C Shell (csh) is started. The MKS Toolkit installation program also places a user-specific version of cshrc.csh in the users home directory. This file is also executed when the MKS C Shell is started by that user.

Product Overview & Solutions Guide

43

Configuration

login.csh
When a login version of the MKS C Shell is started, the script ROOTDIR/ etc/login.csh is executed as is a user-specific version of this script (placed in the users home directory). The ROOTDIR/etc version of this file contains MKS C Shell commands that are to be executed for all users, while the version in a users home directory contains commands to only be executed for that user.

logout.csh
When a login version of the MKS C Shell is exited, the script ROOTDIR/etc/logout.csh is executed as is a user-specific version of this script (placed in the users home directory). The ROOTDIR/ etc version of this file contains MKS C Shell commands that are to be

executed for all users, while the version in a users home directory contains commands to only be executed for that user.

MKS Toolkit Control Panel Applet


Specific uses of the MKS Toolkit control panel applet are described in the UNIX to Windows Porting Guide, the MKS Toolkit Connectivity Solutions Guide, and the MKS Toolkit Solutions Guide.

All members of the MKS Toolkit product family install the MKS Toolkit control panel applet. From this applet, you can do the following: review support and license information about your MKS Toolkit installation and operating system such as the components installed and their version numbers. set parameters for the remote services, the secure shell client and service, telnetd, and for applications created using the MKS Toolkit migration products. manage the services that are part of the MKS Toolkit. set up viw for use with Microsoft Visual Studio. configure Windows Firewall for handling MKS Toolkit connectivity utilities. check for updates to your MKS Toolkit product on the MKS Web site.

44

MKS Toolkit

MKS Toolkit Control Panel Applet

Product Overview & Solutions Guide

45

Configuration

46

MKS Toolkit

Index

Symbols
$CCG 38 $COMSPEC 38 $ComSpec 38 $CSHPATHEXT 11 $HOME 38 $LOGNAME 38 $MAKESTARTUP 38 $MAN_CHM_INDEX 39 $PATH 11, 3940 $Path 11, 40 $PATHEXT 1112 $ROOTDIR 12, 40 $SHELL 41 $SHPATHEXT 11 $TMPDIR 41 $USERNAME 38 %USERNAME% 38 .awk extension 1113 .bash_login 43 .bash_profile 43 .bashrc 43 .bat extension 11 .cmd extension 11 .com extension 11 .cpi extension 1113 .cpio extension 1113 .csh extension 1113 .exe extension 11 .gz extension 1113 .ksh extension 1113 .mk extension 1113 .NET 3 .pax extension 1113 .pl extension 1113 .profile 43

.rhosts 23 .sed extension 1113 .sh extension 1113 .tar extension 1113 .z externsion 1113

Numerics A

64-bit Windows 1718

ActiveX control 19 advanced development utilities 2 AlertCentre 27 AllertCentre 27 appc command 5 ar command 15 Arbritrary Precision Programmable Calculator 5 archives 29, 34 Aspen threads 19 assoc command 13 at command 2122, 35 automatic command run 7 awk command 12, 1516, 2021, 32, 34

B
backslashes versus forward slashes 9 backups 2, 4, 2930, 34 banner command 2425 bash command 7, 11, 4243 batch command 2122, 35 bdiff command 15 Bourne-Again Shell 7 bunzip2 command 30

Product Overview & Solutions Guide

47

Index

bz2cat command 30 bzcmp command 30 bzdiff command 30 bzegrep command 30 bzfgrep command 30 bzgrep command 30 bzip2 command 30 bzip2recover command 30 bzless command 30 bzmore command 30

desktop command 28 development products 2 development utilities 1516 diff command 15 diffh command 15 dlg command 32 documentation 3335

E
egrep command 25 env command 37 environ.ksh 4243 environment variables 3741 %USERNAME% 38 CCG 38 COMSPEC 38 ComSpec 38 CSHPATHEXT 11 HOME 38 LOGNAME 38 MAKESTARTUP 38 MAN_CHM_INDEX 39 MAN_HTM_PATHS 39 MAN_TXT_INDEX 39 PATH 11, 3940 Path 11, 40 PATHEXT 1112 ROOTDIR 12, 40 SHELL 41 SHPATHEXT 11 TMPDIR 41 USERNAME 38 Evaluation Guides 2, 4, 6, 28, 32 evolving ported applications 19 expand command 25

C
c command 2425 case sensitivity 9 cat command 25 cc command 15, 38 CGI scripts 16 clean64 command 18 cmd.exe 7, 1112, 3839 COM (Component Object Model) 3, 16, 1921, 28 command options 910 command syntax 9 command window 7 command.com 12, 39 compiler.ccg 38 compress command 29 compression 2930 configuration files 4144 connectivity services 2223, 30 connectivity utilities 12, 2223, 30 control panel applet 44 controlling services 28 cpio command 29 creating file associations 13 crontab command 2122, 35 cross-platform development 16 csh command 7, 10, 12, 20, 32, 43 cshrc.csh 43 csplit command 26 curses 3, 34 cut command 26

daemons, porting 19 dd command 29 Deployment Wizard 6

fgrep command 25 file associations 1113 file associations, creating 13 file extensions .awk 1213 .bat 11 .cmd 11 .com 11 .cpi 1213

48

MKS Toolkit

Index

.cpio 1213 .csh 1213 .exe 11 .gz 1213 .ksh 1113 .mk 1213 .pax 1213 .pl 1213 .sed 1213 .sh 1113 .tar 1213 .z 1213 file types 1214 files .bash_login 43 .bash_profile 43 .bashrc 43 .profile 43 .rhosts 23 compiler.ccg 38 cshrc.csh 43 environ.ksh 4243 generic.mk 38 login.csh 44 logout.csh 44 profile.ksh 38, 40, 4243 profiwin.ksh 42 profwin.ksh 42 ROOTDIR/etc/bash.bash_logout 43 ROOTDIR/etc/bash.bashrc 43 setupassocs.sh 13 setupPATHEXT.sh 11 startup.mk 38 find command 15, 29 flip command 26 fmt command 2425 fold command 25 forward slashes versus backslashes 9 free space 5 ftp program 23 ftype command 13

generic.mk 38 GNU AWK 21 GNU groff 26 GNU Make 15 gps command 5 grconfig command 22 grep command 15, 25, 29 groff command 24, 26 gunzip command 13, 29 gzcat command 30 gzip command 2930

H
head command 26 htdiff command 16 htsplit command 16 htstrip command 16

inetd daemon 19

ksh command 13 kterm 24 kterm command 24

L
ld command 15 license 7 Linux 1, 16, 22 login.csh 44 logout.csh 44 ls command 10

M
mailx command 38 make command 13, 15, 34, 38 man command 8, 3334, 39 MAN_HTM_PATHS 39 MAN_TXT_INDEX 39 migration products 6, 1619, 21, 3233, 41, 44 MKS Bourne-Again Shell 7, 912, 16, 20, 37, 40,

G
gawk command 21 GCC compiler 15 gdf command 5

4243

Product Overview & Solutions Guide

49

Index

MKS C Shell 7, 912, 16, 20, 29, 37, 40, 4344 MKS KornShell 7, 914, 16, 20, 29, 34, 3740, 42

43

MKS Toolkit control panel applet 6, 44 MKS Toolkit for Developers 2 MKS Toolkit for Enterprise Developers 2, 18, 24, 41 MKS Toolkit for Enterprise Developers 64-bit Edition 3,

1718

MKS Toolkit for Interoperability 24 MKS Toolkit for Professional Developers 44 MKS Toolkit Scheduler 5, 2122, 2930, 35 MKS X/Server 4, 18, 2324 mkscgi command 16 mksrv command 22 mkszip command 30 mkurl command 16 monitoring 27 more command 26 Motif 24, 18, 23 mount command 28 mt command 29

software 1720 threaded applications 19 X applications 18 POSIX threads 19 PostScript 26 pr command 25 process status 5 profile.ksh 38, 40, 4243 profwin.ksh 42 PScript 16, 21

R
rconfig command 22 rcp command 22, 30 reference pages 33 reference pages, viewing 8 registry command 2829 registry database 16, 2729, 37 regular expressions 25 release notes 35 remote services 2, 2223, 30, 35, 44 remote system administration 4 remote utilities 2, 2223, 30, 34 resh command 14 Resource Ki 32 Resource Kit 6, 15, 21, 3132 rexec command 22, 30 rexecd service 22, 30 rlogin command 6, 2223, 30 rlogind service 23, 30 rlogind service (daemon) 23 ROOTDIR/etc/bash.bash_logout 43 ROOTDIR/etc/bash.bashrc 43 ROOTDIR/etc/profile.ksh, files ROOTDIR/etc/profile.ksh 42 rsetup command 22 rsh command 6, 2223, 30 rshd service 22, 30

N
nl command 25

O
online help 35 OpenGL 34, 23 OpenGL APIs 2

pack command 30 password synchronization 4, 28 paste command 27 path names 9 pax command 13, 29 pcat command 30 pdksh shell 20 Perl 12, 1516, 21, 2829, 34 pg command 26 PKUNZIP 30 PKZIP 2930 porting daemons 19 shared libraries 1819

samples 19, 21, 31 samples, CD 1821, 32 samples, installed 20, 32 scheduling utilities 12, 45, 2122, 2930, 35 scp command 23, 30 scripting and automation 13, 10, 16, 2021, 29

50

MKS Toolkit

Index

search path 11 secsh command 6, 23, 30 secshd service 23, 30 Secure FTP 7 secure services 2, 30, 35, 44 secure utilities 2, 23, 30, 35, 44 secure X11 23 sed command 1516, 21, 24 service command 28 Service Control Manager 19 service framework 19 services, controlling 28 setupassocs.sh 13 setupPATHEXT.sh 11 sftp command 23, 30 sftp-server service 23, 30 sh command 7, 10, 12, 20, 32, 42 shared libraries, porting 1819 shells and scripting utilities 2 Simple Network Management Protocol (SNMP) 28 SNMP (Simple Network Management Protocol) 28 software development utilities 2, 1516 software, porting 1720 sort command 26, 39 spell command 26 split command 26 Start menu 57 startup.mk 38 system administration 1, 4, 2728, 3133 system file changes 37

text processing 1, 2427 threaded applications, porting 19 tksched command 22, 30 tr command 26

U
ugrep command 56, 25 Ultragrep 6, 25 uncompress command 13, 30 unexpand command 25 UNIX 1, 34, 1519, 2224, 26, 2829, 32, 40 UNIX 03 16 UNIX APIs 2, 1617, 3233 unpack command 30 unzip command 29 url command 16 user guides 34

vdiff32 command 15 vi command 15, 24 viewing reference pages 8 Visual Difference 56, 15, 35 Visual Pax 56, 13, 29, 35 Visual SFTP 23 viw command 7, 15, 24, 35, 44 vpax command 13

T
tail command 26 tape devices 29 tape handling 34 tape utilities 2, 29 tar command 29 taskrun command 22, 35 Tcl (Tool Command Language) 2, 16, 21, 33 Tcl development APIs 2, 21, 33 Tcl Shell 7 Tcl shell 2, 2021 tclsh 7 tclsh command 2021 TCP/IP 23 telnet command (Windows) 6 telnet service (telnetd) 2, 2223, 44

W
wc command 26 web command 16 Web development utilities 2, 16 which command 39 Windows command interpreter 7, 1112, 3840 Windows Management Instrumentation (WMI) 28 WMI (Windows Management Instrumentation) 28 wts command 22, 35

X
X applications, porting 18 X server 2, 18, 23 X terminal emulator 23 X Windows 34, 18, 23 xterm command 7, 2324

Product Overview & Solutions Guide

51

Index

Z
zip command 2930

52

MKS Toolkit

You might also like