diff options
Diffstat (limited to 'examples')
33 files changed, 561 insertions, 24 deletions
diff --git a/examples/INDEX.html b/examples/INDEX.html index 5e8cdc6..bd06b25 100644 --- a/examples/INDEX.html +++ b/examples/INDEX.html @@ -143,7 +143,7 @@ </tr> <tr> <td>./functions/keep</td> - <td>Try to keep some programs in the forground and running.</td> + <td>Try to keep some programs in the foreground and running.</td> </tr> <tr> <td>./functions/ksh-cd</td> @@ -642,6 +642,10 @@ <td>csh</td> </tr> <tr> + <td>./scripts/bash-hexdump.sh</td> + <td>hexdump(1) in bash</td> + <td>hexdump -C, hd</td> + <tr> <td>./scripts/cat.sh</td> <td>Readline-based pager.</td> <td>cat, readline pager</td> diff --git a/examples/INDEX.txt b/examples/INDEX.txt index db2858f..4b5478e 100644 --- a/examples/INDEX.txt +++ b/examples/INDEX.txt @@ -32,7 +32,7 @@ Path Description X-Ref ./functions/isvalidip Test user input for valid IP Addresses. ./functions/jdate.bash Julian date conversion. ./functions/jj.bash Look for running jobs. -./functions/keep Try to keep some programs in the forground and running. +./functions/keep Try to keep some programs in the foreground and running. ./functions/ksh-cd ksh-like 'cd': cd [-LP] [dir [change]]. ksh ./functions/ksh-compat-test ksh-like arithmetic test replacements. ksh ./functions/kshenv Functions and aliases to provide the beginnings of a ksh environment for bash. ksh @@ -151,6 +151,7 @@ Path Description X-Ref ./scripts Example scripts ./scripts/adventure.sh Text adventure game in bash! +./scripts/bash-hexdump.sh hexdump(1) in bash ./scripts/bcsh.sh Bourne shell cshell-emulator. csh ./scripts/cat.sh Readline-based pager. cat, readline pager ./scripts/center Center - center a group of lines. diff --git a/examples/complete/cdfunc b/examples/complete/cdfunc new file mode 100644 index 0000000..439edaf --- /dev/null +++ b/examples/complete/cdfunc @@ -0,0 +1,76 @@ +# cdfunc - example completion function for cd +# +# based on the cd completion function from the bash_completion package +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2011 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +_comp_cd() +{ + local IFS=$' \t\n' # normalize IFS + local cur _skipdot _cdpath + local i j k + + # Tilde expansion, with side effect of expanding tilde to full pathname + case "$2" in + \~*) eval cur="$2" ;; + *) cur=$2 ;; + esac + + # no cdpath or absolute pathname -- straight directory completion + if [[ -z "${CDPATH:-}" ]] || [[ "$cur" == @(./*|../*|/*) ]]; then + # compgen prints paths one per line; could also use while loop + IFS=$'\n' + COMPREPLY=( $(compgen -d -- "$cur") ) + IFS=$' \t\n' + # CDPATH+directories in the current directory if not in CDPATH + else + IFS=$'\n' + _skipdot=false + # preprocess CDPATH to convert null directory names to . + _cdpath=${CDPATH/#:/.:} + _cdpath=${_cdpath//::/:.:} + _cdpath=${_cdpath/%:/:.} + for i in ${_cdpath//:/$'\n'}; do + if [[ $i -ef . ]]; then _skipdot=true; fi + k="${#COMPREPLY[@]}" + for j in $( compgen -d -- "$i/$cur" ); do + COMPREPLY[k++]=${j#$i/} # cut off directory + done + done + $_skipdot || COMPREPLY+=( $(compgen -d -- "$cur") ) + IFS=$' \t\n' + fi + + # variable names if appropriate shell option set and no completions + if shopt -q cdable_vars && [[ ${#COMPREPLY[@]} -eq 0 ]]; then + COMPREPLY=( $(compgen -v -- "$cur") ) + fi + + # append slash to passed directory name that is the only completion. + # readline will not do this if we complete from CDPATH + if [[ ${#COMPREPLY[@]} -eq 1 ]]; then + i=${COMPREPLY[0]} # shorthand + if [[ "$cur" == "$i" ]] && [[ "$i" != "*/" ]]; then + COMPREPLY[0]+=/ + fi + fi + return 0 +} + +complete -o filenames -o nospace -o bashdefault -F _comp_cd cd diff --git a/examples/complete/complete-examples b/examples/complete/complete-examples index baa97e3..8a0746d 100644 --- a/examples/complete/complete-examples +++ b/examples/complete/complete-examples @@ -1,6 +1,23 @@ # # Completion examples # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2002 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # This encapsulates the default bash completion code diff --git a/examples/functions/array-stuff b/examples/functions/array-stuff index 97ed512..e6316c7 100644 --- a/examples/functions/array-stuff +++ b/examples/functions/array-stuff @@ -1,3 +1,22 @@ +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1999 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # usage: reverse arrayname reverse() { diff --git a/examples/functions/fstty b/examples/functions/fstty index a770d84..5ed594f 100644 --- a/examples/functions/fstty +++ b/examples/functions/fstty @@ -2,6 +2,24 @@ # A function that works as a front end for both stty and the `bind' # builtin, so the tty driver and readline see the same changes # +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2011 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Convert between the stty ^H control character form and the readline \C-H diff --git a/examples/functions/func b/examples/functions/func index 710f643..e7696f7 100644 --- a/examples/functions/func +++ b/examples/functions/func @@ -3,8 +3,24 @@ # # usage: func name [name ...] # -# Chet Ramey -# chet@ins.CWRU.Edu +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1991 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + func() { local status=0 diff --git a/examples/functions/inetaddr b/examples/functions/inetaddr index f3e228f..9e72613 100644 --- a/examples/functions/inetaddr +++ b/examples/functions/inetaddr @@ -1,4 +1,23 @@ # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2002 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# # inet2hex - Internet address conversion, dotted-decimal to hex # inet2hex () diff --git a/examples/functions/isnum2 b/examples/functions/isnum2 index e2e7a5f..583e374 100644 --- a/examples/functions/isnum2 +++ b/examples/functions/isnum2 @@ -1,3 +1,22 @@ +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1998 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + isnum2() { case "$1" in diff --git a/examples/functions/ksh-cd b/examples/functions/ksh-cd index 801a490..26b00a9 100644 --- a/examples/functions/ksh-cd +++ b/examples/functions/ksh-cd @@ -1,4 +1,23 @@ # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2001 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# # ksh-like `cd': cd [-LP] [dir [change]] # cd() diff --git a/examples/functions/ksh-compat-test b/examples/functions/ksh-compat-test index feee965..919d82b 100644 --- a/examples/functions/ksh-compat-test +++ b/examples/functions/ksh-compat-test @@ -1,4 +1,22 @@ # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1999 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# # replacements for test/[ that do arithmetic expansion on the operands to # the arithmetic operators, like ksh. # diff --git a/examples/functions/kshenv b/examples/functions/kshenv index 7594f2d..9faba08 100644 --- a/examples/functions/kshenv +++ b/examples/functions/kshenv @@ -5,6 +5,24 @@ # Chet Ramey # chet@ins.CWRU.Edu # + +# +# Copyright 2002 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # # These are definitions for the ksh compiled-in `exported aliases'. There # are others, but we already have substitutes for them: "history", "type", diff --git a/examples/functions/notify.bash b/examples/functions/notify.bash index dafbac5..ed4377c 100644 --- a/examples/functions/notify.bash +++ b/examples/functions/notify.bash @@ -1,3 +1,22 @@ +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1992 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + trap _notify CHLD NOTIFY_ALL=false unset NOTIFY_LIST diff --git a/examples/functions/seq b/examples/functions/seq index 87c8a2c..c1953ee 100644 --- a/examples/functions/seq +++ b/examples/functions/seq @@ -1,3 +1,22 @@ +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1995 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # Generate a sequence from m to n, m defaults to 1. seq () diff --git a/examples/functions/seq2 b/examples/functions/seq2 index c3ad95c..4a54498 100644 --- a/examples/functions/seq2 +++ b/examples/functions/seq2 @@ -1,3 +1,22 @@ +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1998 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # Generate a sequence from m to n, m defaults to 1. seq () diff --git a/examples/functions/sort-pos-params b/examples/functions/sort-pos-params index 0052b46..3fbf7db 100644 --- a/examples/functions/sort-pos-params +++ b/examples/functions/sort-pos-params @@ -1,3 +1,22 @@ +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2001 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # Sort the positional paramters. # Make sure the positional parameters are passed as arguments to the function. # If -u is the first arg, remove duplicate array members. diff --git a/examples/functions/substr b/examples/functions/substr index a80b3b4..f19f5d7 100644 --- a/examples/functions/substr +++ b/examples/functions/substr @@ -1,4 +1,22 @@ # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2002 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# # substr -- a function to emulate the ancient ksh builtin # diff --git a/examples/functions/substr2 b/examples/functions/substr2 index 2bb8d36..fc21b98 100644 --- a/examples/functions/substr2 +++ b/examples/functions/substr2 @@ -1,4 +1,22 @@ # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 2002 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# # substr -- a function to emulate the ancient ksh builtin # @@ -29,7 +47,7 @@ substr() done if [ "$OPTIND" -gt 1 ] ; then - shift $[ $OPTIND -1 ] + shift $(( $OPTIND -1 )) fi if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then diff --git a/examples/functions/whatis b/examples/functions/whatis index 56c5a58..570c585 100644 --- a/examples/functions/whatis +++ b/examples/functions/whatis @@ -9,6 +9,25 @@ # case, the value is printed in a form which would yield the same value # if typed as input to the shell itself. # +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1994 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + whatis() { diff --git a/examples/functions/whence b/examples/functions/whence index 70b2322..ba27b00 100644 --- a/examples/functions/whence +++ b/examples/functions/whence @@ -8,6 +8,25 @@ # Chet Ramey # chet@ins.CWRU.Edu # +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1994 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + whence() { local vflag= path= diff --git a/examples/functions/which b/examples/functions/which index ca33703..f0db290 100644 --- a/examples/functions/which +++ b/examples/functions/which @@ -3,6 +3,24 @@ # # usage: which [-as] command [command...] # +# +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1999 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. which() { diff --git a/examples/loadables/Makefile.in b/examples/loadables/Makefile.in index 343beb0..99549bf 100644 --- a/examples/loadables/Makefile.in +++ b/examples/loadables/Makefile.in @@ -85,7 +85,7 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \ ALLPROG = print truefalse sleep pushd finfo logname basename dirname \ tty pathchk tee head mkdir rmdir printenv id whoami \ - uname sync push ln unlink cut realpath getconf strftime mypid + uname sync push ln unlink realpath strftime mypid OTHERPROG = necho hello cat all: $(SHOBJ_STATUS) @@ -110,9 +110,6 @@ print: print.o necho: necho.o $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ necho.o $(SHOBJ_LIBS) -getconf: getconf.o - $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ getconf.o $(SHOBJ_LIBS) - hello: hello.o $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ hello.o $(SHOBJ_LIBS) @@ -179,9 +176,6 @@ ln: ln.o unlink: unlink.o $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ unlink.o $(SHOBJ_LIBS) -cut: cut.o - $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cut.o $(SHOBJ_LIBS) - realpath: realpath.o $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS) @@ -229,7 +223,6 @@ tee.o: tee.c head.o: head.c rmdir.o: rmdir.c necho.o: necho.c -getconf.o: getconf.c hello.o: hello.c cat.o: cat.c printenv.o: printenv.c diff --git a/examples/loadables/basename.c b/examples/loadables/basename.c index b5705cb..7ee817f 100644 --- a/examples/loadables/basename.c +++ b/examples/loadables/basename.c @@ -2,6 +2,24 @@ /* See Makefile for compilation details. */ +/* + Copyright (C) 1999-2009 Free Software Foundation, Inc. + + This file is part of GNU Bash. + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bash. If not, see <http://www.gnu.org/licenses/>. +*/ + #include "config.h" #if defined (HAVE_UNISTD_H) diff --git a/examples/loadables/finfo.c b/examples/loadables/finfo.c index af7ffb6..b806ef0 100644 --- a/examples/loadables/finfo.c +++ b/examples/loadables/finfo.c @@ -5,6 +5,24 @@ * chet@po.cwru.edu */ +/* + Copyright (C) 1999-2009 Free Software Foundation, Inc. + + This file is part of GNU Bash. + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bash. If not, see <http://www.gnu.org/licenses/>. +*/ + #ifdef HAVE_CONFIG_H # include <config.h> #endif diff --git a/examples/loadables/hello.c b/examples/loadables/hello.c index bff6e76..643156c 100644 --- a/examples/loadables/hello.c +++ b/examples/loadables/hello.c @@ -3,6 +3,24 @@ /* See Makefile for compilation details. */ +/* + Copyright (C) 1999-2009 Free Software Foundation, Inc. + + This file is part of GNU Bash. + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bash. If not, see <http://www.gnu.org/licenses/>. +*/ + #include <config.h> #if defined (HAVE_UNISTD_H) diff --git a/examples/loadables/mkdir.c b/examples/loadables/mkdir.c index f41f171..f5c105e 100644 --- a/examples/loadables/mkdir.c +++ b/examples/loadables/mkdir.c @@ -109,7 +109,7 @@ mkdir_builtin (list) umask (original_umask); nmode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~original_umask; - parent_mode = nmode | (S_IWRITE|S_IEXEC); /* u+wx */ + parent_mode = nmode | (S_IWUSR|S_IXUSR); /* u+wx */ /* Adjust new mode based on mode argument */ nmode &= omode; diff --git a/examples/loadables/sleep.c b/examples/loadables/sleep.c index a9bd36f..736c8af 100644 --- a/examples/loadables/sleep.c +++ b/examples/loadables/sleep.c @@ -66,6 +66,10 @@ WORD_LIST *list; return(EX_USAGE); } + /* Skip over `--' */ + if (list->word && ISOPTION (list->word->word, '-')) + list = list->next; + if (*list->word->word == '-' || list->next) { builtin_usage (); return (EX_USAGE); diff --git a/examples/scripts/center b/examples/scripts/center index 8d367d3..dbe6133 100644 --- a/examples/scripts/center +++ b/examples/scripts/center @@ -5,6 +5,23 @@ # tabs in the lines might cause this to look a little bit off # # +# Chet Ramey <chet.ramey@case.edu> +# +# Copyright 1999 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. width=${COLUMNS:-80} diff --git a/examples/scripts/shprompt b/examples/scripts/shprompt index ec8b997..098c45f 100755 --- a/examples/scripts/shprompt +++ b/examples/scripts/shprompt @@ -11,6 +11,22 @@ # # Chet Ramey # chet@ins.CWRU.Edu +# +# Copyright 2002 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. type=file @@ -44,7 +60,7 @@ do done if [ "$OPTIND" -gt 1 ] ; then - shift $[$OPTIND - 1] + shift $(( $OPTIND - 1 )) fi while : diff --git a/examples/scripts/spin.bash b/examples/scripts/spin.bash index dc6a66a..9fa9125 100644 --- a/examples/scripts/spin.bash +++ b/examples/scripts/spin.bash @@ -5,6 +5,22 @@ # Chet Ramey # chet@po.cwru.edu # +# Copyright 1997 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + bs=$'\b' chars="|${bs} \\${bs} -${bs} /${bs}" diff --git a/examples/scripts/xterm_title b/examples/scripts/xterm_title index 72ba099..839003f 100755 --- a/examples/scripts/xterm_title +++ b/examples/scripts/xterm_title @@ -4,6 +4,23 @@ # # Derived from http://www.clark.net/pub/dickey/xterm/xterm.faq.html#how2_title # + +# Copyright 1997 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + P=${0##*/} [ -z "$DISPLAY" ] && { echo "${P}: not running X" >&2 diff --git a/examples/scripts/zprintf b/examples/scripts/zprintf index 5e2e3ad..86f9e95 100755 --- a/examples/scripts/zprintf +++ b/examples/scripts/zprintf @@ -11,6 +11,23 @@ # Chet Ramey # chet@po.cwru.edu +# Copyright 1996 Chester Ramey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# TThis program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + [ $# -lt 1 ] && { echo "zprintf: usage: zprintf format [args ...]" >&2 exit 2 diff --git a/examples/startup-files/README b/examples/startup-files/README index 92667a6..00df041 100644 --- a/examples/startup-files/README +++ b/examples/startup-files/README @@ -10,12 +10,3 @@ bash-profile Sample startup file for bash login shells (Ramey). bashrc Sample Bourne Again SHell init file (Ramey). Bashrc.bfox Sample Bourne Again SHell init file (Fox). README README - -apple Example Start-up files for Mac OS X. -apple/aliases Sample aliases for Mac OS X. -apple/bash.defaults Sample User preferences file. -apple/environment Sample Bourne Again Shell environment file. -apple/login Sample login wrapper. -apple/logout Sample logout wrapper. -apple/rc Sample Bourne Again Shell config file. -apple/README README |