home *** CD-ROM | disk | FTP | other *** search
- 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 32K 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.
-
- blksize.c A simple C program that reads from Stdin, copying to Stdout,
- using the specified blocksize. This program can be useful
- to read or write tape devices that only support certain
- blocksizes.
-
- 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.
-
- cl.csh Run the C compiler and linker for an NT program. Avoids
- having to fool with a make file just to compile hello, world.
- Works pretty much just like the cl command on DOS would.
-
- 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.
-
- 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.
-
- 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.
-
- weekday.csh Print the day of the week corresponding to any given date.
-
- winerror.c Print the Win32 message corresponding to a given error code.
-