Initial svn import

This commit is contained in:
2013-12-31 07:32:25 -05:00
commit d0571f211c
12 changed files with 530 additions and 0 deletions

65
design Normal file
View File

@ -0,0 +1,65 @@
In-order steps of initialization
Initial check for tty or not.
Find core OS name from kernel with "uname".
Different OSes need different uname breakdowns to find out stats.
determine what system fix-ups are needed for common commands.
-- build a later version of shell?
Load basic environment configuration variables (login or not)
decide if login or batch-session.
For batch: Load batch-specific settings.
Otherwise:
Switch to TCSH loading.
Load login for first login bits.
Load tcshrc for first login bits.
-- First launch tcshrc
-- These are sourced from tcshrc.system
Load arch specific tcshrc bits
Load OS specific tcshrc bits
Load machine speciifc tchsrc bits
Load organization/network specific tcshrc bits
Load user specific tcshrc bits
-- These get launched by tcshrc.alias
Load arch specific alias bits
Load OS specific alias bits
Load machine speciifc tchsrc bits
Load organization/network specific alias bits
Load user specific alias bits
Load arch specific completion bits
Load OS specific completion bits
Load machine speciifc tchsrc bits
Load organization/network specific completion bits
Load user specific completion bits
Load arch specific bindkey bits
Load OS specific bindkey bits
Load machine speciifc tchsrc bits
Load organization/network specific bindkey bits
Load user specific bindkey bits
-- Do prompt last, since it is not that useful beforehand.
Load tcshrc prompt
----------------------------------------------
Start by acknowledging that both login and tcshrc are sourced.

37
startup_hooks/login Normal file
View File

@ -0,0 +1,37 @@
set login_sourced
if( $?CSHENV_DEBUG ) then
echo "Starting login..."
endif
#if( ! $?CSHENV_DIR ) then
#setenv CSHENV_DIR ~/proj/cshenv
#endif
#echo "Under: " $_
#echo "Zero: " $0
#if( -n "${_}" ) then
# echo $0
# setenv CSHENV_LOGIN_PATH $0
#else
# echo ${_}:1
# setenv CSHENV_LOGIN_PATH "${_}:1"
#else
#endif
#echo login hook lives at: ${CSHENV_LOGIN_PATH}
if( $?CSHENV_DEBUG ) then
echo "Ending login..."
endif
###########################
# vim: ft=tcsh
###########################
setenv LC_NUMERIC en_US.UTF-8
setenv LC_MEASUREMENT en_US.UTF-8
setenv LC_MONETARY en_US.UTF-8
setenv LC_TIME en_US.UTF-8

41
startup_hooks/tcshrc Normal file
View File

@ -0,0 +1,41 @@
set tcshrc_sourced
if( $?CSHENV_DEBUG ) then
echo "Starting tcshrc..."
endif
if( ! $?CSHENV_DIR ) then
setenv CSHENV_DIR ~/proj/cshenv
endif
if( $?CSHENV_DEBUG ) then
echo "Setup CSHENV_DIR to: " ${CSHENV_DIR}
endif
#if( -z ${_} ) then
#echo $0
#setenv CSHENV_TCSHRC_PATH $0
#else
#echo ${_}
#setenv CSHENV_TCSHRC_PATH "${_}"
#endif
#echo tcshrc hook lives at: ${CSHENV_TCSHRC_PATH}
if( -c `tty` ) then
if( $?CSHENV_DEBUG ) then
echo "Going to source core tcshrc..."
endif
source ${CSHENV_DIR}/tcshrc
endif
# Not using tcshrc bits for non-login shells. Will decide what to do later.
if( $?CSHENV_DEBUG ) then
echo "Ending tcshrc..."
endif
###########################
# vim: ft=tcsh
###########################

78
tcshrc Normal file
View File

@ -0,0 +1,78 @@
# CSHRC Debugging tests
if( ( $?CSHENV_DEBUG ) || ( $?CSHENV_VERBOSE_STARTUP ) ) then
echo "Currently running tcshrc script"
endif
# Figure out what kind of tcsh we are running.
if( $?tcsh ) then
set tcsh_major=$tcsh:r:r
set tcsh_minor=$tcsh:r:e
set tcsh_patch=$tcsh:e
set tcsh_features=$version:as/ /.:as/,/./
if( $tcsh_minor < 12 ) then
echo "We are on a very ancient TCSH! There may be many problems..."
else
if( $tcsh_minor == 14 && $tcsh_patch < 2 ) then
if( $?CSHENV_DEBUG ) then
echo "We may not have ADAM's patches..."
endif
endif
endif
else
# As we develop support for C++sh, we'll need this
if( !$?cxxsh ) then
echo "What! We're not even in tcsh or something compatible, like C++sh!!!"
endif
endif
set cur_feature=$tcsh_features:e
if( $?CSHENV_DEBUG ) then
echo "Tcsh Featureset probed..."
endif
#The history size for your shell can be set globally now
if( $?CSHENV_HISTORY_SIZE ) then
set history=$HISTORY_SIZE
endif
# this safe_source alias is incredibly delicate. It drives the whole
# optional sourcing mechanism -- DO NOT MESS WITH IT!
alias safe_source 'eval "if ( -f \!:1 ) then \\
source \!:1 \\
endif"'
if( $?CSHENV_DEBUG ) then
echo "Tcsh safe-source alias constructed..."
endif
# Dispatch to find out what our OS is and any fixups
# This will figure out what system we're on and setup all
# system specific notions. From the sourced file,
# tcshrc.system.???? will be called
if( $?CSHENV_DEBUG ) then
echo "Trying to source tcshrc.system"
endif
source ${CSHENV_DIR}/tcshrc.system
if( $?CSHENV_DEBUG ) then
echo "Trying to source tcshrc.alias"
endif
source ${CSHENV_DIR}/tcshrc.alias
if( $?CSHENV_DEBUG ) then
echo "Trying to source tcshrc.prompt"
endif
source ${CSHENV_DIR}/tcshrc.prompt
###########################
# vim: ft=tcsh
###########################

0
tcshrc.alias Normal file
View File

58
tcshrc.colors Normal file
View File

@ -0,0 +1,58 @@
#######################
####### COLOURS #######
#######################
set csi='['
set ansi_bright='1'
set ansi_dim='0'
set ansi_color='m'
set ansi_black='30'
set ansi_red='31'
set ansi_green='32'
set ansi_yellow='33'
set ansi_blue='34'
set ansi_magenta='35'
set ansi_cyan='36'
set ansi_white='37'
set bright="$csi$ansi_bright$ansi_color"
set dim="$csi$ansi_dim$ansi_color"
set black="$csi$ansi_black$ansi_color"
set red="$csi$ansi_red$ansi_color"
set green="$csi$ansi_green$ansi_color"
set yellow="$csi$ansi_yellow$ansi_color"
set blue="$csi$ansi_blue$ansi_color"
set magenta="$csi$ansi_magenta$ansi_color"
set cyan="$csi$ansi_cyan$ansi_color"
set white="$csi$ansi_white$ansi_color"
set dim_black="$csi$ansi_dim;$ansi_black$ansi_color"
set dim_red="$csi$ansi_dim;$ansi_red$ansi_color"
set dim_green="$csi$ansi_dim;$ansi_green$ansi_color"
set dim_yellow="$csi$ansi_dim;$ansi_yellow$ansi_color"
set dim_blue="$csi$ansi_dim;$ansi_blue$ansi_color"
set dim_magenta="$csi$ansi_dim;$ansi_magenta$ansi_color"
set dim_cyan="$csi$ansi_dim;$ansi_cyan$ansi_color"
set dim_white="$csi$ansi_dim;$ansi_white$ansi_color"
set bright_black="$csi$ansi_bright;$ansi_black$ansi_color"
set bright_red="$csi$ansi_bright;$ansi_red$ansi_color"
set bright_green="$csi$ansi_bright;$ansi_green$ansi_color"
set bright_yellow="$csi$ansi_bright;$ansi_yellow$ansi_color"
set bright_blue="$csi$ansi_bright;$ansi_blue$ansi_color"
set bright_magenta="$csi$ansi_bright;$ansi_magenta$ansi_color"
set bright_cyan="$csi$ansi_bright;$ansi_cyan$ansi_color"
set bright_white="$csi$ansi_bright;$ansi_white$ansi_color"
###########################
# vim:filetype=tcsh
###########################

8
tcshrc.prompt Normal file
View File

@ -0,0 +1,8 @@
source ${CSHENV_DIR}/tcshrc.colors
source ${CSHENV_DIR}/tcshrc.prompt.colors
source ${CSHENV_DIR}/tcshrc.prompt.defs
###########################
# vim:filetype=csh
###########################

40
tcshrc.prompt.colors Normal file
View File

@ -0,0 +1,40 @@
######################
### PROMPT COLOURS ###
######################
set date_color="${dim_magenta}"
set time_color="${bright_magenta}"
set text_color="${bright_white}"
set oldp_color="${dim_white}"
set brace_color="${bright_yellow}"
set host_color="${bright_blue}"
set name_color="${bright_cyan}"
set at_color="${dim_cyan}"
set path_color="${bright_green}"
set line_color="${dim_red}"
set prompt_color="${dim_white}"
set depth_color="${dim_yellow}"
set command_color="${dim_white}"
set color_start="%{"
set color_end="%}"
set date_color_seq="${color_start}${date_color}${color_end}"
set time_color_seq="${color_start}${time_color}${color_end}"
set text_color_seq="${color_start}${text_color}${color_end}"
set oldp_color_seq="${color_start}${oldp_color}${color_end}"
set brace_color_seq="${color_start}${brace_color}${color_end}"
set host_color_seq="${color_start}${host_color}${color_end}"
set name_color_seq="${color_start}${name_color}${color_end}"
set at_color_seq="${color_start}${at_color}${color_end}"
set path_color_seq="${color_start}${path_color}${color_end}"
set line_color_seq="${color_start}${line_color}${color_end}"
set prompt_color_seq="${color_start}${prompt_color}${color_end}"
set depth_color_seq="${color_start}${depth_color}${color_end}"
set command_color_seq="${color_start}${command_color}${color_end}"
###########################
# vim:filetype=tcsh
###########################

0
tcshrc.prompt.defs Normal file
View File

40
tcshrc.system Normal file
View File

@ -0,0 +1,40 @@
if( $?CSHENV_DEBUG ) then
echo "Running tcshrc.system..."
endif
setenv CSHENV_SYSTEM `uname`
if( $?CSHENV_DEBUG ) then
echo 'Initially detected that you are running on a "'${CSHENV_SYSTEM}'" system'
endif
# Cygwin systems are kinda funky -- so we fix them up to say "Cygwin"
switch( ${CSHENV_SYSTEM} )
case CYGWIN_NT-6.1-WOW64:
setenv CSHENV_SYSTEM Cygwin
breaksw
endsw
if( $?CSHENV_DEBUG ) then
echo 'Detected that you are running on a "'${CSHENV_SYSTEM}'" system'
endif
# Source the common bits, since many systems often have lots in common.
# For the moment, everything is in here.
# This file is DEPRECATED from the start!
source ${CSHENV_DIR}/tcshrc.system.common
# Systems may need many system specific fixes for their systems
# Such bits go into system-specific files.
safe_source ${CSHENV_DIR}/tcshrc.system.${CSHENV_SYSTEM}
if( ! $?CSHENV_SYSTEM_CONFIGURED ) then
echo 'Warning- Unable to find a proper system configuration set for "'${CSHENV_SYSTEM}'"'
endif
###########################
# vim: ft=tcsh
###########################

15
tcshrc.system.Linux Normal file
View File

@ -0,0 +1,15 @@
if( $?CSHENV_DEBUG ) then
echo "Sourcing tcshrc.system.Linux..."
endif
# Set the acknowledgement bit, essentially
setenv CSHENV_SYSTEM_CONFIGURED Linux
if( $?CSHENV_DEBUG ) then
echo "Done sourcing tcshrc.system.Linux..."
endif
###########################
# vim: ft=tcsh
###########################

148
tcshrc.system.common Normal file
View File

@ -0,0 +1,148 @@
if( $?CSHENV_DEBUG ) then
echo "Sourcing tcshrc.system.common"
endif
set uname=`uname`
set uname_a=`uname -a`
set uname_p=`uname -p`
set uname_m=`uname -m`
if( $?CSHENV_DEBUG ) then
echo "Setting uname -i tracker, based upon OS."
endif
switch( ${CSHENV_SYSTEM} )
case Cygwin:
case Darwin:
case Linux
set uname_i
breaksw
default:
#FALLTHROUGH
case FreeBSD:
case NetBSD:
set uname_i="`uname -i`"
breaksw
endsw
if( $?CSHENV_DEBUG ) then
echo "Setting CSHENV_BASESYSTEM..."
endif
setenv CSHENV_BASESYSTEM "${uname}"
if( $?CSHENV_DEBUG ) then
echo "Setting CSHENV_FULLSYSTEM..."
endif
setenv CSHENV_FULLSYSTEM "${uname_a}"
switch ( ${CSHENV_SYSTEM} )
case Cygwin:
if( $?CSHENV_DEBUG ) then
echo "Using a Cygwin system..."
endif
#Cygwin is like Linux, so we just...
#FALLTHROUGH
case Linux:
if( $?CSHENV_DEBUG ) then
echo "Using a Linux-like system (GLIBC, probably)..."
endif
setenv CSHENV_CPU "${uname_m}"
setenv CSHENV_MACH "${uname_p}"
switch( CSHENV_CPU )
case m68k:
if( $?CSHENV_DEBUG ) then
echo "Running on a m68k based CPU, tweaks for system."
endif
setenv CSHENV_ARCH ${uname_p}
breaksw
case armv71:
if( $?CSHENV_DEBUG ) then
echo "Running on an arm based CPU, tweaks for system."
endif
setenv CSHENV_ARCH arm
breaksw
default:
setenv CSHENV_ARCH ${uname_i}
breaksw
endsw
breaksw
case Darwin:
if( $?CSHENV_DEBUG ) then
echo "Using a Darwin/MacosX system..."
endif
setenv CSHENV_CPU ${uname_p}
setenv CSHENV_MACH ${uname_m}
#TODO: Fix this for intel vs. ppc check.
setenv CSHENV_ARCH ppc
breaksw
case FreeBSD:
if( $?CSHENV_DEBUG ) then
echo "Using a FreeBSD system..."
endif
setenv CSHENV_CPU ${uname_p}
setenv CSHENV_MACH ${uname_m}
setenv CSHENV_ARCH ${uname_p}
breaksw
default:
setenv CSHENV_CPU ${uname_p}
setenv CSHENV_MACH ${uname_m}
setenv CSHENV_ARCH ${uname_i}
breaksw
endsw
if( $?CSHENV_DEBUG ) then
echo "Detecting hostname hacks needed."
endif
switch( ${CSHENV_SYSTEM} )
#Broken or Non-BSD like hostname commands:
case Cygwin:
case SunOS:
if( $?CSHENV_DEBUG ) then
echo "SYSV hostname hack."
endif
setenv CSHENV_HOSTNAME `hostname | tr "[:upper:]" "[:lower:]"`
breaksw
#BSD like hostnames, and non-broken ones.
default:
if( $?CSHENV_DEBUG ) then
echo "BSD-like hostname hack."
endif
setenv CSHENV_HOSTNAME `hostname -s| tr "[:upper:]" "[:lower:]"`
breaksw
endsw
if( $?CSHENV_DEBUG ) then
echo "Hostname detected as ${CSHENV_HOSTNAME}..."
endif
if( $?CSHENV_DEBUG ) then
echo "Done sourcing tcshrc.system.common"
endif
###########################
# vim: ft=tcsh
###########################