home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
hcshdemo.zip
/
csh-os2.zip
/
SAMPLES
/
README
< prev
next >
Wrap
Text File
|
1994-02-15
|
6KB
|
145 lines
Hamilton C shell(tm) Samples Directory, Release 2.2.i
Copyright (c) 1989-1993 by Hamilton Laboratories. All rights reserved.
The sample C programs and C shell scripts in this directory are meant
to help you install or experiment with Hamilton C shell. Deliberately,
they're relatively trivial.
(All these files should be viewed with TABS=3)
args.c A simple C program that prints out the *argv[] (argument)
and *envp[] (environmental variable) arrays. Notice that
wildcarding, variable substitutions, quoting and command
substitutions are done before the C program is started. If
you do a lot of wildcarding, you can create and pass VERY
long parameter lists (up 64K characters). Try some of these
commands:
% args "ho"w 'no'w
% args "$cwd" '$cwd'
% args * "*" '*'
% args `whereis more`
% args '`whereis more`'
% args * *\* *\*\* | more
bits.csh A simple self-loading procedure that calculates the minimum
bits required to represent the argument it's passed as a
binary integer.
bumpdate.csh Print the date n number of days forward or backward from a
given date. If only the bump value is given, today's date
is bumped.
caldate.csh Print the date corresponding to a given Julian day.
calendar.csh A C shell script for printing out the calendar for any
given month, highlighting the current date. If no date
is given, this month's calendar is printed.
colors.csh Instructions and examples on customizing the screen colors.
deltaday.csh Print the number of days separating two dates. If only
one date is given, the difference between it and today's date
is returned.
dumpenv.c This C program writes out the environment it's passed in
the form of setenv commands. If you're installing Hamilton
C shell for the first time, dumpenv is a convenient way to
snapshot the environmental variables you've been using with
cmd.exe in a form you can append to your login.csh file.
duplicat.csh Look for duplicate files anywhere in a directory tree.
easter.csh A C shell script that calculates when Easter will occur in
any given year. If no year is given, the current year is
assumed.
factor.csh The simple factor C shell script shown in the User Guide.
Intended to show examples of recursion, expressions, and
a self-loading procedure.
finance.csh Another C shell script showing expression evalution. This
defines a number of routines for calculating financial
conversion factors, e.g., from present to future value.
getprio.c This C program retrieves and prints its scheduling priority,
demonstrating the effect of using the eval command to run
a command at a higher or lower priority. Try these examples:
% getprio
% eval -i getprio
% eval +20 (getprio; eval +20 getprio; getprio); getprio
julian.csh Calculate the Julian day number (number of days since January 1,
4713 BC) for any given date. If you don't give a date, it
uses today's date.
makecpgm.csh A simple C shell script showing how a "make" function might
be written in the C shell language. This one rebuilds any
.exe files in the current directory that are older than the
corresponding .c file or any of the .h files.
mcvisa.csh A simple C shell script that constructs a special checksum
of a credit card number to tell if the card number is
plausible or not. The checksum used is designed to catch
transposed or incorrect digits. Try it on the cards in
your wallet.
member.csh Test whether the first argument word appears somewhere in the
list given by the second argument.
myecho.c A variation on the builtin echo command that prints its
*argv[] (argument) list with quotes around each word it's
passed and tells the total character count. Try these
examples:
% myecho now is the
% myecho "now is" the
% myecho `ls`
% myecho `echo`
% myecho `echo hello`
% myecho * *\* *\*\* | more
newfiles.csh List all the files or directories in the current directory
that do not occur in the specified directory.
postage.csh Calculate the U.S. first class postage required for a
given weight in ounces.
rcode.c A trivial C program that just prints, then exits with the
return code value you pass it. You can use this routine to
see how the status variable is set and also, how the ";",
"||" and "&&" statement connectors work. Try these examples:
% rcode
% calc status
% rcode 1
% calc status
% echo $status
% echo status
% rcode 2
% calc status
% rcode 0 || rcode 1
% rcode 1 || rcode 2
% rcode 0 && rcode 1
% rcode 1 && rcode 2
% rcode 0 ; rcode 1
% rcode 1 ; rcode 2
sh_2_csh.csh A script for converting Bourne or Korn shell scripts into
Hamilton C shell scripts using a set of sed scripts contained
in the sh_2_csh directory.
sizeof.csh A C shell script that calculates the total disk space used
by whatever files or directories are given as arguments.
ts.csh A C shell script that searches for occurrences of a simple
string in all the files with a given extension anywhere in
a directory tree.
viopaste.c A short C program to enable pasting into a Presentation
Manager text window under OS/2 1.2 or 1.3.
weekday.csh Print the day of the week corresponding to any given date.