phone takes a fully qualified phone number and a locale specification and writes the local version of the phone number to standard output.
tar -zxf phone-1.2.tar.gzThis will create a directory
phone-1.2
inside your current
working directory. Change to this directory, and follow the
instructions in the file INSTALL.
Usage: phone [options] phone-number phone [options] alias phone [options] - Options and arguments: -h, --help help -v verbose -n suppress newline -l locale set locale string -f localename set locale by name -d dialchars set valid digits (default "+0123456789W@!,ABCD#*") -s strip output of non-dialchars phone-number a fully qualified phone number (starts with "+") alias a nickname for a phone number - run as a filter
Alias files. If a phone number is specified by an alias on the command line, then phone searches for the definition of the alias first in the file .phonebook in the user's home directory, and then in the system-wide file /etc/phonebook.sys. Each line of these files is assumed to be a pair
alias phone-numberseparated by white space. The phone number should be fully qualified. Typical lines of an alias file may look as follows:
mom +1-734-555-1212 gerhard +49-69-89551212 isp +1-888-555-1212Lines starting with "#" are comments. Ill-formed lines are ignored. Leading and trailing blanks are removed.
+=011-:+1=1-:+1734=specifies three replacement rules: any number can be dialed by replacing a leading "+" with "011-" (for international calls), or by replacing a leading "+1" with "1-" (for national calls other than local), or by replacing a leading "+1734" with "" (for local calls). I am in southern Michigan, where the area code is 734. As the example shows, a replacement string may be empty; the same is true for prefixes. If there is more than one matching replacement rule, the longest matching prefix is used. The following locale specifies that I wish to dial 1016868 before any long-distance call:
+=1016868-011-:+1=1016868-1-:+1734=The following locale is for my office. In my office, one has to dial "9" to reach an outside line. For internal calls, one can dial 3-xxxx and 6-xxxx to reach the respective local numbers 763-xxxx and 476-xxxx.
+=9-011-:+1=9-1-:+1734=9-:+1734763=3-:+1734476=6-The following locale is for Darmstadt, Germany:
+=00-:+49=0:+496151=
Note: if the locale has no rule that matches the given phone number, then phone prints a warning message and returns the unchanged input phone number. A frequent cause of this is a missing "+" at the beginning of the input phone number. To avoid this warning, add a "catchall" rule to the locale, which consists of an equality sign only.
The meaning of the replacement rules. To determine whether a replacement rule matches a given input phone number, first all non-dialchars are removed from the rule and from the phone number. If the left-hand-side of the rule is an initial piece of the phone number after this removal, then it is replaced by the right-hand-side of the rule. If more than one rule in a locale matches the given phone number, the rule that matches the most digits is used. If the -s option is given, phone strips all non-dialchars from the output. Otherwise, it retains as many non-dialchars as possible.
Locale files. If a localename is given with the -f option, phone searches for the definition of the locale in the file .phonelocale in the user's home directory, and then in the file /etc/phonelocale.sys. Similarly, if no -f or -l option is given, phone looks in these files for a locale named "default". The format of the locale files is similar to that of the alias files. Each line of a locale file is a pair
localename localeseparated by white space. The following are some sample entries:
default +=011-:+1=1-:+1734= office +=9-011-:+1=9-1-:+1734=9-:+1734763=3-:+1734476=6- darmstadt +=00-:+49=0:+496151=
example% phone mom 555-1212 example% phone mom -f office 9-555-1212 example% phone mom -f office -s 95551212 example% phone gerhard 011-49-69-89551212 example% phone +49-69-89551212 011-49-69-89551212 example% phone gerhard -f darmstadt 069-89551212 example% phone mom -l '+=011-:+1=1-' 1-734-555-1212
This 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.