diff -acprNC5 bc-1.06.orig/bc/proto.h bc-1.06.djgpp/bc/proto.h
*** bc-1.06.orig/bc/proto.h	Wed Sep 13 18:25:08 2000
--- bc-1.06.djgpp/bc/proto.h	Sun Dec 24 15:32:24 2000
*************** _PROTOTYPE(int yylex, (void)); 
*** 142,148 ****
--- 142,152 ----
  _PROTOTYPE(char *null_prompt, (EditLine *));
  #endif
  
  /* Other things... */
  #ifndef HAVE_UNISTD_H
+ # ifdef __DJGPP__
+ _PROTOTYPE (int getopt, (int, char * CONST [], CONST char *));
+ # else
  _PROTOTYPE (int getopt, (int, char *[], CONST char *));
+ # endif
  #endif
diff -acprNC5 bc-1.06.orig/doc/bc.1 bc-1.06.djgpp/doc/bc.1
*** bc-1.06.orig/doc/bc.1	Wed Sep 27 23:32:04 2000
--- bc-1.06.djgpp/doc/bc.1	Sun Dec 24 15:32:24 2000
*************** The exponential function of raising e to
*** 512,531 ****
  The bessel function of integer order n of x.
  .SS EXAMPLES
  In /bin/sh,  the following will assign the value of "pi" to the shell
  variable \fBpi\fR.
  .RS
! \f(CW
  pi=$(echo "scale=10; 4*a(1)" | bc -l)
  \fR
  .RE
  .PP
  The following is the definition of the exponential function used in the
  math library.  This function is written in POSIX \fBbc\fR.
  .nf
  .RS
! \f(CW
  scale = 20
  
  /* Uses the fact that e^x = (e^(x/2))^2
     When x is small enough, we use the series:
       e^x = 1 + x + x^2/2! + x^3/3! + ...
--- 512,531 ----
  The bessel function of integer order n of x.
  .SS EXAMPLES
  In /bin/sh,  the following will assign the value of "pi" to the shell
  variable \fBpi\fR.
  .RS
! \fI
  pi=$(echo "scale=10; 4*a(1)" | bc -l)
  \fR
  .RE
  .PP
  The following is the definition of the exponential function used in the
  math library.  This function is written in POSIX \fBbc\fR.
  .nf
  .RS
! \fI
  scale = 20
  
  /* Uses the fact that e^x = (e^(x/2))^2
     When x is small enough, we use the series:
       e^x = 1 + x + x^2/2! + x^3/3! + ...
*************** The following is code that uses the exte
*** 572,582 ****
  implement a simple program for calculating checkbook balances.  This
  program is best kept in a file so that it can be used many times 
  without having to retype it at every use.
  .nf
  .RS
! \f(CW
  scale=2
  print "\enCheck book program!\en"
  print "  Remember, deposits are negative transactions.\en"
  print "  Exit by a 0 transaction.\en\en"
  
--- 572,582 ----
  implement a simple program for calculating checkbook balances.  This
  program is best kept in a file so that it can be used many times 
  without having to retype it at every use.
  .nf
  .RS
! \fI
  scale=2
  print "\enCheck book program!\en"
  print "  Remember, deposits are negative transactions.\en"
  print "  Exit by a 0 transaction.\en\en"
  
*************** quit
*** 596,606 ****
  .fi
  .PP
  The following is the definition of the recursive factorial function.
  .nf
  .RS
! \f(CW
  define f (x) {
    if (x <= 1) return (1);
    return (f(x-1) * x);
  }
  \fR
--- 596,606 ----
  .fi
  .PP
  The following is the definition of the recursive factorial function.
  .nf
  .RS
! \fI
  define f (x) {
    if (x <= 1) return (1);
    return (f(x-1) * x);
  }
  \fR
*************** debugging the parser and preparing the m
*** 637,647 ****
  .PP
  A major source of differences is
  extensions, where a feature is extended to add more functionality and
  additions, where new features are added. 
  The following is the list of differences and extensions.
! .IP LANG environment
  This version does not conform to the POSIX standard in the processing
  of the LANG environment variable and all environment variables starting
  with LC_.
  .IP names
  Traditional and POSIX
--- 637,647 ----
  .PP
  A major source of differences is
  extensions, where a feature is extended to add more functionality and
  additions, where new features are added. 
  The following is the list of differences and extensions.
! .IP environment
  This version does not conform to the POSIX standard in the processing
  of the LANG environment variable and all environment variables starting
  with LC_.
  .IP names
  Traditional and POSIX
diff -acprNC5 bc-1.06.orig/doc/bc.texi bc-1.06.djgpp/doc/bc.texi
*** bc-1.06.orig/doc/bc.texi	Thu Sep 28 00:22:24 2000
--- bc-1.06.djgpp/doc/bc.texi	Sun Dec 24 15:52:08 2000
*************** Computer Science Department, 9062@*
*** 56,65 ****
--- 56,72 ----
  Western Washington University@*
  Bellingham, WA 98226-9062
  
  @end titlepage
  
+ @ifinfo
+ @dircategory Utilities
+ @direntry
+ * bc: (bc).                   An arbitrary precision calculator language.
+ @end direntry
+ @end ifinfo
+ 
  @node Top, Introduction, (dir), (dir)
  
  @menu
  * Introduction::
  * Basic Elements::
*************** Bellingham, WA 98226-9062
*** 81,91 ****
  @end menu
  
  @node Description, Command Line Options, Introduction, Introduction
  @section Description
  
! @command{bc} [ -hlwsqv ] [long-options] [ @var{ file ...} ]
  
  @command{bc} is a language that supports arbitrary precision numbers
  with interactive execution of statements.  There are some similarities
  in the syntax to the C programming language. 
  A standard math library is available by command line option.
--- 88,98 ----
  @end menu
  
  @node Description, Command Line Options, Introduction, Introduction
  @section Description
  
! bc [ -hlwsqv ] [long-options] [ @var{file ...} ]
  
  @command{bc} is a language that supports arbitrary precision numbers
  with interactive execution of statements.  There are some similarities
  in the syntax to the C programming language. 
  A standard math library is available by command line option.
*************** begin with a letter followed by any numb
*** 168,183 ****
  underscores.  All letters must be lower case.  (Full alphanumeric
  names are an extension. In POSIX @command{bc} all names are a single
  lower case letter.)  The type of variable is clear by the context
  because all array variable names will be followed by brackets ( [ ] ).
  
! There are four special variables, @var{scale}, @var{ibase}, @var{obase}, and
! @var{last}.  @var{scale} defines how some operations use digits after the
! decimal point.  The default value of @var{scale} is 0. @var{ibase}
! and @var{obase} define the conversion base for input and output
  numbers.  The default for both input and output is base 10.
! @var{last} (an extension) is a variable that has the value of the last
  printed number.  These will be discussed in further detail where
  appropriate.  All of these variables may have values assigned to them
  as well as used in expressions.
  
  @node Comments, , Variables, Basic Elements
--- 175,190 ----
  underscores.  All letters must be lower case.  (Full alphanumeric
  names are an extension. In POSIX @command{bc} all names are a single
  lower case letter.)  The type of variable is clear by the context
  because all array variable names will be followed by brackets ( [ ] ).
  
! There are four special variables, @code{scale}, @code{ibase}, @code{obase}, and
! @code{last}.  @code{scale} defines how some operations use digits after the
! decimal point.  The default value of @code{scale} is 0. @code{ibase}
! and @code{obase} define the conversion base for input and output
  numbers.  The default for both input and output is base 10.
! @code{last} (an extension) is a variable that has the value of the last
  printed number.  These will be discussed in further detail where
  appropriate.  All of these variables may have values assigned to them
  as well as used in expressions.
  
  @node Comments, , Variables, Basic Elements
*************** are executed as soon as possible.  There
*** 216,242 ****
  code is executed as it is encountered.  (Functions, discussed in
  detail later, are defined when encountered.)
  
  A simple expression is just a constant. @command{bc} converts constants
  into internal decimal numbers using the current input base, specified by
! the variable @var{ibase}. (There is an exception in functions.)  The
! legal values of @var{ibase} are 2 through 16.  Assigning a value outside
! this range to @var{ibase} will result in a value of 2 or 16.  Input
  numbers may contain the characters 0-9 and A-F. (Note: They must be
  capitals.  Lower case letters are variable names.)  Single digit numbers
  always have the value of the digit regardless of the value of
! @var{ibase}. (i.e. A = 10.)  For multi-digit numbers, @command{bc}
! changes all input digits greater or equal to @var{ibase} to the value of
! @var{ibase}-1.  This makes the number @code{FFF} always be the largest
  3 digit number of the input base.
  
  Full expressions are similar to many other high level languages.
  Since there is only one kind of number, there are no rules for mixing
  types.  Instead, there are rules on the scale of expressions.  Every
  expression has a scale.  This is derived from the scale of original
  numbers, the operation performed and in many cases, the value of the
! variable @var{scale}. Legal values of the variable @var{scale} are
  0 to the maximum number representable by a C integer.
  
  @node Basic Expressions, Relational Expressions, About Expressions and Special Variables, Expressions
  @section Basic Expressions
  
--- 223,249 ----
  code is executed as it is encountered.  (Functions, discussed in
  detail later, are defined when encountered.)
  
  A simple expression is just a constant. @command{bc} converts constants
  into internal decimal numbers using the current input base, specified by
! the variable @code{ibase}. (There is an exception in functions.)  The
! legal values of @code{ibase} are 2 through 16.  Assigning a value outside
! this range to @code{ibase} will result in a value of 2 or 16.  Input
  numbers may contain the characters 0-9 and A-F. (Note: They must be
  capitals.  Lower case letters are variable names.)  Single digit numbers
  always have the value of the digit regardless of the value of
! @code{ibase}. (i.e. A = 10.)  For multi-digit numbers, @command{bc}
! changes all input digits greater or equal to @code{ibase} to the value of
! @code{ibase}-1.  This makes the number @code{FFF} always be the largest
  3 digit number of the input base.
  
  Full expressions are similar to many other high level languages.
  Since there is only one kind of number, there are no rules for mixing
  types.  Instead, there are rules on the scale of expressions.  Every
  expression has a scale.  This is derived from the scale of original
  numbers, the operation performed and in many cases, the value of the
! variable @code{scale}. Legal values of the variable @code{scale} are
  0 to the maximum number representable by a C integer.
  
  @node Basic Expressions, Relational Expressions, About Expressions and Special Variables, Expressions
  @section Basic Expressions
  
*************** character.  The sequence "\<nl>", where 
*** 455,494 ****
  @command{bc} as whitespace instead of a newline.  A statement list is a
  series of statements separated by semicolons and newlines.  The
  following is a list of @command{bc} statements and what they do: (Things
  enclosed in brackets ( [ ] ) are optional parts of the statement.)
  
! @table @var
  @item expression
  This statement does one of two things.  If the expression starts with
  "<variable> <assignment> ...", it is considered to be an assignment
  statement.  If the expression is not an assignment statement, the
  expression is evaluated and printed to the output.  After the number is
  printed, a newline is printed.  For example, "a=1" is an assignment
  statement and "(a=1)" is an expression that has an embedded assignment.
  All numbers that are printed are printed in the base specified by the
! variable @var{obase}. The legal values for @var{obase} are 2 through
  BC_BASE_MAX (@pxref{Environment Variables}).  For bases 2 through 16,
  the usual method of writing numbers is used.  For bases greater than 16,
  @command{bc} uses a multi-character digit method of printing the numbers
  where each higher base digit is printed as a base 10 number.  The
  multi-character digits are separated by spaces.  Each digit contains the
  number of characters required to represent the base ten value of
! "@var{obase} -1".  Since numbers are of arbitrary precision, some
  numbers may not be printable on a single output line.  These long
  numbers will be split across lines using the "\" as the last character
  on a line.  The maximum number of characters printed per line is 70.
  Due to the interactive nature of @command{bc}, printing a number causes
  the side effect of assigning the printed value to the special variable
! @var{last}. This allows the user to recover the last value printed
  without having to retype the expression that printed the number.
! Assigning to @var{last} is legal and will overwrite the last printed
  value with the assigned value.  The newly assigned value will remain
  until the next number is printed or another value is assigned to
! @var{last}.  (Some installations may allow the use of a single period
  (.) which is not part of a number as a short hand notation for for
! @var{last}.)
  
  @item string
  The string is printed to the output.  Strings start with a double quote
  character and contain all characters until the next double quote character.
  All characters are taken literally, including any newline.  No newline
--- 462,501 ----
  @command{bc} as whitespace instead of a newline.  A statement list is a
  series of statements separated by semicolons and newlines.  The
  following is a list of @command{bc} statements and what they do: (Things
  enclosed in brackets ( [ ] ) are optional parts of the statement.)
  
! @table @code
  @item expression
  This statement does one of two things.  If the expression starts with
  "<variable> <assignment> ...", it is considered to be an assignment
  statement.  If the expression is not an assignment statement, the
  expression is evaluated and printed to the output.  After the number is
  printed, a newline is printed.  For example, "a=1" is an assignment
  statement and "(a=1)" is an expression that has an embedded assignment.
  All numbers that are printed are printed in the base specified by the
! variable @code{obase}. The legal values for @code{obase} are 2 through
  BC_BASE_MAX (@pxref{Environment Variables}).  For bases 2 through 16,
  the usual method of writing numbers is used.  For bases greater than 16,
  @command{bc} uses a multi-character digit method of printing the numbers
  where each higher base digit is printed as a base 10 number.  The
  multi-character digits are separated by spaces.  Each digit contains the
  number of characters required to represent the base ten value of
! "@code{obase} -1".  Since numbers are of arbitrary precision, some
  numbers may not be printable on a single output line.  These long
  numbers will be split across lines using the "\" as the last character
  on a line.  The maximum number of characters printed per line is 70.
  Due to the interactive nature of @command{bc}, printing a number causes
  the side effect of assigning the printed value to the special variable
! @code{last}. This allows the user to recover the last value printed
  without having to retype the expression that printed the number.
! Assigning to @code{last} is legal and will overwrite the last printed
  value with the assigned value.  The newly assigned value will remain
  until the next number is printed or another value is assigned to
! @code{last}.  (Some installations may allow the use of a single period
  (.) which is not part of a number as a short hand notation for for
! @code{last}.)
  
  @item string
  The string is printed to the output.  Strings start with a double quote
  character and contain all characters until the next double quote character.
  All characters are taken literally, including any newline.  No newline
*************** the value 0 to the calling expression.  
*** 649,664 ****
  "@code{return} ( @var{expression} )", computes the value of the expression
  and returns that value to the calling expression.  There is an implied
  "@code{return} (0)" at the end of every function.  This allows a function
  to terminate and return 0 without an explicit @code{return} statement.
  
! Functions also change the usage of the variable @var{ibase}.  All
  constants in the function body will be converted using the value of
! @var{ibase} at the time of the function call.  Changes of @var{ibase}
  will be ignored during the execution of the function except for the
  standard function @code{read}, which will always use the current value
! of @var{ibase} for conversion of numbers.
  
  As an extension, the format of the definition has been slightly relaxed.
  The standard requires the opening brace be on the same line as the 
  @code{define} keyword and all other parts must be on following lines.
  This version of @command{bc} will allow any number of newlines before and
--- 656,671 ----
  "@code{return} ( @var{expression} )", computes the value of the expression
  and returns that value to the calling expression.  There is an implied
  "@code{return} (0)" at the end of every function.  This allows a function
  to terminate and return 0 without an explicit @code{return} statement.
  
! Functions also change the usage of the variable @code{ibase}.  All
  constants in the function body will be converted using the value of
! @code{ibase} at the time of the function call.  Changes of @code{ibase}
  will be ignored during the execution of the function except for the
  standard function @code{read}, which will always use the current value
! of @code{ibase} for conversion of numbers.
  
  As an extension, the format of the definition has been slightly relaxed.
  The standard requires the opening brace be on the same line as the 
  @code{define} keyword and all other parts must be on following lines.
  This version of @command{bc} will allow any number of newlines before and
*************** definitions are legal.
*** 674,712 ****
  
  @node Math Library Functions, , Functions, Functions
  @section Math Library Functions
  
  If @command{bc} is invoked with the @code{-l} option, a math library is
! preloaded and the default @var{scale} is set to 20.  The math functions will
  calculate their results to the scale set at the time of their call.  The
  math library defines the following functions:
  
  @table @code
! @item s (@var{x})
! The sine of @var{x}, @var{x} is in radians.
  
! @item c (@var{x})
! The cosine of @var{x}, @var{x} is in radians.
  
! @item a (@var{x})
! The arctangent of @var{x}, arctangent returns radians.
  
! @item l (@var{x})
! The natural logarithm of @var{x}.
  
! @item @var{e} (@var{x})
! The exponential function of raising @var{e} to the value @var{x}.
  
! @item @var{j} (@var{n,x})
! The bessel function of integer order @var{n} of @var{x}.
  @end table
  
  @node Examples, Readline and Libedit Options, Functions, Top
  @chapter Examples
  
  In /bin/sh,  the following will assign the value of "pi" to the shell
! variable @var{pi}.
  @example
  
  pi=$(echo "scale=10; 4*a(1)" | bc -l)
  
  @end example
--- 681,719 ----
  
  @node Math Library Functions, , Functions, Functions
  @section Math Library Functions
  
  If @command{bc} is invoked with the @code{-l} option, a math library is
! preloaded and the default @code{scale} is set to 20.  The math functions will
  calculate their results to the scale set at the time of their call.  The
  math library defines the following functions:
  
  @table @code
! @item s (x)
! The sine of @code{x}, @code{x} is in radians.
  
! @item c (x)
! The cosine of @code{x}, @code{x} is in radians.
  
! @item a (x)
! The arctangent of @code{x}, arctangent returns radians.
  
! @item l (x)
! The natural logarithm of @code{x}.
  
! @item e (x)
! The exponential function of raising @code{e} to the value @code{x}.
  
! @item j  (n,x)
! The bessel function of integer order @code{n} of @code{x}.
  @end table
  
  @node Examples, Readline and Libedit Options, Functions, Top
  @chapter Examples
  
  In /bin/sh,  the following will assign the value of "pi" to the shell
! variable @code{pi}.
  @example
  
  pi=$(echo "scale=10; 4*a(1)" | bc -l)
  
  @end example
*************** for debugging the parser and preparing t
*** 829,841 ****
  
  A major source of differences is extensions, where a feature is extended
  to add more functionality and additions, where new features are added.
  The following is the list of differences and extensions.
  
! @table @var
  
! @item LANG environment
  This version does not conform to the POSIX standard in the processing
  of the LANG environment variable and all environment variables starting
  with LC_.
  
  @item names
--- 836,848 ----
  
  A major source of differences is extensions, where a feature is extended
  to add more functionality and additions, where new features are added.
  The following is the list of differences and extensions.
  
! @table @code
  
! @item environment
  This version does not conform to the POSIX standard in the processing
  of the LANG environment variable and all environment variables starting
  with LC_.
  
  @item names
diff -acprNC5 bc-1.06.orig/doc/dc.texi bc-1.06.djgpp/doc/dc.texi
*** bc-1.06.orig/doc/dc.texi	Thu Aug 31 15:57:42 2000
--- bc-1.06.djgpp/doc/dc.texi	Sun Dec 24 15:32:24 2000
***************
*** 19,28 ****
--- 19,29 ----
  @syncodeindex ky fn
  @syncodeindex pg fn
  @syncodeindex tp fn
  
  @ifinfo
+ @dircategory Utilities
  @direntry
  * dc: (dc).                   Arbritrary precision RPN ``Desktop Calculator''.
  @end direntry
  This file documents @sc{dc}, an arbitrary precision calculator.
  
diff -acprNC5 bc-1.06.orig/lib/getopt.c bc-1.06.djgpp/lib/getopt.c
*** bc-1.06.orig/lib/getopt.c	Fri Jul  7 23:34:08 2000
--- bc-1.06.djgpp/lib/getopt.c	Sun Dec 24 15:32:24 2000
*************** static char *posixly_correct;
*** 166,175 ****
--- 166,179 ----
     in GCC.  */
  #include <string.h>
  #define	my_index	strchr
  #else
  
+ #ifdef __DJGPP__
+ #include <string.h> /* For strncmp() definiton. */
+ #endif
+ 
  /* Avoid depending on library functions or files
     whose names are inconsistent.  */
  
  char *getenv ();
  
*************** _getopt_internal (argc, argv, optstring,
*** 474,484 ****
        char *nameend;
        const struct option *p;
        const struct option *pfound = NULL;
        int exact = 0;
        int ambig = 0;
!       int indfound;
        int option_index;
  
        for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
  	/* Do nothing.  */ ;
  
--- 478,488 ----
        char *nameend;
        const struct option *p;
        const struct option *pfound = NULL;
        int exact = 0;
        int ambig = 0;
!       int indfound = 0;  /* Pacify gcc 2.95.2. */
        int option_index;
  
        for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
  	/* Do nothing.  */ ;
  
