Chapter 5

Shell Variables

And then one day, hurray! Another way for gnomes to say hooray!

Syd Barret, The Gnome

Using shell variables

gsh supports variables in the shell environment. These variables can be used by any shell utility or script. Many EXE files and shell scripts pre-define certain shell variables that contain formatting options or other options for a specific utility. As an example, the ls utility looks for the variable TERM that defines the terminal type currently being used. When ls is started, it reads the value of the TERM variable and avoids printing Apple II specific MouseText characters if the set terminal does not support them.

gsh has set aside certain variables for its specific use. Shell utilities should be aware of these variables and use them appropriately. Use caution when changing shell variables, because the change could affect more than just the shell.

of Shell Variables

There are two types of processes that are involved in any discussion of a multitasking system.The original process, gsh for example, is called a parent process. If gsh invokes a process, such as ls, cp, or mv, that process is called a child process. It is possible for any process to define a variable. These variables will not be made available to other processes unless the program that defined the variable specifically makes them available.

The export command makes variables defined by one process available to its children. See the example gshrc shell script shown in Chaper 1 Customizing the Shell Environment. In the case of the shell, most of its variables are exported and, therefore, all shell utilities can read the value of a shell variable. However, programs cannot change the value of a shell variable. In general, executables share their environment with that of the shell, so that a utility can change variables in its parent's environment. This allows communication between programs and the shell.

Description of Pre-defined Shell Variables

The following variables have special meaning to gsh. Shell variables are not case sensitive.

- $0, $1, $2, ...

  String values that contain the arguments to a shell script. Variable 0 contains the name of the script. The first argument begins with variable 1 and so on. To expand a variable, use the dollar character, "$" (See Chapter 5 Accessing shell variables)

  $< When encountered, the variable is expanded using a value obtained from standard input. This provides a means of obtaining user input in script files. Note that the shell variables are expanded before the command-line is executed (See Chapter 5 Accessing shell variables) When prompting the user for input, be sure that the prompt is in a separate command-line than the $<. Also, if the user wishes to enter a value with spaces, he must quote what he types with double-quotes.

  $ECHO A boolean value that, if defined, will cause commands in a shell script to be echoed to standard output.

  $FIGNORE This variable, if set, contains a list of filename suffixes. When doing command or filename completion, gsh will ignore any filename with a suffix listed in FIGNORE. For example, you might want to set fignore=".A .ROOT .SYM" to ignore object files and other compiler droppings.

  $HISTORY A numeric value that contains the number of history commands (command-lines) remembered. If the value is 0 or HISTORY is undefined, all commands will be remembered. Previous command-lines can be called back with the UP-ARROW and DOWN-ARROW (See Chapter 2, History Editing Commands).

  $HOME The HOME directory is the main directory of the shell; it is the directory gsh defaults to when it starts. The tilde character ("~") can be used as a shorthand method of accessing the HOME directory (as discussed in Chapter 3, Tilde Expansion).

  $IGNOREEOF A boolean value that, if enabled, will prevent ^D from exiting the shell.

  $NOBEEP A boolean value that, if set, will prevent gsh from sounding the speaker when errors occur while editing a command-line.

  $NODIREXEC A boolean value that, if set, will disable gsh's feature of treating directory names as commands; i.e. if a directory is specified as a command, gsh will move to that directory as though the cd command was being used.

  $NOGLOB A boolean value that, if enabled, will disable filename globbing. Command arguments will be passed to their commands "as-is", without any wildcard expansion.

  $NONEWLINE A boolean value that, if set, will disable carriage returns being output before and after command execution. Previous examples given in this manual have this option set.

  $PATH A string value that defines the pathnames where shell scripts, EXE utilities, and SYS16 programs can be found (See Chapter 3, How gsh finds a command). Because GS/OS uses colons as separators in pathnames, gsh cannot allow colons to be used as separators in the PATH variable, as U NIX does. If one of the path entries has a space within it (which is possible with the HFS FST), then the space should be quoted with a backslash, "\".

  $PRECMD Actually an alias and not a variable, if PRECMD is defined it will be executed just before gsh prints the prompt for a command line. For example, alias precmd qtime will print the time in English text before every prompt.

  $PROMPT When gsh prompts you to enter a command, the prompt that appears before the cursor can be customized for your gsh environment. If PROMPT is undefined, the default prompt of "% " is used. The prompt string recognizes certain character sequences in the PROMPT variable and interprets them accordingly. The following are the special characters:

  %h, %!, ! Current history number.

  %t, %@ Current time of day in 12 hour am/pm format.

  %d, %/ Current working directory.

  %~ Current working directory with tilde ("~") replacement.

  %c, %C, %. Trailing component of current working directory.

  %S, %s Inverse mode ON (%S) / OFF (%s).

  %U, %u Begin and end Underline mode (only on terminals that support underline. gnocon will use inverse mode instead.)

  %% Displays a single "%" character.

  %n User name (contents of $USER variable).

  %W The date in mm/dd/yy format.

  %D The date in yy-mm-dd format.

  \n Newline

  \r Carriage Return

  \t Tab

  \b Bell (beep)

  Examples of prompts already used in this manual are "[1]%", and "[/user/root]%"

  These were created by using the commands set prompt "[%h]%" and set prompt "[%d]%".

  $PUSHDSILENT

  If this variable is defined, gsh will not print the directory stack after any of the directory stack commands (See Chapter 4 pushd, popd, .)

  $SAVEHIST A numeric value that contains the number of commands to save to disk when exiting gsh. These commands are then read back in when gsh is restarted which allows old commands to be reused. If the value is 0 or SAVEHIST is undefined, no commands will be saved to disk.

  $TERM This variable contains the name of the terminal emulation that the shell and other applications should use. By default, it is 'gnocon'. When the shell encounters a 'set term' command, it automatically calls the tset command to reload the termcap information. See Appendix F Termcaps.

  $TERMCAP This variable specifies the location of the termcap file. The shell and other applications look for termcap in the /etc directory, but if TERMCAP is set, the fully specified termcap file is used instead. This allows users to install custom termcap entries. See Appendix F Termcaps.

  $USER A string that represents the name of the current user. This variable is usually set by login(1).

Accessing shell variables

Shell variables are defined or changed with the set command. The unset command is used to delete a variable. See Chapter 4 Environment Commands for more information on the set and unset commands

To access shell variables from the command line or a shell script, use the character "$" followed by the variable name. The dollar sign character will expand the variable to its value. If you wish to use the dollar sign character in a string from the command line, remember to enclose it in single quotes or use the "\" escape character. If you use double quotes, the shell will try to expand the variable. To differentiate the variable name from characters that may immediately follow it, the variable name may be optionally surrounded with braces, "{" and "}".This provides a very powerful way of user interaction with shell scripts. As an example,

[1] 9:41pm root> set

PAGER = less

SAVEHIST = 25

PATH = :hard:gno:bin :right:gno:usr:bin

USRMAN = /usr/man

HISTORY = 100

status = 0

fignore = .a .root .sym

TERM = gnocon

LESS = -e

PROMPT = [%h] %S%t%s %C>

HOME = :hard:gno:user:root

user = root

nonewline = 1

[2] 9:41pm root> set history 30 user user1 ; set

PAGER = less

SAVEHIST = 25

PATH = :hard:gno:bin :right:gno:usr:bin

USRMAN = /usr/man

HISTORY = 30

status = 0

fignore = .a .root .sym

TERM = gnocon

LESS = -e

PROMPT = [%h] %S%t%s %C>

HOME = :hard:gno:user:root

user = user1

nonewline = 1

[3] 9:41pm root> unset savehist ; set

PAGER = less

PATH = :hard:gno:bin :hard:gno:usr:bin

USRMAN = /usr/man

HISTORY = 30

status = 0

fignore = .a .root .sym

TERM = gnocon

LESS = -e

PROMPT = [%h] %S%t%s %c>

HOME = :hard:gno:user:root

user = user1

nonewline = 1

[6] 9:43pm root> echo 'Current value of $path = ' $path

Current value of $path = :right:gno:bin :right:gno:usr:bin

[7] 9:44pm root> echo "value of $path = " $path

value of :right:gno:bin :right:gno:usr:bin = :right:gno:bin :right:gno:usr:bin

[9] 9:45pm root> set user1 foo

[10] 9:45pm root> echo $user1

foo

[11] 9:45pm root> echo ${user}1

user11

[12] 9:46pm root> echo "echo '\$path = ' \$path" >> change.path

[13] 9:46pm root> echo "set path \$1" >> change.path

[14] 9:47pm root> echo 'rehash' >> change.path

[15] 9:47pm root> cat change.path

echo '$path = ' $path

set path $1

rehash

[16] 9:48pm root> change.path '/dev/gno/utilities'

$path = /dev/gno/orca /dev/gno/utilities

hashed 22 files.

[17] 9:49pm root> change.path $PATH

$path = /dev/gno/orca /dev/gno/utilities

hashed 55 files.

[18] 9:50pm root> echo this is $homeplate

this is { variable homeplate wasn't found }

[19] 9:51pm root> echo this is ${home}plate

this is /dev/gnoplate { variable home is found }

Appendix A

Sample gsh session

The following represents a sample session in gsh. Many of the features discussed in this manual are reviewed here. Comments are enclosed in braces ("{}").

[1] gno> set

savehist = 25

path = /dev/orca/utilities /dev/gno/orca /dev/gno/utilities

history = 25

prompt = [%h] %C>

user = achin

home = /dev/gno

nonewline = 1

[2] gno> echo environment variable PROMPT = $PROMPT

environment variable PROMPT = [%h] %C>

[3] gno> cat gshrc

{ gshrc is the startup file. }

###

#

# GNO 2.0 gshrc file

#

###

#

# Initialize our environment

#

set path=":hard:gno:bin :right:gno:usr:bin"

set prompt="[%h] %S%t%s %C> "

set home=":hard:gno:user:root"

set term=gnocon

export path prompt home term

setenv history=100 savehist=25

###

#

#Set up standard prefixes for utilities.

#

###

prefix 2 :software:orca:libraries

prefix 3 :software:orca

prefix 4 :software:orca:shell

prefix 5 :software:orca:languages

prefix 6 :software:orca:utilities

prefix 7 :tmp

###

#

# Set up prefixes for Orca2.0(tm)'s benefit

#

###

prefix 13 :software:orca:libraries

prefix 14 :software:orca

prefix 15 :software:orca:shell

prefix 16 :software:orca:languages

prefix 17 :software:orca:utilities

alias ls 'ls -CF'

alias dir 'ls -al'

alias cp 'cp -i'

alias rm 'cp -p rm'

alias mv 'cp -p mv'

setenv usrman='/usr/man'

set fignore='.a .root .sym'

alias zcat 'compress -cd'

setenv pager=less

setenv less=-e

set nonewline=1

#

# Move to home directory

#

cd

[4] gno> cat gshrc > .ttyb&

{ .ttyb is the printer connected to the printer port. }

[2]

[5] gno> echo File \'gshrc\' sent to printer.

File 'gshrc' sent to printer.

[6] gno> alias l 'ls -F'; l

{ The ls "-F" option displays executable and directory files differently. }

:dev:gno

doc/ foo* gsh* gshrc* kern*

man/ message message2 orca/ press.release

release.notes samples/ todo updates utilities/

[7] gno> history

1: set

2: echo environment variable PROMPT = $PROMPT

3: cat .gshrc

4: cat .gshrc > .printer&

5: echo File \'gshrc\' sent to printer.

6: ls

7: history

[8] gno> no_file

no_file: Command not found.

[9] gno> message

message: Not executable.

[10] gno> unset USER

{ Environment variables are not case sensitive. }

[11] gno> set PATH

path = /dev/orca/utilities /dev/gno/orca /dev/gno/utilities

[12] gno> set PROMPT

prompt = [%h] %C>

[13] gno> unset PROMPT

% cp message message2&

[2]

% rm doc&

rm: :dev:gno:doc directory

% rm -r doc&

[3]

% ls *

:dev:gno

foo* gsh* gshrc* kern* man/

message message2 orca/ press.release release.notes

samples/ todo updates utilities/

% echo *

gshrc foo message Finder.Data utilities press.release man release.notes todo

updates gsh kern samples doc orca message2

% echo g* m*

gshrc gsh message man message2

% echo g?

No match.

% pwd

/dev/gno

% clear ; df

.d## Volume Device Free Total Capacity System

---- ---------------- ---------------- ------- ------- -------- -----------

.d1 :system .APPLESCSI.HD01. 25746 50773 49% ProDOS

.d2 :dev .APPLESCSI.HD01. 44868 65108 31% ProDOS

.d3 :usr .APPLESCSI.HD01. 44526 48725 8% ProDOS

.d4 :ram5 .DEV2 493 512 3% ProDOS

% which ls cp echo ps

ls: /dev/gno/utilities/ls

cp: /dev/gno/utilities/cp

echo: Shell Built-in Command

ps: Shell Built-in Command

% echo -n foo

foo % l .dev2 .applescsi.hd01.01

{ Because of the previous "echo -n", the PROMPT is displayed on the line where echo output ended. }

:ram5

df echo history ls ls.ram5

ls.system prefix ps set which

:system

AppleworksGS/ BASIC.System* HyperCard/ ProDOS* a2fx/

basic.launcher* emacs.icon fontasm/ gutenberg/ icons/

kermit/ publish.it/ review shr.pic/ shrinkit/

snowterm/ system/

% alias print 'echo'; alias copy 'cp'; alias delete 'rm'; alias

catalog 'ls -l'; alias rename 'mv'

{ Useful aliases for Orca fans. }

% alias

l: ls -F

print: echo

copy: cp

delete: rm

catalog: ls -l

rename: mv

% set PROMPT='[!] %C> '

[30] gno> cd samples

[31] samples> cmpl ps.c keep=ps > .dev2/ps&

[2]

[32] samples> cmpl kill.c keep=kill > .dev2/kill&

[3]

[34] samples> ls dummy_dir

[35] samples> ls -9

ls: unrecognized option `-9'

usage: ls [-acdfgilqrstu1ACLFR] [name ...]

[36] samples> ls -9 >& .dev2/error

{ Each pathname has a device name entry (cf. ps). }

[37] samples> cat < /ram5/error

ls: unrecognized option `-9'

usage: ls [-acdfgilqrstu1ACLFR] [name ...]

[38] samples> ls *.c;grep \#\i\n\c\l\u\d\e [^sfd]*.c

{ grep searches for a regular expression in a file and outputs the lines that match. }

comp.c dp.c edit.c ffdir.c gar.c

kill.c link.c ps.c setdebug.c

kill.c:#include <stdio.h>

kill.c:#include <memory.h>

kill.c:#include "3/work/gno/conf.h"

kill.c:#include "3/work/gno/proc.h"

kill.c:#include "3/work/gno/kerntool.h"

gar.c:#include <stdio.h>

gar.c:#include <orca.h>

gar.c:#include "3/work/gno/kerntool.h"

gar.c:#include <gno/signal.h>

ps.c:#include <stdio.h>

ps.c:#include <memory.h>

ps.c:#include <string.h>

ps.c:#include <orca.h>

ps.c:#include "3/work/gno/conf.h"

ps.c:#include "3/work/gno/proc.h"

ps.c:#include "3/work/gno/kvm.h"

edit.c:#include <stdio.h>

edit.c:#include <stdlib.h>

edit.c:#include <string.h>

edit.c:#include <ctype.h>

edit.c:#include <types.h>

edit.c:#include <gsos.h>

edit.c:#include <shell.h>

edit.c:#include <orca.h>

edit.c:#include <stddef.h>

edit.c:#include <texttool.h>

edit.c:#include <gno/kerntool.h>

comp.c:#include <stdio.h>

comp.c:#include <stdlib.h>

comp.c:#include <string.h>

comp.c:#include <ctype.h>

comp.c:#include <types.h>

comp.c:#include <shell.h>

comp.c:#include <gsos.h>

comp.c:#include <orca.h>

comp.c:#include <texttool.h>

comp.c:#include <gno/kerntool.h>

link.c:#include <stdio.h>

link.c:#include <stdlib.h>

link.c:#include <string.h>

link.c:#include <ctype.h>

link.c:#include <types.h>

link.c:#include <shell.h>

link.c:#include <orca.h>

link.c:#include <texttool.h>

link.c:#include <gno/kerntool.h>

[39] samples> head link.c

{ head displays the first few lines of a file. }

/*

parsing code for compile, cmpl, cmplg

The options flags are set up in a bizarre format as follows:

76543210 76543210 76543210 76543210

yz qrstuvwx ijklmnop abcdefgh

[40] samples> set PATH

path = /dev/orca/utilities:/dev/gno/orca:/dev/gno/utilities

[41] samples> unset PATH

[42] samples> set PATH

Variable Not Found

[43] samples> rm m[e][s][s]age[2]

[44] samples> rehash

hashed 0 files.

[45] samples> rm who_cares about_the parameters

{ rm will not be recognized as a command because the hash-table is empty. }

rm: Command not found.

[46] samples> set path = /dev/orca/utilities ~/orca ~/utilities

/dev/orca/utilities /dev/gno/orca /dev/gno/utilities =

[47] samples> set PATH

path = =

[48] samples> set path="~/../orca/utilities ~/orca $HOME/utilities"

{ Filename expansion will be performed before PATH is set. }

[49] samples> set path

path = /dev/orca/utilities /dev/gno/orca /dev/gno/utilities

[49] samples> rehash

hashed 68 files.

Appendix B

When gsh is started, GS/OS assigns certain values to individual prefixes, and usually the gshrc file also sets some prefixes. A total of 32 prefixes are available to the user. The following list documents each prefix and the purpose of each.

- Number Description

  @ AppleShare prefix. If GNO resides on an AppleShare volume, this prefix is set to the pathname of the user's directory on the file server; otherwise, this prefix is set to the same pathname as prefix number 9.

  * Boot volume prefix. It is not possible to modify the value of this prefix with the shell's prefix command. The only other way to access this prefix is the GS/OS _GetBootVol call.

  0 Prefix 0 is the current working directory. It is the prefix that is changed by the cd command.

  1 Directory a program resides in. In the shell, this is usually /bin. The kernel sets this prefix (and 9/) appropriately for each program that is executed.

  2-8 Used by Orca 1.0 languages and utilities

  2 If the ORCA languages are being used, prefix 2 points to the ORCA Libraries directory.

  3 This prefix should point to the directory that contains ORCA.SYS16.

  4 ORCA Shell directory should point to the directory that contains the EDITOR, SYSTABS, SYSCMND, etc. files.

  5 ORCA Languages directory

  6 ORCA Utilities directory

  7 ORCA Temp directory - setting this to a RAM disk makes certain editor operations faster.

  9 Same as prefix 1/

  10-12 Standard input, output, and error device names. GNO sets these to be '.ttyco'.

  13 Same as prefix 2/ above if Orca 2.0 languages are being used.

  14 Same as prefix 3/

  15 Same as prefix 4/

  16 Same as prefix 5/

  17 Same as prefix 6/

  18 Same as prefix 7/

Appendix C

gsh tries, when an error occurs, to output an informative error message that will lead you to the solution of your problem. This appendix documents all gsh error messages and what the probable cause of the problem might be. There are five classes of errors: generic gsh, command-entry, syntax, execution, and built-in. Each error is discussed separately.

Generic gsh Errors

These errors can typically occur at any time and may not be directly related to something the user has done. Some of them are trivial, and some are very serious and should be reported immediately.

gsh: There are stopped jobs.

All jobs must be killed before exiting the shell. Use the jobs and kill commands.

Command Editing Errors

Command editing errors occur when entering information on the command-line. If you try to move the cursor too far to the left or right of your command-line (i.e. before the first character or after the last character), an error will occur. At present, gsh indicates a command-entry error with a Beep. This is to notify you that the action you requested is not possible.

Syntax Errors

Syntax errors occur while gsh is trying to understand the command you have entered on the command-line. Problems arise when you wish to quote an argument (") and only enter one quote.

gsh: Missing ending ".

A second " wasn't supplied when quoting text.

gsh: Missing ending '.

A second ' wasn't supplied when quoting text.

gsh: Too many arguments, so no dessert tonight.

The command-line contained too many arguments which exceeded the available memory allocated by gsh.

gsh: Not enough memory for arguments.

No memory was available for allocating command-line arguments.

gsh: Extra '<' encountered.

gsh: Extra '>' or '>>' encountered.

gsh: Extra '>&' or '>>&' encountered

Text may be redirected to only one file.

gsh: No file specified for '<'.

gsh: No file specified for '>' or '>>'.

gsh: No file specified for '>&' or '>>&'.

A file must be specified when redirecting I/O.

gsh: '|' conflicts with '>' or '>>'.

gsh: '|' conflicts with '<'.

Piping is another form of redirection, thus pipes and redirections cannot be mixed.

Execution Errors

After gsh parses the command-line, it will then execute the command and pass any arguments to the command. If, however, the command does not exist, gsh will report an error. The reason the command does not exist could be either the command name was typed wrong or the command does not exist.

$0: Command not found.

$0 represents the command to be executed. Either the command name was entered incorrectly or the command does not exist. Recheck the spelling of the command and check $PATH to make sure the command exists in the pathname list.

$0: Not executable.

$0 represents the command to be executed.

heh heh, next time you'll need to specify a command before redirecting.

Redirection was specified but the command-line had no command.

Cannot fork (too many processes?)

An error was encountered forking a process. The most likely culprit is there are too many processes running.

Built-in Command Errors

These are errors which can be returned by many of the built-in commands. Every built-in also contains a Usage message on the proper invocation method.

cd: Not a directory

Tried to change the cwd to a file that isn't a directory.

prefix: could not set prefix, pathname may not exist.

GS/OS Prefix command failed, most likely the pathname did not exist or the disk is damaged.

setdebug: Unknown flag

An unknown flag was sent to setdebug. Run setdebug with no arguments for a list of possible flags.

ps: error in kvm_open()

ps was unable to access the process data structure. It would be amazing that the kernel is still running for this error to occur.

set: Variable not specified

A variable was not passed to set, for example, "set =bar". Make sure the variable name was specified without the preceding dollar sign. For example, if foo is not set, then "set $foo=bar" would be expanded to "set =bar", this resulting in this error.

kill: Invalid signal number

kill: Invalid signal name

See Appendix C for a list of valid signal numbers and names.

fg: No job to foreground.

bg: No job to background.

stop: No job to stop.

There aren't any jobs so this command is useless.

fg: No such job.

bg: No such job.

stop: No such job.

kill: No such job.

The specified job (or process) doesn't exist.

fg: Gee, this job is already in the foreground.

bg: Gee, this job is already in the background.

stop: Gee, this job is already stopped.

Well, this should be self-explanatory. Also, some of these should be impossible to get, unless you're bound and determined to crash gsh, but then, these errors will keep you from crashing it, so, what's the point?

Appendix D

Signals

The following list describes all signals present in the GNO Multitasking Environment. These signals are used to communicate with processes and the GNO kernel. gsh provides a means to send signals to processes via the kill command. Furthermore, GNO/ME provides interfaces for C and Assembly Language programmers to handle signals in their programs. Note that not all of these signals are actually used in GNO/ME 2.0.

- Name (Value) Description

  SIGHUP (1) Hangup.

  SIGINT (2) Interrupt.

  SIGQUIT (3) Quit.

  SIGILL (4) Illegal Instruction.

  SIGTRAP (5) Trace trap.

  SIGABRT (6) Abort (cf. abort(3)).

  SIGEMT (7) Emulator trap.

  SIGFPE (8) Arithmetic exception.

  SIGKILL (9) Kill. This signal cannot be caught, blocked, or ignored. If a signal is not specified for the kill command, this signal is sent to the process.

  SIGBUS (10) Bus error.

  SIGSEGV (11) Segmentation violation.

  SIGSYS (12) Bad argument to system call.

  SIGPIPE (13) Write on a pipe or other socket with no one to read it.

  SIGALRM (14) Alarm clock.

  SIGTERM (15) Software termination signal.

  SIGURG (16) Urgent condition present on socket.

  SIGSTOP (17) Stop. This signal cannot be caught, blocked, or ignored.

  SIGTSTP (18) Stop signal generated from keyboard.

  SIGCONT (19) Continue after stop. This signal cannot be blocked.

  SIGCHLD (20) Child status has changed.

  SIGTTIN (21) Background read attempted from control terminal.

  SIGTTOU (22) Background write attempted to control terminal.

  SIGIO (23) Input/Output possible signal.

  SIGXCPU (24) Exceeded CPU time limit.

  SIGUSR1 (30) User defined signal 1.

  SIGUSR2 (31) User defined signal 2.

Appendix E

Non-Compliant Applications

GNO/ME wasn't really designed with the intention of making EVERY program you currently run work under GNO/ME; that task would have been impossible. Our main goal was to provide a UNIX-based multitasking environment; that we have done. We made sure as many existing applications as we had time to track and debug worked with GNO/ME. The current list of compatible and non-compatible applications can be found in the file "RELEASE.NOTES" on the GNO/ME disk.

However, due to the sheer number of applications and authors, there are some programs that just plain don't work; and some that mostly work, except for annoyances such as two cursors appearing, or keyboard characters getting 'lost'. The problem here is that some programs use their own text drivers (since TextTools output was very slow at one time); since GNO/ME doesn't know about these custom drivers, it goes on buffering keyboard characters and displaying the cursor. There is a way, however, to tell GNO/ME about these programs that break GNO/ME's rules.

We've defined an auxType for S16 and EXE files, to allow distinction between programs that are GNO/ME compliant and those that are not. Setting the auxType of an application to $DC00 disables the interrupt driven keyboard buffering and turns off the GNO/ME cursor. Desktop programs use the GNO/ME keyboard I/O via the Event Manager, and thus should not have their auxType changed.

You can change a program's auxType with the following shell command:

chtyp -a \$DC00 filename

where filename is the name of the application. As more programmers become aware of GNO/ME and work to make their software compatible with it, this will become less of a problem, but for older applications that are unlikely to ever change (like the America OnLine software) $DC00 is a reasonable approach.

Appendix F

Termcaps

'Termcap' is short for 'terminal capability', and is the name of a database which applications can use to do full-screen output on any kind of terminal. The termcap database contains records for the various supported terminals, each of which contains fields that look like this:

cap=value

cap is a two-letter code that represents a cursor movement, screen mode change (such as inverse or underline mode), and various other things. Value is usually a sequence of control characters that is sent to a terminal to initiate the desired action. Value can also be 'boolean', or yes/no, values, for such things as "Does this terminal support cursor movement?". The termcap file is documented in the electronic manual entry termcap(5).

The termcap library does not specifically require GNO/ME.

The following terminal types are supported in the GNO/ME termcap file:

gnocon GNO Console

CONSOLE GS/OS .console driver

ptse Proterm Special Emulation

vt100 DEC VT-100 terminal

ansisys MS-DOS ANSI.SYS

xerox820 Xerox 820-II CP/M terminal

iw1 Apple ImageWriter I printer

iw-alt Alternate ImageWriter I printer

deskjet Hewlett Packard DeskJet 500 printer

The printer entries allow a formatted electronic manual page to be sent to the printer. For example, the following script would bring up the manual page for 'ls', format it for the DeskJet 500, and print it with italics and boldface:

set temp=$term

set term=deskjet

man $1 > .ttyb

set term=$temp

- Glossary

  Alias. A name used as an abbreviation for one or more commands. An alias allows you to replace any command string with a short sequence of characters.

  Applesoft. An implementation of BASIC for the Apple II.

  APW. Apple Programmer's Workshop. Similar to ORCA.

  BASIC. Beginners All-purpose Symbolic Instruction Code. A simple computer language.

  Built-in command. A command processed by gsh. These commands are not external to the shell, but are included within the gsh program.

  Command. An action for gsh to perform. Commands can be either simple or compound. A simple command is an alias assignment, variable assignment, I/O redirection, or built-in command. A compound command is a pipeline.

  Directory. A special type of file that contains a list of other files; usually used to categorize files related in some way.

  Environment. The state of a process, which includes information such as its open files, current directory (working directory), and local and global variables. Three environments exist under gsh:

  Child environment:: The environment of the child process.

  Current environment:: The environment of the current process.

  Parent environment:: The environment of the parent process.

  Environment file. A file that is interpreted by an application to allow the user to customize its operation. For gsh, this file is "gshrc".

  Export. A way to pass a variable from a parent process to child process.

  File. An object used to store data and/or programs. On the II GS, files are tagged with types such as EXE, SRC, TXT, etc.

  Filter. A command that reads from its standard input and writes to its standard output. For example, a filter program could be written to convert all characters to upper case. Filters are used mainly in pipelines.

  Flag. A character used to represent an option to a command. Flags are either short or long options whose character representations are "-" and "+".

  Glob. Slang for Pathname Expansion.

  GNO/ME. GNO Multitasking Environment. The complete package including the GNO kernel and the GNO Shell.

  GNO Kernel. Heart of GNO/ME. Executes processes when asked by the GNO Shell

  GNO Shell. Provides an interface between the user and the GNO kernel.

  gsh. GNO Implementation of a UNIX-like shell.

  GS/OS. 16 bit Operating System for the Apple IIgs.

  History. A variable number of command-lines saved by gsh for future reference. The number of command-lines saved is dependent on the $HISTORY environment variable.

  History file. A file containing command-lines entered while in a gsh session. The number of command-lines saved is dependent on the $SAVEHIST environment variable.

  Interrupt. A signal generated by a sequence of keyboard characters or by a command that terminates the current executing process, unless the process has set up a trap to handle the interrupt signal.

  I/O Redirection. The process of changing the standard input, standard output, and standard error associated with a process so that it is redirected to a file instead of the console.

  Job. A set of related processes. A job can be either:

  Background job :A process that executes with the current process. Background jobs are not associated with the terminal.

  Foreground job : A process that is currently executing and which is associated with the terminal.

  Multiprocessing. Indicates a machine with more than one CPU.

  Multitasking. The ability to run more than one program at a time, or the illusion of more than one program running at a time - usually the latter.

  ORCA Shell programing environment for the Apple //gs. Also a type of whale.

  Path search. The means of searching a pathname list for a command or script.

  Pathname. A string used to identify a file.

  Pathname completion. The means of generating all pathnames matching a given pattern.

  Pathname expansion. The means of replacing a pattern with a list of pathnames matching that pattern.

  Pattern. A string of characters used to match literal characters and/or multiple characters.

  Permission. Each file has certain permissions associated with it: destroy, rename, backup, invisible, write, and read.

  Pipe. A conduit through which a stream of characters can pass from one process to another. This is accomplished by linking the standard output of one process to the standard input of a second process.

  Pipeline. Two or more processes connected together by pipes.

  Process. A single thread of execution that consists of a program and an execution environment.

  Child process: A new process created by another process.

  Parent process: A process that creates a child process.

  Process id: Each active process is uniquely identified by a positive integer called the process id.

  ProDOS. 8-bit Disk Operating System for Apple II computers.

  Prompt. A message displayed by gsh when it is ready to receive a command.

  Quoting. A means of including special characters as arguments to a command or as the command name. Certain characters have certain meanings to gsh and quoting them makes gsh ignore them.

  Reserved word. A word that is treated specially by gsh. This word is part of the gsh grammar.

  Script. A sequence of commands contained in a file.

  Signal. An asynchronous message that consists of a number or name that can be sent from one process to another.

  Standard Error. The file associated with error messages for a process. This file is usually the terminal.

  Standard Input. The file associated with a processes input. This file is usually the terminal.

  Standard Output. The file associated with a processes output. This file is usually the terminal.

  Tilde Expansion. Words beginning with "~" are treated specially by gsh. The "~" is expanded to the value of the HOME variable.

  UNIX. Popular operating system which has growing use in education and business. One of the first operating systems to support multitasking.

  Variable. A named location in gsh that contains text. The text of a variable can be expanded in a command by preceding the variable name with a dollar sign ($).

  Wildcard. See Pattern and Pathname Expansion.

  Working directory. The current directory.

Index