# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # shells/poshinit # shells/poshinit/Makefile # shells/poshinit/distinfo # shells/poshinit/pkg-descr # shells/poshinit/files # shells/poshinit/files/poshinit # shells/poshinit/files/poshinit.1 # shells/poshinit/files/LICENSE # echo c - shells/poshinit mkdir -p shells/poshinit > /dev/null 2>&1 echo x - shells/poshinit/Makefile sed 's/^X//' >shells/poshinit/Makefile << '6478807b2a3d8dc27461825a16cce70d' X# $FreeBSD$ X XPORTNAME= poshinit XPORTVERSION= 1.0 XCATEGORIES= shells XMASTER_SITES= XDISTFILES= X XMAINTAINER= bourne.identity@hotmail.com XCOMMENT= Portable shell setup for Bash/Zsh across FreeBSD/Linux/Cygwin X XLICENSE= GPLv2+ XLICENSE_FILE= ${FILESDIR}/LICENSE X XNO_BUILD= yes XNO_ARCH= yes X XPLIST_FILES= bin/${PORTNAME} \ X man/man1/${PORTNAME}.1.gz X Xdo-install: X ${INSTALL_SCRIPT} ${FILESDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/ X ${INSTALL_MAN} ${FILESDIR}/${PORTNAME}.1 ${STAGEDIR}${MANPREFIX}/man/man1 X X.include 6478807b2a3d8dc27461825a16cce70d echo x - shells/poshinit/distinfo sed 's/^X//' >shells/poshinit/distinfo << 'ce674f5dd39fb7629c07239d6657c6f1' XTIMESTAMP = 1542812597 XSHA256 (poshinit-1.0.tar.gz) = a27f0ed53f456534cce1dd178a2e1bbd87e41ba214923219d46fad27e1f0acc0 XSIZE (poshinit-1.0.tar.gz) = 11628 ce674f5dd39fb7629c07239d6657c6f1 echo x - shells/poshinit/pkg-descr sed 's/^X//' >shells/poshinit/pkg-descr << '2129c847ef038fffda5874a53c844d9d' XYou want your shell stuff to work the same way even when you use a Xdifferent shell, or even a different box. Right ? X XIf you use poshinit (Portable Shell Initialization), you can attain at Xleast most of what you desire, perhaps even all. You can log out of Bash Xand log in with Zsh (or vice versa) - and your aliases/exports/functions Xwill continue to work as before. X XIt gets better - if someday you need to use a different box with a Xdifferent OS, you can get your shell to work your 'normal' way in a Xjiffy. Just save your $HOME/.shell directory on your primary box, and Xpaste it over your second box's $HOME/.shell (after running poshinit Xsetup script on the second box). The second box need not be the same Xoperating system - poshinit works across FreeBSD / Linux / Cygwin. X XWWW: https://github.com/bourne-again/poshinit 2129c847ef038fffda5874a53c844d9d echo c - shells/poshinit/files mkdir -p shells/poshinit/files > /dev/null 2>&1 echo x - shells/poshinit/files/poshinit sed 's/^X//' >shells/poshinit/files/poshinit << 'dc2b66c0e9046aacdb87214597a61851' X#!/bin/sh X Xzksh=false Xeditor=vim X Xdie() X{ X [ $# -eq 0 ] && exit 1 X X [ $# -gt 1 ] && \ X echo "error initiated at line $1 : X $2" 1>&2 || \ X echo "$1" 1>&2 X X exit 1 X} X Xwhile [ $# -gt 0 ]; do X case "$1" in X --help) X man poshinit X exit 0 X ;; X X *) X die $LINENO "Invalid arg : $1" X ;; X esac Xdone X Xcd $HOME || die $LINENO '`cd $HOME` failed. Aborting : - (' X Xecho 'I shall delete 3 globs under your $HOME : .bash* .zsh* .shell*' Xecho 'If you are okay with that, press Enter. Else hit Ctrl+C to abort.' Xread dummy X Xrm -rf .bash* .zsh* .shell* X Xok=false X Xwhile [ $ok = false ]; do X echo "I am using $editor as your preferred text editor" X echo "Is that okay with you ? (y/n):" X X read answer X case "$answer" in X y|Y|yes) X ok=true X ;; X X n|N|no) X echo "Enter the command to use as editor" X read editor X ;; X X *) X die $LINENO 'I could not make any sense of that. Aborting : - (' X ;; X esac Xdone X X[ -z "$editor" ] && die $LINENO '$editor is null. Aborting : - (' X Xif ! which "$editor" > /dev/null; then X echo 'Warning: bad `which $editor`' 1>&2 X echo 'I am continuing with setup as such.' 1>&2 X echo 'You can change your editor via ~/.shell/exports' 1>&2 X echo 'Press Enter to continue' X read dummy Xfi X Xecho "Z shell by default begins array indexing at 1." Xecho "Some system programs assume the default behaviour." Xecho "But, if you need, you can change the default below." Xecho "Would you like your Z to begin arrays at 0 (Bash-compatible) ? (y/n):" X Xread answer Xcase "$answer" in X y|Y|yes) X zksh=true X ;; X X n|N|no) X zksh=false X ;; X X *) X die $LINENO 'I could not make any sense of that. Aborting : - (' X ;; Xesac X Xset -e Xclear Xmkdir .shell X X{ Xcat << 'EOF_aliases' X# This file is meant for implementation-independent aliases. X# Put OS-specific aliases (eg: ls) in level_2 X Xalias editor="$EDITOR" Xalias p="cd .." Xalias p2="cd ../.." Xalias rf="rm -rf" X X##### Above this line is what was pre-packaged. Below is the user section ###### X XEOF_aliases X} > .shell/aliases X X{ Xcat << 'EOF_exports' X# This file is meant for implementation-independent exports. X# Put OS-specific exports in level_2 X Xexport PATH=$PATH:$HOME/bin X X##### Above this line is what was pre-packaged. Below is the user section ###### X XEOF_exports X} > .shell/exports X Xecho "export EDITOR=$editor" >> .shell/exports X X{ Xcat << 'EOF_functions' X# This file is meant for implementation-independent functions. X# Put OS-specific functions in level_2 X X##### Above this line is what was pre-packaged. Below is the user section ###### X XEOF_functions X} > .shell/functions X Xecho > .shell/uponlogin Xecho > .shell/uponlogout X Xecho '[ -e ~/.shell/level_1.all ] && . ~/.shell/level_1.all' > .shellrc Xecho '[ -e ~/.shell/uponlogin ] && . ~/.shell/uponlogin' >> .shellrc X X{ Xcat << 'EOF_bash' Xexport PS1='`pwd` <<: ' Xexport HISTFILE="$HOME/.bash_history" X[ -e ~/.shell/uponlogout ] && ln -sf ~/.shell/uponlogout ~/.bash_logout X[ -e ~/.shellrc ] && . ~/.shellrc XEOF_bash X} > .bashrc X Xln .bashrc .bash_profile X X> .zshrc X[ $zksh = true ] && echo "setopt KSH_ARRAYS" >> .zshrc X X{ Xcat << 'EOF_zsh' Xexport PROMPT='%d <<: ' Xexport HISTFILE="$HOME/.zhistory" Xexport HISTSIZE=1000 Xexport SAVEHIST=$HISTSIZE Xsetopt hist_ignore_all_dups Xsetopt share_history Xbindkey "\e[1~" beginning-of-line Xbindkey "\e[4~" end-of-line Xbindkey "\e[5~" beginning-of-history Xbindkey "\e[6~" end-of-history Xbindkey "\e[3~" delete-char Xbindkey "\e[2~" quoted-insert Xbindkey "\e[5C" forward-word Xbindkey "\eOc" emacs-forward-word Xbindkey "\e[5D" backward-word Xbindkey "\eOd" emacs-backward-word Xbindkey "\ee[C" forward-word Xbindkey "\ee[D" backward-word Xbindkey "\^H" backward-delete-word Xbindkey "\e[8~" end-of-line Xbindkey "\e[7~" beginning-of-line Xbindkey "\eOH" beginning-of-line Xbindkey "\eOF" end-of-line Xbindkey '^i' expand-or-complete-prefix Xbindkey "\e[H" beginning-of-line Xbindkey "\e[F" end-of-line X[ -e ~/.shell/uponlogout ] && ln -sf ~/.shell/uponlogout ~/.zlogout X[ -e ~/.shellrc ] && . ~/.shellrc XEOF_zsh X} >> .zshrc X X{ Xcat << 'EOF1_all' Xecho "$-" | grep -q 'i' || return X X# Exported definitions always get processed first : X[ -f ~/.shell/exports ] && . ~/.shell/exports # define EDITOR here X[ -f ~/.shell/aliases ] && . ~/.shell/aliases # define editor here X[ -f ~/.shell/functions ] && . ~/.shell/functions X Xalias editor="$EDITOR" # restated, after ~/.aliases Xalias A="editor ~/.shell/aliases" Xalias AA=". ~/.shell/aliases" Xalias E="editor ~/.shell/exports" Xalias EE=". ~/.shell/exports" Xalias F="editor ~/.shell/functions" Xalias FF=". ~/.shell/functions" Xalias I="editor ~/.shell/uponlogin" Xalias II=". ~/.shell/uponlogin" Xalias O="editor ~/.shell/uponlogout" Xalias OO=". ~/.shell/uponlogout" Xalias L1="editor ~/.shell/level_1.all" Xalias L2="editor ~/.shell/level_2" X X# End of level_1 (Unix) global configuration. X# All stuff below is for level_2, which branches for X# freebsd / linux / cygwin : X Xif [ -L ~/.shell/level_2 ]; then X for dist in freebsd linux cygwin; do X if uname | grep -q -i $dist; then X if ! readlink ~/.shell/level_2 | grep -q -i $dist; then X if [ -f ~/.shell/level_2.${dist} ]; then X cd ~/.shell X ln -sf level_2.${dist} level_2 X 1>/dev/null cd - X else X rm -f ~/.shell/level_2 X fi X fi X X break X fi X done Xelse X if ! [ -f ~/.shell/level_2 ]; then X dist=`uname | tr '[:upper:]' '[:lower:]' | sed 's|_.*||'` X X if [ -f ~/.shell/level_2.${dist} ]; then X cd ~/.shell X ln -s level_2.${dist} level_2 X 1>/dev/null cd - X fi X fi Xfi X X[ -e ~/.shell/level_3 ] && rm -f ~/.shell/level_3 X[ -e ~/.shell/level_2 ] && . ~/.shell/level_2 XEOF1_all X} > .shell/level_1.all X X{ Xcat << 'EOF2_freebsd' X# This file is meant for FreeBSD-specific definitions. X# Put implementation-independent definitions in the files X# [$HOME/.shell/]aliases|exports|functions X Xalias ls="ls -G" Xalias pfind="pkg search" Xalias pin="pkg install" Xalias pls="pkg query %n" Xalias pig="pkg query %n | grep -i" X X# Restart your terminal to have changes to this file take effect # XEOF2_freebsd X} > .shell/level_2.freebsd X X{ Xcat << 'EOF2_cygwin' X# This file is meant for Cygwin-specific definitions. X# Put implementation-independent definitions in the files X# [$HOME/.shell/]aliases|exports|functions X Xalias ls="ls --color=auto" X X# Restart your terminal to have changes to this file take effect # XEOF2_cygwin X} > .shell/level_2.cygwin X X{ Xcat << 'EOF2_linux' X# This file is meant for Linux-specific definitions. X# Put implementation-independent definitions in the files X# [$HOME/.shell/]aliases|exports|functions X X# Xalias ls="ls --color=auto" Xalias L3="editor ~/.shell/level_3" X# X X# End of distro-independent block. X# All stuff below is for Level 3, which branches for distro flavours: X# arch / debian / redhat X Xflavour="" X Xif [ -f /etc/arch-release ]; then X flavour=arch Xelif [ -f /etc/debian_version ]; then X flavour=debian Xelif [ -f /etc/redhat-release ]; then X flavour=redhat Xfi X X[ -n "$flavour" ] || return X Xif [ -L ~/.shell/level_3 ]; then X if ! readlink ~/.shell/level_3 | grep -q -i $flavour; then X if [ -f ~/.shell/level_3.${flavour} ]; then X cd ~/.shell X ln -sf level_3.${flavour} level_3 X 1>/dev/null cd - X else X rm -f ~/.shell/level_3 X fi X fi Xelse X if ! [ -f ~/.shell/level_3 ]; then X if [ -f ~/.shell/level_3.${flavour} ]; then X cd ~/.shell X ln -s level_3.${flavour} level_3 X 1>/dev/null cd - X fi X fi Xfi X X[ -e ~/.shell/level_3 ] && . ~/.shell/level_3 X X# Restart your terminal to have changes to this file take effect # XEOF2_linux X} > .shell/level_2.linux X X{ Xcat << 'EOF3_arch' Xalias pfind="pacman -Ss" Xalias pin="pacman -S" Xalias pls="pacman --query" Xalias pig="pacman --query | grep -i" X X# Restart your terminal to have changes to this file take effect # XEOF3_arch X} > .shell/level_3.arch X X{ Xcat << 'EOF3_debian' Xalias pfind="apt search" Xalias pin="apt install" Xalias pls="apt list --installed" Xalias pig="apt list --installed | grep -i" X X# Restart your terminal to have changes to this file take effect # XEOF3_debian X} > .shell/level_3.debian X X{ Xcat << 'EOF3_redhat' Xalias pfind="yum search" Xalias pin="yum install" Xalias pls="yum list installed" Xalias pig="yum list installed | grep -i" X X# Restart your terminal to have changes to this file take effect # XEOF3_redhat X} > .shell/level_3.redhat X Xset +e X X{ Xcat << 'EOF_final' XI have created 3 kinds of aliases, as noted underneath. X XA) implementation-independent : | C) implementation-dependent : X(under $HOME/.shell/aliases) | (under the highest possible level; 1=High) Xalias editor="$EDITOR" | Xalias p="cd .." | c1)) For FreeBSD (under .shell/level_2) Xalias p2="cd ../.." | alias ls="ls -G" Xalias rf="rm -rf" | alias pfind="pkg search" X | alias pin="pkg install" XB) poshinit-specific : | alias pls="pkg query %n" X(under $HOME/.shell/level_1.all) | alias pig="pkg query %n | grep -i" Xalias A="editor ~/.shell/aliases" | Xalias AA=". ~/.shell/aliases" | c2)) For Cygwin (under .shell/level_2) Xalias E="editor ~/.shell/exports" | alias ls="ls --color=auto" Xalias EE=". ~/.shell/exports" | Xalias F="editor ~/.shell/functions" | c3)) Linux (distro-independent -> level_2) Xalias FF=". ~/.shell/functions" | alias ls="ls --color=auto" Xalias I="editor ~/.shell/uponlogin" | alias L3="editor ~/.shell/level_3" Xalias II=". ~/.shell/uponlogin" | Xalias O="editor ~/.shell/uponlogout"| c4)) Linux (distro-dependent -> level_3) Xalias OO=". ~/.shell/uponlogout" | alias pfind="" Xalias L1="editor ~/.shell/level_1" | alias pin="" Xalias L2="editor ~/.shell/level_2" | alias pls="" X | alias pig="" X XPortable shell initialization layout created successfully. XTo have it take effect, logout and login again (or restart your terminal). XThis complete message has been saved as $HOME/poshinit-msg.txt XEOF_final X} | tee poshinit-msg.txt X Xexit 0 dc2b66c0e9046aacdb87214597a61851 echo x - shells/poshinit/files/poshinit.1 sed 's/^X//' >shells/poshinit/files/poshinit.1 << 'c65359b881c53a4982ce7f8cca733d84' X.TH man 1 "06 November 2018" "1.0" "poshinit man page" X X.SH NAME Xposhinit \- Portable Shell Initialization X X.SH SYNOPSIS Xposhinit \- setup a portable shell environment that you can reuse across XBash/Zsh and across multiple operating systems (FreeBSD/Linux/Cygwin) X X.SH DESCRIPTION Xposhinit is a convenient way of setting up and then reusing your master Xshell environment when you work with Bash or Zsh. It works across all Xmajor Open Source implementations (FreeBSD / Linux / Cygwin). X XWhen you run the setup script, it just creates the filesystem layout it Xneeds. If you later switch your shell from Bash to Zsh or vice versa, Xthe layout ensures that your new shell works just as the prior one. X XWhen you use poshinit the first time (to create your master shell Xenvironment), the major facilities are the aliases A (edit your aliases) Xand AA (insert your aliases into the shell environment). Aliases are Xstored under ~/.shell/aliases. X XSimilar hacks exist for exports (E/EE), functions (F/FF), commands Xto auto-execute on login, a.k.a. 'uponlogin' (I/II) and commands Xto auto-execute on logout, a.k.a. 'uponlogout' (O/OO). X XThe first time you use poshinit, you have to do the hard work in Xsetting up your complete shell environment. But once you have done the Xhard work, you can get the same environment every time in future with Xvery little effort - just run poshinit setup script, and copy over your Xmaster ~/.shell directory (or maybe even modify the poshinit script). X XIt is nice to know a bit about the layout utilized by poshinit. X X~/.bashrc is hard-linked as ~/.bash_profile X.br X~/.zshrc and ~/.bashrc source a common file ~/.shellrc X XWhen using poshinit, do not modify .bashrc / .bash_profile / .zshrc Xyourself. Instead, modify the tree under ~/.shell (see below). X X~/.shellrc uses the following tree in which the symbolic links Xlevel_2 and level_3 get populated dynamically at the time of login. X(Linux systems use level_2 & level_3. FreeBSD/Cygwin use level_2 only.) X X~/.shell X.br X|-- aliases X.br X|-- exports X.br X|-- functions X.br X|-- uponlogin X.br X|-- uponlogout X.br X|-- level_1.all X.br X|-- level_2 -> ? X.br X|-- level_2.cygwin X.br X|-- level_2.freebsd X.br X|-- level_2.linux X.br X|-- level_3 -> ? X.br X|-- level_3.arch X.br X|-- level_3.debian X.br X|-- level_3.redhat X XThe following utility aliases are available in a poshinit installation: X Xalias editor="$EDITOR" # ~/.shell/exports states EDITOR X.br Xalias A="editor ~/.shell/aliases" X.br Xalias AA=". ~/.shell/aliases" X.br Xalias E="editor ~/.shell/exports" X.br Xalias EE=". ~/.shell/exports" X.br Xalias F="editor ~/.shell/functions" X.br Xalias FF=". ~/.shell/functions" X.br Xalias I="editor ~/.shell/uponlogin" X.br Xalias II=". ~/.shell/uponlogin" X.br Xalias O="editor ~/.shell/uponlogout" X.br Xalias OO=". ~/.shell/uponlogout" X.br Xalias L1="editor ~/.shell/level_1.all" X.br Xalias L2="editor ~/.shell/level_2" X.br Xalias L3="editor ~/.shell/level_3" # only for Linux X XWhile it should not be difficult to commit all the above hacks to Xmemory, at least remember the three most important ones: X XA Edit portable aliases X.br XAA Insert portable aliases into the shell environment X.br XL2 Edit OS-specific definitions (aliases/exports/functions) X XWhen using poshinit, remember that something is considered Ximplementation-independent (and thus fully portable) if it works the Xsame across FreeBSD / Linux / Cygwin. is a XFreeBSD implementation-dependent alias because it won't work on Cygwin Xand Linux, where the toor user does not exist. X XWith the above in mind : X X1) Put commands to be auto-executed upon login in ~/.shell/uponlogin Xand commands to be auto-executed upon logout in ~/.shell/uponlogout X.br X2) Put all OS-independent aliases in ~/.shell/aliases X.br X3) Put all OS-independent exports in ~/.shell/exports X.br X4) Put all OS-independent functions in ~/.shell/functions X.br X5) Place all OS-dependent definitions ~/.shell/level_2 X XIf you have any definition that depends not just on the OS but Xfurther on its flavours, place it under ~/.shell/level_3. So if Xyou are on a Linux box and are working with a definition that is Xdistro-dependent (eg: an alias to ), Xplace the definition under ~/.shell/level_3, not ~/.shell/level_2. X~/.shell/level_2 is reserved for stuff that works on the OS Xwithout concern for its flavours. X X.SH OPTIONS XThe poshinit command does not take any options. X X.SH SEE ALSO Xenv(1) X XRunning the bare command `alias` displays all aliases active. X.br X`man alias` should work too, but is currently unusable because Xit redirects as a shell built-in. X X.SH BUGS X1) Default (level_3) yum alias definitions are CentOS-based and may Xnot always work out-of-the-box under RedHat distributions. If so, Xjust use L3 to edit those aliases. X X2) A (level_3) branch for the Cygwin fork Babun should perhaps exist, Xbut currently does not. X X.SH AUTHOR XManish Jain (bourne.identity@hotmail.com) c65359b881c53a4982ce7f8cca733d84 echo x - shells/poshinit/files/LICENSE sed 's/^X//' >shells/poshinit/files/LICENSE << '613227160a073b0adc15ecf9f3bebf9f' X GNU GENERAL PUBLIC LICENSE X Version 2, June 1991 X X Copyright (C) 1989, 1991 Free Software Foundation, Inc. X 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA X Everyone is permitted to copy and distribute verbatim copies X of this license document, but changing it is not allowed. X X Preamble X X The licenses for most software are designed to take away your Xfreedom to share and change it. By contrast, the GNU General Public XLicense is intended to guarantee your freedom to share and change free Xsoftware--to make sure the software is free for all its users. This XGeneral Public License applies to most of the Free Software XFoundation's software and to any other program whose authors commit to Xusing it. (Some other Free Software Foundation software is covered by Xthe GNU Library General Public License instead.) You can apply it to Xyour programs, too. X X When we speak of free software, we are referring to freedom, not Xprice. Our General Public Licenses are designed to make sure that you Xhave the freedom to distribute copies of free software (and charge for Xthis service if you wish), that you receive source code or can get it Xif you want it, that you can change the software or use pieces of it Xin new free programs; and that you know you can do these things. X X To protect your rights, we need to make restrictions that forbid Xanyone to deny you these rights or to ask you to surrender the rights. XThese restrictions translate to certain responsibilities for you if you Xdistribute copies of the software, or if you modify it. X X For example, if you distribute copies of such a program, whether Xgratis or for a fee, you must give the recipients all the rights that Xyou have. You must make sure that they, too, receive or can get the Xsource code. And you must show them these terms so they know their Xrights. X X We protect your rights with two steps: (1) copyright the software, and X(2) offer you this license which gives you legal permission to copy, Xdistribute and/or modify the software. X X Also, for each author's protection and ours, we want to make certain Xthat everyone understands that there is no warranty for this free Xsoftware. If the software is modified by someone else and passed on, we Xwant its recipients to know that what they have is not the original, so Xthat any problems introduced by others will not reflect on the original Xauthors' reputations. X X Finally, any free program is threatened constantly by software Xpatents. We wish to avoid the danger that redistributors of a free Xprogram will individually obtain patent licenses, in effect making the Xprogram proprietary. To prevent this, we have made it clear that any Xpatent must be licensed for everyone's free use or not licensed at all. X X The precise terms and conditions for copying, distribution and Xmodification follow. X X GNU GENERAL PUBLIC LICENSE X TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION X X 0. This License applies to any program or other work which contains Xa notice placed by the copyright holder saying it may be distributed Xunder the terms of this General Public License. The "Program", below, Xrefers to any such program or work, and a "work based on the Program" Xmeans either the Program or any derivative work under copyright law: Xthat is to say, a work containing the Program or a portion of it, Xeither verbatim or with modifications and/or translated into another Xlanguage. (Hereinafter, translation is included without limitation in Xthe term "modification".) Each licensee is addressed as "you". X XActivities other than copying, distribution and modification are not Xcovered by this License; they are outside its scope. The act of Xrunning the Program is not restricted, and the output from the Program Xis covered only if its contents constitute a work based on the XProgram (independent of having been made by running the Program). XWhether that is true depends on what the Program does. X X 1. You may copy and distribute verbatim copies of the Program's Xsource code as you receive it, in any medium, provided that you Xconspicuously and appropriately publish on each copy an appropriate Xcopyright notice and disclaimer of warranty; keep intact all the Xnotices that refer to this License and to the absence of any warranty; Xand give any other recipients of the Program a copy of this License Xalong with the Program. X XYou may charge a fee for the physical act of transferring a copy, and Xyou may at your option offer warranty protection in exchange for a fee. X X 2. You may modify your copy or copies of the Program or any portion Xof it, thus forming a work based on the Program, and copy and Xdistribute such modifications or work under the terms of Section 1 Xabove, provided that you also meet all of these conditions: X X a) You must cause the modified files to carry prominent notices X stating that you changed the files and the date of any change. X X b) You must cause any work that you distribute or publish, that in X whole or in part contains or is derived from the Program or any X part thereof, to be licensed as a whole at no charge to all third X parties under the terms of this License. X X c) If the modified program normally reads commands interactively X when run, you must cause it, when started running for such X interactive use in the most ordinary way, to print or display an X announcement including an appropriate copyright notice and a X notice that there is no warranty (or else, saying that you provide X a warranty) and that users may redistribute the program under X these conditions, and telling the user how to view a copy of this X License. (Exception: if the Program itself is interactive but X does not normally print such an announcement, your work based on X the Program is not required to print an announcement.) X XThese requirements apply to the modified work as a whole. If Xidentifiable sections of that work are not derived from the Program, Xand can be reasonably considered independent and separate works in Xthemselves, then this License, and its terms, do not apply to those Xsections when you distribute them as separate works. But when you Xdistribute the same sections as part of a whole which is a work based Xon the Program, the distribution of the whole must be on the terms of Xthis License, whose permissions for other licensees extend to the Xentire whole, and thus to each and every part regardless of who wrote it. X XThus, it is not the intent of this section to claim rights or contest Xyour rights to work written entirely by you; rather, the intent is to Xexercise the right to control the distribution of derivative or Xcollective works based on the Program. X XIn addition, mere aggregation of another work not based on the Program Xwith the Program (or with a work based on the Program) on a volume of Xa storage or distribution medium does not bring the other work under Xthe scope of this License. X X 3. You may copy and distribute the Program (or a work based on it, Xunder Section 2) in object code or executable form under the terms of XSections 1 and 2 above provided that you also do one of the following: X X a) Accompany it with the complete corresponding machine-readable X source code, which must be distributed under the terms of Sections X 1 and 2 above on a medium customarily used for software interchange; or, X X b) Accompany it with a written offer, valid for at least three X years, to give any third party, for a charge no more than your X cost of physically performing source distribution, a complete X machine-readable copy of the corresponding source code, to be X distributed under the terms of Sections 1 and 2 above on a medium X customarily used for software interchange; or, X X c) Accompany it with the information you received as to the offer X to distribute corresponding source code. (This alternative is X allowed only for noncommercial distribution and only if you X received the program in object code or executable form with such X an offer, in accord with Subsection b above.) X XThe source code for a work means the preferred form of the work for Xmaking modifications to it. For an executable work, complete source Xcode means all the source code for all modules it contains, plus any Xassociated interface definition files, plus the scripts used to Xcontrol compilation and installation of the executable. However, as a Xspecial exception, the source code distributed need not include Xanything that is normally distributed (in either source or binary Xform) with the major components (compiler, kernel, and so on) of the Xoperating system on which the executable runs, unless that component Xitself accompanies the executable. X XIf distribution of executable or object code is made by offering Xaccess to copy from a designated place, then offering equivalent Xaccess to copy the source code from the same place counts as Xdistribution of the source code, even though third parties are not Xcompelled to copy the source along with the object code. X X 4. You may not copy, modify, sublicense, or distribute the Program Xexcept as expressly provided under this License. Any attempt Xotherwise to copy, modify, sublicense or distribute the Program is Xvoid, and will automatically terminate your rights under this License. XHowever, parties who have received copies, or rights, from you under Xthis License will not have their licenses terminated so long as such Xparties remain in full compliance. X X 5. You are not required to accept this License, since you have not Xsigned it. However, nothing else grants you permission to modify or Xdistribute the Program or its derivative works. These actions are Xprohibited by law if you do not accept this License. Therefore, by Xmodifying or distributing the Program (or any work based on the XProgram), you indicate your acceptance of this License to do so, and Xall its terms and conditions for copying, distributing or modifying Xthe Program or works based on it. X X 6. Each time you redistribute the Program (or any work based on the XProgram), the recipient automatically receives a license from the Xoriginal licensor to copy, distribute or modify the Program subject to Xthese terms and conditions. You may not impose any further Xrestrictions on the recipients' exercise of the rights granted herein. XYou are not responsible for enforcing compliance by third parties to Xthis License. X X 7. If, as a consequence of a court judgment or allegation of patent Xinfringement or for any other reason (not limited to patent issues), Xconditions are imposed on you (whether by court order, agreement or Xotherwise) that contradict the conditions of this License, they do not Xexcuse you from the conditions of this License. If you cannot Xdistribute so as to satisfy simultaneously your obligations under this XLicense and any other pertinent obligations, then as a consequence you Xmay not distribute the Program at all. For example, if a patent Xlicense would not permit royalty-free redistribution of the Program by Xall those who receive copies directly or indirectly through you, then Xthe only way you could satisfy both it and this License would be to Xrefrain entirely from distribution of the Program. X XIf any portion of this section is held invalid or unenforceable under Xany particular circumstance, the balance of the section is intended to Xapply and the section as a whole is intended to apply in other Xcircumstances. X XIt is not the purpose of this section to induce you to infringe any Xpatents or other property right claims or to contest validity of any Xsuch claims; this section has the sole purpose of protecting the Xintegrity of the free software distribution system, which is Ximplemented by public license practices. Many people have made Xgenerous contributions to the wide range of software distributed Xthrough that system in reliance on consistent application of that Xsystem; it is up to the author/donor to decide if he or she is willing Xto distribute software through any other system and a licensee cannot Ximpose that choice. X XThis section is intended to make thoroughly clear what is believed to Xbe a consequence of the rest of this License. X X 8. If the distribution and/or use of the Program is restricted in Xcertain countries either by patents or by copyrighted interfaces, the Xoriginal copyright holder who places the Program under this License Xmay add an explicit geographical distribution limitation excluding Xthose countries, so that distribution is permitted only in or among Xcountries not thus excluded. In such case, this License incorporates Xthe limitation as if written in the body of this License. X X 9. The Free Software Foundation may publish revised and/or new versions Xof the General Public License from time to time. Such new versions will Xbe similar in spirit to the present version, but may differ in detail to Xaddress new problems or concerns. X XEach version is given a distinguishing version number. If the Program Xspecifies a version number of this License which applies to it and "any Xlater version", you have the option of following the terms and conditions Xeither of that version or of any later version published by the Free XSoftware Foundation. If the Program does not specify a version number of Xthis License, you may choose any version ever published by the Free Software XFoundation. X X 10. If you wish to incorporate parts of the Program into other free Xprograms whose distribution conditions are different, write to the author Xto ask for permission. For software which is copyrighted by the Free XSoftware Foundation, write to the Free Software Foundation; we sometimes Xmake exceptions for this. Our decision will be guided by the two goals Xof preserving the free status of all derivatives of our free software and Xof promoting the sharing and reuse of software generally. X X NO WARRANTY X X 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, XREPAIR OR CORRECTION. X X 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE XPOSSIBILITY OF SUCH DAMAGES. X X END OF TERMS AND CONDITIONS X X How to Apply These Terms to Your New Programs X X If you develop a new program, and you want it to be of the greatest Xpossible use to the public, the best way to achieve this is to make it Xfree software which everyone can redistribute and change under these terms. X X To do so, attach the following notices to the program. It is safest Xto attach them to the start of each source file to most effectively Xconvey the exclusion of warranty; and each file should have at least Xthe "copyright" line and a pointer to where the full notice is found. X X X Copyright (C) X X This program is free software; you can redistribute it and/or modify X it under the terms of the GNU General Public License as published by X the Free Software Foundation; either version 2 of the License, or X (at your option) any later version. X X This program is distributed in the hope that it will be useful, X but WITHOUT ANY WARRANTY; without even the implied warranty of X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X GNU General Public License for more details. X X You should have received a copy of the GNU General Public License X along with this program; if not, write to the Free Software X Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA X X XAlso add information on how to contact you by electronic and paper mail. X XIf the program is interactive, make it output a short notice like this Xwhen it starts in an interactive mode: X X Gnomovision version 69, Copyright (C) year name of author X Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. X This is free software, and you are welcome to redistribute it X under certain conditions; type `show c' for details. X XThe hypothetical commands `show w' and `show c' should show the appropriate Xparts of the General Public License. Of course, the commands you use may Xbe called something other than `show w' and `show c'; they could even be Xmouse-clicks or menu items--whatever suits your program. X XYou should also get your employer (if you work as a programmer) or your Xschool, if any, to sign a "copyright disclaimer" for the program, if Xnecessary. Here is a sample; alter the names: X X Yoyodyne, Inc., hereby disclaims all copyright interest in the program X `Gnomovision' (which makes passes at compilers) written by James Hacker. X X , 1 April 1989 X Ty Coon, President of Vice X XThis General Public License does not permit incorporating your program into Xproprietary programs. If your program is a subroutine library, you may Xconsider it more useful to permit linking proprietary applications with the Xlibrary. If this is what you want to do, use the GNU Library General XPublic License instead of this License. 613227160a073b0adc15ecf9f3bebf9f exit