• Aucun résultat trouvé

DOS/HP-UX Text File Compatibility

Dans le document SoftPC® User's Guide HP 9000 Series (Page 70-76)

Text files created with DOS editors and with HP-UX editors are not created equal. Consider this example.

How HP-UX Perceives DOS Files

Using EDLIN, you create a file named dosfile.txt containing the following lines:

This file was created with EDLIN.

It is in DOS format.

You store this file in drive E: so that HP-UX can access it, then you escape to HP-UX and use the vi editor to examine it. In vi, dosfile.txt looks like this:

This file was created in EDLIN.-M It is in DOS format.-M

-Z

IIdosfile.txt"[Incomplete last line] 3 lines, 56 characters.

Notice the control characters at the end of each line, and the control-Z that terminates the file. Also note the bottom line of the vi display, which indicates DOS created this file with an incomplete last line.

How DOS Perceives HP-UX Files

Now suppose you create a file with vi called hpuxfile.txt that contains the following lines:

This file was created in vi.

It is in HP-UX format.

Now you return to DOS and use EDLIN to examine this file. Here is what you see:

l:*This file was created in vi.

2: It is in HP-UX format.

3:

Converting DOS/HP-UX File Formats

In order to easily use DOS to edit HP- UX files and vice versa, the SoftPC provides two commands which convert DOS format to HP-UX format, and HP-UX format to DOS format.

DOS2UX converts DOS files into a form HP- UX can easily read. For example, to convert dosfile.txt into HP-UX format, we could execute:

dos2ux dosfile.txt >hpuxtemp.txt I Return I

This creates a new file hpuxtemp.txt which contains the contents of dosfile.txt, but in HP-UX format. If we now use vi to edit hpuxtemp.txt, we see:

This file was created in EDLIN It is in DOS format.

"hpuxtemp.txt" 2 lines, 53 characters.

Notice that the control charcters are gone and the message at the bottom complaining about an incomplete last line has disappeared.

To convert an HP-UX file into DOS format, use UX2DOS:

ux2dos hpuxfile.txt >dostemp.txt I Return I

Again, the newly-created DOS format file is stored in dostemp. txt: the original file is unchanged. If we now use EDLIN to edit dostemp. txt, we see a well-behaved file:

1:*This file was created in vi.

2: It is in HP-UX format.

3:

UX2DOS and DOS2UX can be executed both from DOS and HP-UX.

Using SoftPC Devices and 4-17 Running Applications

LPT Devices

DOS supports three parallel ports (LPTl, LPT2 and LPT3). On a PC, these ports are used to connect printers, plotters, and other similar devices. The SoftPC emulates these ports using standard HP-IB and RS-232 interfaces.

Parallel printer connections to the PC are normally made via a Centronics-compatible printer port, known as an LPT port. In a SoftPC system, output sent to LPTI (for example) is routed to the printer assigned to LPTl. The printer may be connected to a HP-IB or RS-232 interface, for example:.

LPT1 /dev/doslp

In addition to connecting actual printers to the LPT ports with device files, you can also "connect" an ordinary HP- UX file. For example, if you include the following line:

LPT1 /tmp/dosprt

all data sent to LPT 1 is "printed" in the file dosprt in the \ tmp directory of drive E:.

You can also assign an HP-UX pipe to a port, as in this example which pipes LPT2 output to the HP-UX line printer spooler:

LPT2 IIp -or >/dev/null 2>&1

Setting LPT Port Printer Characteristics

You can control the vertical and horizontal spacing of an LPT printer with the following MODE command:

mode Iptn: horz, vert,P

Iptn The printer's port (LPT1, LPT2 or LPT3).

horz The horizontal spacing (80 or 132) in characters/inch.

vert The vertical spacing (6 or 8) in lines/inch.

P Indicates the port is assigned to a printer.

IJII·

The following example sets the printer assigned to LPT1 to 132 characters/inch horizontal spacing and 6 lines/inch vertical spacing.

mode Ipt1:132.6.p

The MS-DOS 3.3 Reference Manual describes MODE.

Using SoftPC Devices and 4-19 Running Applications

COM Devices

The SoftPC uses your computer RS-232 interfaces to emulate PC RS-232C ports, COM! through COM4. "Connections" are made via COMn as follows: are physically connected to computer RS-232 ports. The reason you assign HP-IB plotters to COM ports is because that is how these devices are normally connected to a PC, and application software generally expects to find these devices on serial ports.

Settting COM Port Communications Characteristics

Whenever you assign a device to a COM port, you can use the MODE

command to set the port's communication characteristics to that of the device assigned to it.

For example, the Laserjet printer requires the following settings:

• 9600 baud

• No parity

• 8 data bits/character

• 1 stop bit/character

• The P option, which identifies the device as a printer.

If the Laserjet is assigned to COMl, the MODE command is:

mode coml:96.n.8.1.p

See the MS-DOS 3.3 Reference Manual for the details of MODE.

Rerouting LPT Port Output to a COM Port

Many application programs assume your printer is attached to LPTl. When you use a serial printer such as a Laserjet, you can reroute data sent to LPTl to the COM port where your serial printer is connected. (In reality, it is probably better to reconfigure the ports.)

To do this, you use the MODE command:

mode lpt#:=com#

• lpt# is the LPT port to be rerouted .

• com# is the COM port that your printer is assigned to.

Example: mode Iptl: =coml

reroutes output sent to LPTl to the printer assigned to COMl.

To automatically reroute LPT output each time you start DOS, include this MODE command in your autoexec. bat file.

Mouse

The SoftPC includes emulation software that allows your HP-HIL mouse to emulate a Microsoft BUS mouse in DOS application programs.

To use the mouse, you must:

1. Run the Xll version of SoftPC. (The terminal version does not support a mouse.)

2. Execute the MOUSE command to load the supporting software for the mouse. To do this, type:

C:\INSIGNIA\MOUSE I Return I

or include the MOUSE command in your autoexec.bat file to

automatically load mouse support each time you start a DOS session.

The MOUSE command does not support any options.

Using SoftPC Devices and 4-21 Running Applications

Dans le document SoftPC® User's Guide HP 9000 Series (Page 70-76)