summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2014-04-27 10:18:18 -0500
committerErik Hanson <erik@slackbuilds.org>2014-04-27 12:15:43 -0500
commita8f4e457f484a80469cbcc3f47760f3a6c51c589 (patch)
treed671300904f666e8927e9d9059b4257468540c90 /system
parent9db9d22c508fdc1a15d638d406025755c756f515 (diff)
downloadslackbuilds-a8f4e457f484a80469cbcc3f47760f3a6c51c589.tar.gz
system/csh: Added (C shell from BSD)
Signed-off-by: Erik Hanson <erik@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/csh/README11
-rw-r--r--system/csh/README_Slackware.txt79
-rw-r--r--system/csh/bufsiz.diff30
-rw-r--r--system/csh/csh.SlackBuild106
-rw-r--r--system/csh/csh.info12
-rw-r--r--system/csh/csh.login77
-rw-r--r--system/csh/doinst.sh19
-rw-r--r--system/csh/slack-desc19
8 files changed, 353 insertions, 0 deletions
diff --git a/system/csh/README b/system/csh/README
new file mode 100644
index 0000000000..12230bebd9
--- /dev/null
+++ b/system/csh/README
@@ -0,0 +1,11 @@
+csh (C shell from BSD)
+
+The C shell was originally written at UCB to overcome limitations in the
+Bourne shell. Its flexibility and comfort (at that time) quickly made
+it the shell of choice until more advanced shells like ksh, bash, zsh
+or tcsh appeared. Most of the latter incorporate features original to csh.
+
+This build is based on OpenBSD sources from 2011.
+
+For Slackware-specific details about this build of csh, see the file
+README_Slackware.txt. Seriously, really, read it.
diff --git a/system/csh/README_Slackware.txt b/system/csh/README_Slackware.txt
new file mode 100644
index 0000000000..e3ebbcd0dc
--- /dev/null
+++ b/system/csh/README_Slackware.txt
@@ -0,0 +1,79 @@
+
+Notes for using SlackBuilds.org csh package:
+
+This csh build conflicts slightly with Slackware's tcsh package. The
+easiest way to use this is to "removepkg tcsh" before installing csh. If
+you want to do this, you can skip the next section.
+
+
+Installing csh and tcsh together
+--------------------------------
+
+It's possible for csh to coexist with tcsh, with a few caveats:
+
+The shell is installed as /usr/bin/csh to avoid conflicting with
+Slackware's own tcsh package (which makes /bin/csh a symlink to tcsh). If
+you want to make /bin/csh point to the real csh, you have two choices:
+
+1. remove the /bin/csh symlink before installing the csh package:
+ # rm -f /bin/csh
+ The /bin/csh symlink will get created when csh is installed.
+
+2. adjust the symlink manually after csh installation:
+ # rm -f /bin/csh
+ # ln -s ../usr/bin/csh /bin/csh
+ This works the same way as e.g. the /usr/bin/vi symlink, which points
+ to either elvis or vim.
+
+If you have both csh and Slackware's tcsh installed, and you remove csh,
+you'll want to reinstall tcsh to clean up afterwards.
+
+Removing tcsh while csh is installed should be perfectly OK.
+
+Installing/upgrading tcsh when csh is already installed is probably a
+bad idea. Remove csh first, install tcsh, then install csh.
+
+As far as I know, nothing in Slackware depends on tcsh, so if you
+mess things up, you won't break your OS. You can always put things
+back to Slackware's default state by removing both csh and tsch, then
+reinstalling tcsh.
+
+
+Using csh as a login shell
+--------------------------
+
+If you want to use csh as a login shell, be aware that Slackware's
+shipped /etc/csh.login (from the etc package) contains tcsh-specific
+code, which prevents the /etc/profile.d/*.csh scripts from running. This
+won't prevent you from logging in, but your environment won't be set up
+correctly, you'll see "[: No match." errors, and your prompt won't show
+your username, hostname, current directory as tsch does.
+
+To fix this, you can replace /etc/csh.login with the /etc/csh.login.new
+installed with the csh package. It behaves the same as the original,
+for tcsh, and has conditional code to make csh behave correctly.
+
+ # cp /etc/csh.login /etc/csh.login.orig # back up original just in case
+ # mv /etc/csh.login.new /etc/csh.login
+
+If you don't want to replace Slackware's csh.login, just rm
+/etc/csh.login.new and forget about it.
+
+
+Other notes
+-----------
+
+You should read the man page for csh. Also
+/usr/doc/csh-$VERSION/paper.(txt|pdf) is a good intro to the C shell for
+beginning users. Also, if you're an experienced tcsh user, you might
+re-read the NEW FEATURES section in tcsh's man page (it describes the
+tcsh features you won't find in csh).
+
+NEVER make csh the default shell for the root account! In fact, it's
+probably a bad idea to ever change root's default shell on any Linux or
+UNIX system, especially a third-party one that isn't shipped with the OS.
+
+The man page for csh states that "Words can be no longer than 1024
+characters", but this build of csh increases the limit to 8192 (actually,
+BUFSIZ as defined in stdio.h). This was done so Slackware's profile.d
+scripts will work correctly (particularly coreutils-dircolor.sh).
diff --git a/system/csh/bufsiz.diff b/system/csh/bufsiz.diff
new file mode 100644
index 0000000000..21d58a124a
--- /dev/null
+++ b/system/csh/bufsiz.diff
@@ -0,0 +1,30 @@
+diff -Naur csh-20110502.orig/csh.h csh-20110502.patched/csh.h
+--- csh-20110502.orig/csh.h 2014-04-25 17:31:52.000000000 -0400
++++ csh-20110502.patched/csh.h 2014-04-25 17:34:08.000000000 -0400
+@@ -36,12 +36,10 @@
+ * Fundamental definitions which may vary from system to system.
+ *
+ * BUFSIZ The i/o buffering size; also limits word size
++ * 20140425 bkw: moved below the #include <stdio.h> since
++ * we want to use the system's default BUFSIZ.
+ * MAILINTVL How often to mailcheck; more often is more expensive
+ */
+-#ifndef BUFSIZ
+-#define BUFSIZ 1024 /* default buffer size */
+-#endif /* BUFSIZ */
+-
+ #ifndef MAXPATHLEN
+ #define MAXPATHLEN BUFSIZ
+ #endif
+@@ -96,6 +94,11 @@
+ #include <stdio.h>
+ FILE *cshin, *cshout, *csherr;
+
++/* 20140425 bkw: moved here so stdio.h is what initially defines BUFSIZ. */
++#ifndef BUFSIZ
++#define BUFSIZ 1024 /* default buffer size */
++#endif /* BUFSIZ */
++
+ #include <stdio_ext.h>
+ #define fpurge __fpurge
+
diff --git a/system/csh/csh.SlackBuild b/system/csh/csh.SlackBuild
new file mode 100644
index 0000000000..a6b63c5c1a
--- /dev/null
+++ b/system/csh/csh.SlackBuild
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+# Slackware build script for csh
+
+# Written by B. Watson (yalhcru@gmail.com)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+PRGNAM=csh
+VERSION=${VERSION:-20110502}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+# Grr.
+TARNAM="${PRGNAM}_${VERSION}.orig"
+DIRNAM="${PRGNAM}-${VERSION}.orig"
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $DIRNAM
+tar xvf $CWD/$TARNAM.tar.gz
+cd $DIRNAM
+tar xvf $CWD/${PRGNAM}_${VERSION}-2.debian.tar.gz
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Apply all of Debian's patches.
+for diff in debian/patches/*.diff; do
+ patch -p1 < $diff
+done
+
+# My own patch, keeps csh.h from defining its own (tiny) BUFSIZ. Might
+# make I/O more efficient, and allows /etc/profile.d/coreutils-dircolors.sh
+# to set a giant $LS_OPTIONS value without "Word too long" error.
+patch -p1 < $CWD/bufsiz.diff
+
+# use Slackware standard flags
+sed -i "1iCFLAGS=$SLKCFLAGS" Makefile
+
+# The LIBC= isn't even used, but Slackware64's pmake is broken: it has
+# /usr/lib/libc.a hard-coded, and pmake wants to build that (and can't),
+# even though the csh binary is dynamic and doesn't even need libc.a!
+# Also don't know why I have to make const.h separately, but it works.
+pmake const.h
+pmake LIBC=/usr/lib$LIBDIRSUFFIX/libc.a
+cd USD.doc
+pmake paper.ps paper.txt
+cd -
+
+# I think this is the first time I've ever seen 'make install' gzip the
+# man pages and strip the binary! BSD FTW!
+mkdir -p $PKG/usr/bin $PKG/usr/man/man1
+pmake install DESTDIR=$PKG BINDIR=/usr/bin MANDIR=/usr/man
+
+# Technically this conflicts with Slackware's etc package, but the file
+# that's modified still works exactly the same with tcsh. Also it's a .new
+# config file, requires manual intervention.
+mkdir -p $PKG/etc
+cat $CWD/csh.login > $PKG/etc/csh.login.new
+
+DOCDIR=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $DOCDIR
+cp -a USD.doc/paper.* $DOCDIR
+cat $CWD/$PRGNAM.SlackBuild > $DOCDIR/$PRGNAM.SlackBuild
+cat $CWD/README_Slackware.txt > $DOCDIR/README_Slackware.txt
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/csh/csh.info b/system/csh/csh.info
new file mode 100644
index 0000000000..8a1e477f06
--- /dev/null
+++ b/system/csh/csh.info
@@ -0,0 +1,12 @@
+PRGNAM="csh"
+VERSION="20110502"
+HOMEPAGE="https://packages.debian.org/sid/csh"
+DOWNLOAD="http://ftp.debian.org/debian/pool/main/c/csh/csh_20110502.orig.tar.gz \
+ http://ftp.debian.org/debian/pool/main/c/csh/csh_20110502-2.debian.tar.gz"
+MD5SUM="578c40bfa54c09c8affbc434e34fb40c \
+ d38e605854996cd5ce5217eed665ca19"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="libbsd"
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"
diff --git a/system/csh/csh.login b/system/csh/csh.login
new file mode 100644
index 0000000000..e65a03c02f
--- /dev/null
+++ b/system/csh/csh.login
@@ -0,0 +1,77 @@
+# /etc/csh.login: This file contains login defaults used by csh and tcsh.
+
+# This version is slightly modified for use with the SlackBuilds.org build of
+# Berkeley csh (but still works with tcsh). Changes are marked with ##BKW.
+# For tcsh, this behaves exactly like the original.
+
+# Set up some environment variables:
+if ($?prompt) then
+ umask 022
+ set cdpath = ( /var/spool )
+ set notify
+ set history = 100
+ setenv MANPATH /usr/local/man:/usr/man
+ setenv MINICOM "-c on"
+ setenv HOSTNAME "`cat /etc/HOSTNAME`"
+ setenv LESS "-M"
+ setenv LESSOPEN "|lesspipe.sh %s"
+ set path = ( $path /usr/games )
+endif
+
+# If the user doesn't have a .inputrc, use the one in /etc.
+if (! -r "$HOME/.inputrc") then
+ setenv INPUTRC /etc/inputrc
+endif
+
+# I had problems with the backspace key installed by 'tset', but you might want
+# to try it anyway instead of the section below it. I think with the right
+# /etc/termcap it would work.
+# eval `tset -sQ "$term"`
+
+# Set TERM to linux for unknown type or unset variable:
+if ! $?TERM setenv TERM linux
+if ("$TERM" == "") setenv TERM linux
+if ("$TERM" == "unknown") setenv TERM linux
+
+##BKW unfortunately plain csh doesn't support the handy prompt % macros, so
+# we have to do some complex and ugly stuff for csh. However, tcsh will still
+# use the macros.
+
+# Set the default shell prompt:
+if $?tcsh then
+ set prompt = "%n@%m:%~%# "
+else
+ set _promptchar = $prompt
+ # cache the hostname, assume it will never change (usually true)
+ set _hostname = `hostname`
+ alias _setprompt 'set prompt="$user@${_hostname}:$cwd$_promptchar "'
+ alias cd 'cd \!*;_setprompt'
+ alias chdir 'chdir \!*;_setprompt'
+ alias pushd 'pushd \!*;_setprompt'
+ alias popd 'popd \!*;_setprompt'
+ cd
+endif
+
+# Notify user of incoming mail. This can be overridden in the user's
+# local startup file (~/.login)
+biff y >& /dev/null
+
+# Set an empty MANPATH if none exists (this prevents some profile.d scripts
+# from exiting from trying to access an unset variable):
+if ! $?MANPATH setenv MANPATH ""
+
+# Append any additional csh scripts found in /etc/profile.d/:
+##BKW plain csh doesn't support [ ] unless nonomatch is set, so move the
+# 'set nonomatch' and 'unset nonomatch' outside of the for loop.
+set nonomatch
+[ -d /etc/profile.d ]
+if ($status == 0) then
+ foreach file ( /etc/profile.d/*.csh )
+ [ -x $file ]
+ if ($status == 0) then
+ source $file
+ endif
+ end
+ unset file
+endif
+unset nonomatch
diff --git a/system/csh/doinst.sh b/system/csh/doinst.sh
new file mode 100644
index 0000000000..5dec6bfce4
--- /dev/null
+++ b/system/csh/doinst.sh
@@ -0,0 +1,19 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/csh.login.new
+
+# If there's no csh link, take over:
+if [ ! -r bin/csh ]; then
+ ( cd bin ; ln -sf ../usr/bin/csh csh )
+fi
diff --git a/system/csh/slack-desc b/system/csh/slack-desc
new file mode 100644
index 0000000000..fb0b6a785a
--- /dev/null
+++ b/system/csh/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+csh: csh (C shell from BSD)
+csh:
+csh: The C shell was originally written at UCB to overcome limitations in
+csh: the Bourne shell. Its flexibility and comfort (at that time) quickly
+csh: made it the shell of choice until more advanced shells like ksh,
+csh: bash, zsh or tcsh appeared. Most of the latter incorporate features
+csh: original to csh.
+csh:
+csh: This build is based on OpenBSD sources from 2011.
+csh:
+csh: