diff options
Diffstat (limited to 'examples/functions')
-rw-r--r-- | examples/functions/array-stuff | 19 | ||||
-rw-r--r-- | examples/functions/fstty | 18 | ||||
-rw-r--r-- | examples/functions/func | 20 | ||||
-rw-r--r-- | examples/functions/inetaddr | 19 | ||||
-rw-r--r-- | examples/functions/isnum2 | 19 | ||||
-rw-r--r-- | examples/functions/ksh-cd | 19 | ||||
-rw-r--r-- | examples/functions/ksh-compat-test | 18 | ||||
-rw-r--r-- | examples/functions/kshenv | 18 | ||||
-rw-r--r-- | examples/functions/notify.bash | 19 | ||||
-rw-r--r-- | examples/functions/seq | 19 | ||||
-rw-r--r-- | examples/functions/seq2 | 19 | ||||
-rw-r--r-- | examples/functions/sort-pos-params | 19 | ||||
-rw-r--r-- | examples/functions/substr | 18 | ||||
-rw-r--r-- | examples/functions/substr2 | 20 | ||||
-rw-r--r-- | examples/functions/whatis | 19 | ||||
-rw-r--r-- | examples/functions/whence | 19 | ||||
-rw-r--r-- | examples/functions/which | 18 |
17 files changed, 317 insertions, 3 deletions
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() { |