Release calc version 2.11.5t2.1

This commit is contained in:
Landon Curt Noll
2001-04-10 16:00:53 -07:00
parent bea726fc16
commit 59837e385c
17 changed files with 342 additions and 196 deletions

31
CHANGES
View File

@@ -5,6 +5,33 @@ The following are the changes from calc version 2.11.5t2 to date:
interactive mode. Fixed a bug that sometimes left the terminal interactive mode. Fixed a bug that sometimes left the terminal
in a non-echoing state when calc exited. in a non-echoing state when calc exited.
Renamed error codes E_FGETWORD1 and E_FGETWORD2 symbols to
E_FGETFIELD1 and E_FGETFIELD2.
Made a minor format change to the top of the calc man page.
The findid() function in file.c 2nd argument changed. The argument
is now mostly a writable flag. This function now finds the file
I/O structure for the specified file id, and verifies that
it is opened in the required manner (0 for reading or 1 for writing).
If the 2nd argument is -1, then no open checks are made at all and
NULL is then returned if the id represents a closed file.
The calc builtin function, fopen(), now allows one to specify
opening files in binary modes. On POSIX / Linux / Un*x-like systems,
text file is the same as a binary file and so 'b' to an fopen has
no effect and is ignored. However on systems such as MS Windoz
the 'b' / binary mode has meaning. See 'help fopen' for details.
On systems (such as MS Windoz), calc will produce a different error
message when it attempts to open /dev/tty. This will condition
will occur in things like calc scripts when they switch from ``batch
processing'' commands from and want to start interactive mode.
Regression tests fopen in binary mode in a few places where a
difference between text and binary string lengths matter.
The intfile calc resource file also uses binary mode.
The following are the changes from calc version 2.11.5t0 to date: The following are the changes from calc version 2.11.5t0 to date:
@@ -5172,8 +5199,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.27 $ ## @(#) $Revision: 29.28 $
## @(#) $Id: CHANGES,v 29.27 2001/04/08 22:05:40 chongo Exp $ ## @(#) $Id: CHANGES,v 29.28 2001/04/10 22:13:40 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## ##
## Under source code control: 1993/06/02 18:12:57 ## Under source code control: 1993/06/02 18:12:57

View File

@@ -20,8 +20,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
MAKEFILE_REV= $$Revision: 29.19 $$ MAKEFILE_REV= $$Revision: 29.21 $$
# @(#) $Id: Makefile.ship,v 29.19 2001/04/08 10:54:22 chongo Exp $ # @(#) $Id: Makefile.ship,v 29.21 2001/04/10 22:52:05 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
# #
# Under source code control: 1990/02/15 01:48:41 # Under source code control: 1990/02/15 01:48:41
@@ -1080,7 +1080,7 @@ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
# and BUILD_C_SRC # and BUILD_C_SRC
# #
UTIL_MISC_SRC= calcerr_h.sed calcerr_h.awk calcerr_c.sed calcerr_c.awk \ UTIL_MISC_SRC= calcerr_h.sed calcerr_h.awk calcerr_c.sed calcerr_c.awk \
calcerr.tbl check.awk calcerr.tbl check.awk win32.mkdef
# these .o files may get built in the process of building BUILD_H_SRC # these .o files may get built in the process of building BUILD_H_SRC
# #
@@ -2564,7 +2564,7 @@ win32_hsrc: ${MAKE_FILE} win32.mkdef
${Q}rm -rf win32 ${Q}rm -rf win32
${Q}mkdir win32 ${Q}mkdir win32
${Q}cp ${UTIL_C_SRC} win32 ${Q}cp ${UTIL_C_SRC} win32
${Q}cp ${UTIL_MISC_SRC} win32.mkdef Makefile win32 ${Q}cp ${UTIL_MISC_SRC} Makefile win32
${Q}(cd win32; \ ${Q}(cd win32; \
echo "cd win32"; \ echo "cd win32"; \
echo "$(MAKE) hsrc `cat win32.mkdef`"; \ echo "$(MAKE) hsrc `cat win32.mkdef`"; \

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.3 $
* @(#) $Id: blkcpy.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: blkcpy.c,v 29.3 2001/04/10 22:06:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $
* *
* Under source code control: 1997/04/18 20:41:26 * Under source code control: 1997/04/18 20:41:26
@@ -581,7 +581,7 @@ copyblk2file(BLOCK *sblk, long ssi, long num, FILEID id, long dsi)
if (num == 0) if (num == 0)
return 0; return 0;
fiop = findid(id, 'w'); fiop = findid(id, TRUE);
if (fiop == NULL) if (fiop == NULL)
return E_COPYF1; return E_COPYF1;
fp = fiop->fp; fp = fiop->fp;
@@ -618,7 +618,7 @@ copyfile2blk(FILEID id, long ssi, long num, BLOCK *dblk, long dsi, BOOL noreloc)
if (id < 3) /* excludes copying from stdin */ if (id < 3) /* excludes copying from stdin */
return E_COPYF1; return E_COPYF1;
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return E_COPYF1; return E_COPYF1;
@@ -690,7 +690,7 @@ copystr2file(STRING *str, long ssi, long num, FILEID id, long dsi)
return 0; return 0;
if ((USB32) ssi + num > len) if ((USB32) ssi + num > len)
return E_COPY5; /* Insufficient memory in str */ return E_COPY5; /* Insufficient memory in str */
fiop = findid(id, 'w'); fiop = findid(id, TRUE);
if (fiop == NULL) if (fiop == NULL)
return E_COPYF1; return E_COPYF1;
fp = fiop->fp; fp = fiop->fp;

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 29.5 $
* @(#) $Id: intfile.cal,v 29.4 2001/04/08 08:13:10 chongo Exp $ * @(#) $Id: intfile.cal,v 29.5 2001/04/10 22:09:34 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/intfile.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/intfile.cal,v $
* *
* Under source code control: 2001/03/31 08:13:11 * Under source code control: 2001/03/31 08:13:11
@@ -56,7 +56,7 @@ define file2be(filename)
/* /*
* open the file for reading * open the file for reading
*/ */
fd = fopen(filename, "r"); fd = fopen(filename, "rb");
if (!isfile(fd)) quit "file2be: cannot open file for reading"; if (!isfile(fd)) quit "file2be: cannot open file for reading";
/* /*
@@ -98,7 +98,7 @@ define file2le(filename)
/* /*
* open the file for reading * open the file for reading
*/ */
fd = fopen(filename, "r"); fd = fopen(filename, "rb");
if (!isfile(fd)) quit "file2le: cannot open file for reading"; if (!isfile(fd)) quit "file2le: cannot open file for reading";
/* /*
@@ -150,7 +150,7 @@ define be2file(v, filename)
/* /*
* open the file for writing * open the file for writing
*/ */
fd = fopen(filename, "w"); fd = fopen(filename, "wb");
if (!isfile(fd)) quit "be2file: cannot open file for writing"; if (!isfile(fd)) quit "be2file: cannot open file for writing";
/* /*
@@ -199,7 +199,7 @@ define le2file(v, filename)
/* /*
* open the file for writing * open the file for writing
*/ */
fd = fopen(filename, "w"); fd = fopen(filename, "wb");
if (!isfile(fd)) quit "le2file: cannot open file for writing"; if (!isfile(fd)) quit "le2file: cannot open file for writing";
/* /*

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.7 $ * @(#) $Revision: 29.8 $
* @(#) $Id: regress.cal,v 29.7 2001/04/08 10:09:39 chongo Exp $ * @(#) $Id: regress.cal,v 29.8 2001/04/10 22:08:20 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
* *
* Under source code control: 1990/02/15 01:50:36 * Under source code control: 1990/02/15 01:50:36
@@ -5118,15 +5118,15 @@ define test_is()
a = assoc(); a = assoc();
print '5901: a = assoc()'; print '5901: a = assoc()';
if (config("windows")) { if (config("windows")) {
ofd = fopen("NUL:", "r"); ofd = fopen("NUL:", "rb");
print '5902: ofd = fopen("NUL:", "r")'; print '5902: ofd = fopen("NUL:", "rb")';
cfd = fopen("NUL:", "r"); cfd = fopen("NUL:", "rb");
print '5903: cfd = fopen("NUL:", "r")'; print '5903: cfd = fopen("NUL:", "rb")';
} else { } else {
ofd = fopen("/dev/null", "r"); ofd = fopen("/dev/null","rb");
print '5902: ofd = fopen("/dev/null", "r")'; print '5902: ofd = fopen("/dev/null","rb")';
cfd = fopen("/dev/null", "r"); cfd = fopen("/dev/null","rb");
print '5903: cfd = fopen("/dev/null", "r")'; print '5903: cfd = fopen("/dev/null","rb")';
} }
fclose(cfd); fclose(cfd);
print '5904: fclose(cfd)'; print '5904: fclose(cfd)';
@@ -6305,8 +6305,8 @@ define test_blkcpy()
/* blkcpy the last 5 octets of B1 to a new block C */ /* blkcpy the last 5 octets of B1 to a new block C */
blkcpy(C = blk(), B1, 5, ,100); blkcpy(C = blk(), B1,5,,100);
print '6821: blkcpy(C = blk(), B1, 5, ,100);'; print '6821: blkcpy(C = blk(), B1,5,,100);';
vrfy(C == A, '6822: C == A'); vrfy(C == A, '6822: C == A');
/* blkcpy to and from a file */ /* blkcpy to and from a file */
@@ -6322,8 +6322,8 @@ define test_blkcpy()
blkcpy(fs, A, ,100); blkcpy(fs, A, ,100);
print '6828: blkcpy(fs, A, ,100);'; print '6828: blkcpy(fs, A, ,100);';
vrfy(size(fs) == 105, '6829: size(f) == 105'); vrfy(size(fs) == 105, '6829: size(f) == 105');
blkcpy(C = blk(), fs, 2, ,100); blkcpy(C = blk(), fs,2,,100);
print '6830: blkcpy(C = blk(), fs, 2, ,100)'; print '6830: blkcpy(C = blk(), fs,2,,100)';
vrfy(C == (blk() = {1,2}), '6831: C == (blk() = {1,2}'); vrfy(C == (blk() = {1,2}), '6831: C == (blk() = {1,2}');
/* blkcpy string to a block */ /* blkcpy string to a block */

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 29.4 $
* @(#) $Id: test4600.cal,v 29.3 2001/04/08 10:09:39 chongo Exp $ * @(#) $Id: test4600.cal,v 29.4 2001/04/10 22:09:02 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4600.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4600.cal,v $
* *
* Under source code control: 1996/07/02 20:04:40 * Under source code control: 1996/07/02 20:04:40
@@ -53,10 +53,10 @@ define stest(str, verbose)
/* /*
* do file operations * do file operations
*/ */
f = fopen("junk4600", "w"); f = fopen("junk4600", "wb");
if (iserror(f)) { if (iserror(f)) {
print 'failed'; print 'failed';
print '**** fopen("junk4600", "w") failed'; print '**** fopen("junk4600", "wb") failed';
return 1; return 1;
} }
if (iserror(fputs(f, if (iserror(fputs(f,
@@ -67,9 +67,9 @@ define stest(str, verbose)
print '**** fputs(f, "Fourscore ... failed'; print '**** fputs(f, "Fourscore ... failed';
return 1; return 1;
} }
if (iserror(freopen(f, "r"))) { if (iserror(freopen(f, "rb"))) {
print 'failed'; print 'failed';
print '**** iserror(freopen(f, "r")) failed'; print '**** iserror(freopen(f, "rb")) failed';
return 1; return 1;
} }
if (iserror(rewind(f))) { if (iserror(rewind(f))) {
@@ -87,68 +87,35 @@ define stest(str, verbose)
print '**** ftell(f) != 13 failed'; print '**** ftell(f) != 13 failed';
return 1; return 1;
} }
if (config("windows")) { if (search(f, "and") != 109) {
if (search(f, "and") != 110) { print 'failed';
print 'failed'; print '**** search(f, "and") != 109 failed';
print '**** search(f, "and") != 110 failed'; return 1;
return 1; }
} if (ftell(f) != 112) {
if (ftell(f) != 113) { print 'failed';
print 'failed'; print '**** ftell(f) != 112 failed';
print '**** ftell(f) != 113 failed'; return 1;
return 1; }
} if (!isnull(search(f, "and"))) {
if (!isnull(search(f, "and"))) { print 'failed';
print 'failed'; print '**** !isnull(search(f, "and")) failed';
print '**** !isnull(search(f, "and")) failed'; return 1;
return 1; }
} if (ftell(f) != 172) {
if (ftell(f) != 174) { print 'failed';
print 'failed'; print '**** ftell(f) != 172 failed';
print '**** ftell(f) != 174 failed'; return 1;
return 1; }
} if (rsearch(f, "and") != 109) {
if (rsearch(f, "and") != 110) { print 'failed';
print 'failed'; print '**** rsearch(f, "and") != 109 failed';
print '**** rsearch(f, "and") != 110 failed'; return 1;
return 1; }
} if (ftell(f) != 111) {
if (ftell(f) != 112) { print 'failed';
print 'failed'; print '**** ftell(f) != 111 failed';
print '**** ftell(f) != 112 failed'; return 1;
return 1;
}
} else {
if (search(f, "and") != 109) {
print 'failed';
print '**** search(f, "and") != 109 failed';
return 1;
}
if (ftell(f) != 112) {
print 'failed';
print '**** ftell(f) != 112 failed';
return 1;
}
if (!isnull(search(f, "and"))) {
print 'failed';
print '**** !isnull(search(f, "and")) failed';
return 1;
}
if (ftell(f) != 172) {
print 'failed';
print '**** ftell(f) != 172 failed';
return 1;
}
if (rsearch(f, "and") != 109) {
print 'failed';
print '**** rsearch(f, "and") != 109 failed';
return 1;
}
if (ftell(f) != 111) {
print 'failed';
print '**** ftell(f) != 111 failed';
return 1;
}
} }
if (iserror(fseek(f, -4, 1))) { if (iserror(fseek(f, -4, 1))) {
print 'failed'; print 'failed';
@@ -206,7 +173,7 @@ define ttest(str, m, n, verbose)
print str:":",:; print str:":",:;
} }
i = rm("-f", "junk4600"); i = rm("-f", "junk4600");
f = fopen("junk4600", "w"); f = fopen("junk4600", "wb");
if (isnull(n)) if (isnull(n))
n = 4; n = 4;
@@ -231,7 +198,7 @@ define ttest(str, m, n, verbose)
fflush(f); fflush(f);
if (verbose > 1) if (verbose > 1)
printf("File has size %d\n", pos[i]); printf("File has size %d\n", pos[i]);
freopen(f, "r"); freopen(f, "rb");
if (size(f) != pos[i]) { if (size(f) != pos[i]) {
print 'failed'; print 'failed';
printf("**** Failure 1 for file size\n"); printf("**** Failure 1 for file size\n");

22
calc.c
View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.7 $ * @(#) $Revision: 29.8 $
* @(#) $Id: calc.c,v 29.7 2001/03/17 21:31:47 chongo Exp $ * @(#) $Id: calc.c,v 29.8 2001/04/10 22:03:13 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
* *
* Under source code control: 1990/02/15 01:48:11 * Under source code control: 1990/02/15 01:48:11
@@ -625,9 +625,18 @@ main(int argc, char **argv)
if (!p_flag && i_flag && !stdin_tty) { if (!p_flag && i_flag && !stdin_tty) {
closeinput(); closeinput();
if(!freopen("/dev/tty", "r", stdin)) { if(!freopen("/dev/tty", "r", stdin)) {
#if defined (_WIN32)
fprintf(stderr,
"/dev/tty does not exist on "
"this operating system. "
"Change operating systems\n"
"or don't use this calc mode "
"in the future, sorry!\n");
#else /* Windoz free systems */
fprintf(stderr, fprintf(stderr,
"Unable to associate stdin" "Unable to associate stdin"
" with /dev/tty"); " with /dev/tty");
#endif /* Windoz free systems */
set_run_state(RUN_EXIT_WITH_ERROR); set_run_state(RUN_EXIT_WITH_ERROR);
break; break;
} }
@@ -646,9 +655,18 @@ main(int argc, char **argv)
!p_flag && (!havecommands||i_flag)) { !p_flag && (!havecommands||i_flag)) {
closeinput(); closeinput();
if(!freopen("/dev/tty", "r", stdin)) { if(!freopen("/dev/tty", "r", stdin)) {
#if defined (_WIN32)
fprintf(stderr,
"/dev/tty does not exist on "
"this operating system. "
"Change operating systems\n"
"or don't use this calc mode "
"in the future, sorry!\n");
#else /* Windoz free systems */
fprintf(stderr, fprintf(stderr,
"Unable to associate stdin" "Unable to associate stdin"
" with /dev/tty"); " with /dev/tty");
#endif /* Windoz free systems */
set_run_state(RUN_EXIT_WITH_ERROR); set_run_state(RUN_EXIT_WITH_ERROR);
break; break;
} }

View File

@@ -15,8 +15,8 @@
.\" received a copy with calc; if not, write to Free Software Foundation, Inc. .\" received a copy with calc; if not, write to Free Software Foundation, Inc.
.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
.\" .\"
.\" @(#) $Revision: 29.5 $ .\" @(#) $Revision: 29.6 $
.\" @(#) $Id: calc.man,v 29.5 2000/06/07 14:02:13 chongo Exp $ .\" @(#) $Id: calc.man,v 29.6 2001/04/10 21:48:46 chongo Exp $
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $ .\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
.\" .\"
.\" Under source code control: 1991/07/23 05:48:26 .\" Under source code control: 1991/07/23 05:48:26
@@ -36,20 +36,21 @@ calc \- arbitrary precision calculator
.RB [ \-c ] .RB [ \-c ]
.RB [ \-C ] .RB [ \-C ]
.RB [ \-d ] .RB [ \-d ]
.RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ]
.br .br
.in +5n .in +5n
.RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ]
.br
.RB [ \-e ] .RB [ \-e ]
.RB [ \-h ] .RB [ \-h ]
.RB [ \-i ] .RB [ \-i ]
.RB [ \-m\ \&mode ] .RB [ \-m\ \&mode ]
.RB [ \-n ] .RB [ \-n ]
.br
.RB [ \-p ] .RB [ \-p ]
.RB [ \-q ] .RB [ \-q ]
.RB [ \-s ] .RB [ \-s ]
.RB [ \-u ] .RB [ \-u ]
.RB [ \-v ] .RB [ \-v ]
.br
.RB [ calc_cmd\ \&.\|.\|. ] .RB [ calc_cmd\ \&.\|.\|. ]
.in -5n .in -5n
.sp .sp

View File

@@ -17,8 +17,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.3 $ # @(#) $Revision: 29.4 $
# @(#) $Id: calcerr.tbl,v 29.3 2000/07/17 15:35:49 chongo Exp $ # @(#) $Id: calcerr.tbl,v 29.4 2001/04/10 22:06:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
# #
# Under source code control: 1996/05/23 17:38:44 # Under source code control: 1996/05/23 17:38:44
@@ -108,8 +108,8 @@ E_FGETSTR1 Non-file first argument for fgetstr
E_FGETSTR2 File not open for reading for fgetstr E_FGETSTR2 File not open for reading for fgetstr
E_FGETLINE1 Non-file argument for fgetline E_FGETLINE1 Non-file argument for fgetline
E_FGETLINE2 File not open for reading for fgetline E_FGETLINE2 File not open for reading for fgetline
E_FGETWORD1 Non-file argument for fgetword E_FGETFIELD1 Non-file argument for fgetfield
E_FGETWORD2 File not open for reading for fgetword E_FGETFIELD2 File not open for reading for fgetfield
E_REWIND1 Non-file argument for rewind E_REWIND1 Non-file argument for rewind
E_FILES Non-integer argument for files E_FILES Non-integer argument for files
E_PRINTF1 Non-string fmt argument for fprint E_PRINTF1 Non-string fmt argument for fprint

142
file.c
View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.6 $ * @(#) $Revision: 29.7 $
* @(#) $Id: file.c,v 29.6 2001/03/17 21:31:47 chongo Exp $ * @(#) $Id: file.c,v 29.7 2001/04/10 22:06:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
* *
* Under source code control: 1991/07/20 00:21:56 * Under source code control: 1991/07/20 00:21:56
@@ -158,7 +158,7 @@ file_init(void)
} else { } else {
fp = (FILE *) fdopen(i, "w"); fp = (FILE *) fdopen(i, "w");
if (fp) { if (fp) {
strcpy(files[idnum].mode, "w?"); strcpy(files[idnum].mode, "w");
files[idnum].reading = FALSE; files[idnum].reading = FALSE;
} }
else else
@@ -207,7 +207,7 @@ openid(char *name, char *mode)
int i; int i;
if (idnum >= MAXFILES) if (idnum >= MAXFILES)
return -77; return -E_FOPEN3;
fiop = &files[3]; fiop = &files[3];
for (i = 3; i < MAXFILES; fiop++,i++) { for (i = 3; i < MAXFILES; fiop++,i++) {
@@ -243,11 +243,32 @@ openid(char *name, char *mode)
fiop->reading = TRUE; fiop->reading = TRUE;
fiop->writing = TRUE; fiop->writing = TRUE;
fiop->action = 0; fiop->action = 0;
if (mode[1] == '\0') {
if (*mode == 'r') /*
* determine file open mode
*
* While a leading 'r' is for reading and a leading 'w' is
* for writing, the presense of a '+' in the string means
* both reading and writing. A leading 'a' means append
* which is writing.
*/
if (mode[0] == 'r') {
fiop->reading = TRUE;
if (strchr(mode, '+') == NULL) {
fiop->writing = FALSE; fiop->writing = FALSE;
else } else {
fiop->writing = TRUE;
}
} else if (mode[0] == 'w' || mode[0] == 'a') {
fiop->writing = TRUE;
if (strchr(mode, '+') == NULL) {
fiop->reading = FALSE; fiop->reading = FALSE;
} else {
fiop->reading = TRUE;
}
} else {
fiop->reading = FALSE;
fiop->writing = FALSE;
} }
strcpy(fiop->mode, mode); strcpy(fiop->mode, mode);
return id; return id;
@@ -346,11 +367,32 @@ reopenid(FILEID id, char *mode, char *name)
fiop->reading = TRUE; fiop->reading = TRUE;
fiop->writing = TRUE; fiop->writing = TRUE;
fiop->action = 0; fiop->action = 0;
if (mode[1] == '\0') {
if (*mode == 'r') /*
* determine file open mode
*
* While a leading 'r' is for reading and a leading 'w' is
* for writing, the presense of a '+' in the string means
* both reading and writing. A leading 'a' means append
* which is writing.
*/
if (mode[0] == 'r') {
fiop->reading = TRUE;
if (strchr(mode, '+') == NULL) {
fiop->writing = FALSE; fiop->writing = FALSE;
else } else {
fiop->writing = TRUE;
}
} else if (mode[0] == 'w' || mode[0] == 'a') {
fiop->writing = TRUE;
if (strchr(mode, '+') == NULL) {
fiop->reading = FALSE; fiop->reading = FALSE;
} else {
fiop->reading = TRUE;
}
} else {
fiop->reading = FALSE;
fiop->writing = FALSE;
} }
strcpy(fiop->mode, mode); strcpy(fiop->mode, mode);
return id; return id;
@@ -358,13 +400,13 @@ reopenid(FILEID id, char *mode, char *name)
/* /*
* Find the file I/O structure for the specified file id, and verify that * Find the file I/O structure for the specified file id, and verifies that
* it is opened in the required manner ('r' for reading or 'w' for writing). * it is opened in the required manner (0 for reading or 1 for writing).
* If mode is 0, then no open checks are made at all, and NULL is then * If writable is -1, then no open checks are made at all and NULL is then
* returned if the id represents a closed file. * returned if the id represents a closed file.
*/ */
FILEIO * FILEIO *
findid(FILEID id, int mode) findid(FILEID id, int writable)
{ {
FILEIO *fiop; /* file structure */ FILEIO *fiop; /* file structure */
int i; int i;
@@ -383,21 +425,11 @@ findid(FILEID id, int mode)
if (i == idnum) if (i == idnum)
return NULL; return NULL;
switch (mode) { if (writable >= 0) {
case 'r': if ((writable && !fiop->writing) ||
if (!fiop->reading) (!writable && !fiop->reading)) {
return NULL; return NULL;
break; }
case 'w':
if (!fiop->writing)
return NULL;
break;
case 0:
break;
default:
/* This should not happen */
math_error("Unknown findid mode");
/*NOTREACHED*/
} }
return fiop; return fiop;
} }
@@ -409,7 +441,7 @@ findid(FILEID id, int mode)
BOOL BOOL
validid(FILEID id) validid(FILEID id)
{ {
return (findid(id, 0) != NULL); return (findid(id, -1) != NULL);
} }
@@ -505,7 +537,7 @@ errorid(FILEID id)
{ {
FILEIO *fiop; /* file structure */ FILEIO *fiop; /* file structure */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return EOF; return EOF;
return (ferror(fiop->fp) != 0); return (ferror(fiop->fp) != 0);
@@ -520,7 +552,7 @@ eofid(FILEID id)
{ {
FILEIO *fiop; /* file structure */ FILEIO *fiop; /* file structure */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return EOF; return EOF;
return (feof(fiop->fp) != 0); return (feof(fiop->fp) != 0);
@@ -535,7 +567,7 @@ flushid(FILEID id)
{ {
FILEIO *fiop; /* file structure */ FILEIO *fiop; /* file structure */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return 0; return 0;
if (!fiop->writing || fiop->action == 'r') if (!fiop->writing || fiop->action == 'r')
@@ -598,7 +630,7 @@ readid(FILEID id, int flags, char **retptr)
totlen = 0; totlen = 0;
str = NULL; str = NULL;
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return 1; return 1;
nlstop = (flags & 1); nlstop = (flags & 1);
@@ -679,7 +711,7 @@ getcharid(FILEID id)
FILEIO *fiop; FILEIO *fiop;
FILEPOS fpos; FILEPOS fpos;
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
if (fiop->action == 'w') { if (fiop->action == 'w') {
@@ -710,7 +742,7 @@ printid(FILEID id, int flags)
/* /*
* filewall - file is closed * filewall - file is closed
*/ */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
if (flags & PRINT_UNAMBIG) if (flags & PRINT_UNAMBIG)
math_fmt("FILE %d closed", id); math_fmt("FILE %d closed", id);
@@ -787,7 +819,7 @@ idprintf(FILEID id, char *fmt, int count, VALUE **vals)
BOOL printstring; BOOL printstring;
BOOL printchar; BOOL printchar;
fiop = findid(id, 'w'); fiop = findid(id, TRUE);
if (fiop == NULL) if (fiop == NULL)
return 1; return 1;
if (fiop->action == 'r') { if (fiop->action == 'r') {
@@ -1014,7 +1046,7 @@ idfputc(FILEID id, int ch)
FILEPOS fpos; FILEPOS fpos;
/* get the file info pointer */ /* get the file info pointer */
fiop = findid(id, 'w'); fiop = findid(id, TRUE);
if (fiop == NULL) if (fiop == NULL)
return 1; return 1;
if (fiop->action == 'r') { if (fiop->action == 'r') {
@@ -1049,7 +1081,7 @@ idungetc(FILEID id, int ch)
{ {
FILEIO *fiop; FILEIO *fiop;
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
if (fiop->action != 'r') if (fiop->action != 'r')
@@ -1072,7 +1104,7 @@ idfputs(FILEID id, char *str)
FILEPOS fpos; FILEPOS fpos;
/* get the file info pointer */ /* get the file info pointer */
fiop = findid(id, 'w'); fiop = findid(id, TRUE);
if (fiop == NULL) if (fiop == NULL)
return 1; return 1;
@@ -1110,7 +1142,7 @@ idfputstr(FILEID id, char *str)
FILEPOS fpos; FILEPOS fpos;
/* get the file info pointer */ /* get the file info pointer */
fiop = findid(id, 'w'); fiop = findid(id, TRUE);
if (fiop == NULL) if (fiop == NULL)
return 1; return 1;
@@ -1140,7 +1172,7 @@ int
rewindid(FILEID id) rewindid(FILEID id)
{ {
FILEIO *fiop; FILEIO *fiop;
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return 1; return 1;
rewind(fiop->fp); rewind(fiop->fp);
@@ -1328,7 +1360,7 @@ getloc(FILEID id, ZVALUE *res)
/* /*
* convert id to stream * convert id to stream
*/ */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
/* file not open */ /* file not open */
return -1; return -1;
@@ -1353,7 +1385,7 @@ ftellid(FILEID id, ZVALUE *res)
FILEPOS fpos; /* current file position */ FILEPOS fpos; /* current file position */
/* get FILEIO */ /* get FILEIO */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
@@ -1376,7 +1408,7 @@ fseekid(FILEID id, ZVALUE offset, int whence)
int ret = 0; /* return code */ int ret = 0; /* return code */
/* setup */ /* setup */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
@@ -1501,7 +1533,7 @@ setloc(FILEID id, ZVALUE zpos)
/* /*
* convert id to stream * convert id to stream
*/ */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
/* file not open */ /* file not open */
return -1; return -1;
@@ -1669,7 +1701,7 @@ getsize(FILEID id, ZVALUE *res)
/* /*
* convert id to stream * convert id to stream
*/ */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
/* file not open */ /* file not open */
return 1; return 1;
@@ -1705,7 +1737,7 @@ get_device(FILEID id, ZVALUE *dev)
/* /*
* convert id to stream * convert id to stream
*/ */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
/* file not open */ /* file not open */
return -1; return -1;
@@ -1738,7 +1770,7 @@ get_inode(FILEID id, ZVALUE *inode)
/* /*
* convert id to stream * convert id to stream
*/ */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
/* file not open */ /* file not open */
return -1; return -1;
@@ -1774,7 +1806,7 @@ zfilesize(FILEID id)
ZVALUE ret; /* file size as a ZVALUE return value */ ZVALUE ret; /* file size as a ZVALUE return value */
/* file FILEIO */ /* file FILEIO */
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) { if (fiop == NULL) {
/* return neg value for non-file error */ /* return neg value for non-file error */
itoz(-1, &ret); itoz(-1, &ret);
@@ -2144,7 +2176,7 @@ fscanfid(FILEID id, char *fmt, int count, VALUE **vals)
FILE *fp; FILE *fp;
FILEPOS fpos; FILEPOS fpos;
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
@@ -2408,7 +2440,7 @@ isattyid(FILEID id)
{ {
FILEIO *fiop; FILEIO *fiop;
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
return isatty(fileno(fiop->fp)); return isatty(fileno(fiop->fp));
@@ -2445,7 +2477,7 @@ fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res)
long k = 0; long k = 0;
/* get FILEIO */ /* get FILEIO */
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
@@ -2564,7 +2596,7 @@ frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res)
char *s; /* str comparison pointer */ char *s; /* str comparison pointer */
/* get FILEIO */ /* get FILEIO */
fiop = findid(id, 'r'); fiop = findid(id, FALSE);
if (fiop == NULL) if (fiop == NULL)
return -2; return -2;
@@ -2641,7 +2673,7 @@ findfname(FILEID id)
{ {
FILEIO *fiop; FILEIO *fiop;
fiop = findid(id, 0); fiop = findid(id, -1);
if (fiop == NULL) if (fiop == NULL)
return NULL; return NULL;

8
file.h
View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.3 $
* @(#) $Id: file.h,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: file.h,v 29.3 2001/04/10 22:06:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/file.h,v $
* *
* Under source code control: 1996/05/24 05:55:58 * Under source code control: 1996/05/24 05:55:58
@@ -50,7 +50,7 @@ typedef struct {
BOOL reading; /* TRUE if opened for reading */ BOOL reading; /* TRUE if opened for reading */
BOOL writing; /* TRUE if opened for writing */ BOOL writing; /* TRUE if opened for writing */
char action; /* most recent use for 'r', 'w' or 0 */ char action; /* most recent use for 'r', 'w' or 0 */
char mode[3]; /* open mode */ char mode[sizeof("rb+")];/* open mode */
} FILEIO; } FILEIO;
@@ -85,7 +85,7 @@ typedef struct {
/* /*
* external functions * external functions
*/ */
extern FILEIO * findid(FILEID id, int mode); extern FILEIO * findid(FILEID id, int writable);
extern int fgetposid(FILEID id, FILEPOS *ptr); extern int fgetposid(FILEID id, FILEPOS *ptr);
extern int fsetposid(FILEID id, FILEPOS *ptr); extern int fsetposid(FILEID id, FILEPOS *ptr);
extern int get_open_siz(FILE *fp, ZVALUE *res); extern int get_open_siz(FILE *fp, ZVALUE *res);

41
func.c
View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.8 $ * @(#) $Revision: 29.9 $
* @(#) $Id: func.c,v 29.8 2001/04/08 10:06:56 chongo Exp $ * @(#) $Id: func.c,v 29.9 2001/04/10 22:06:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
* *
* Under source code control: 1990/02/15 01:48:15 * Under source code control: 1990/02/15 01:48:15
@@ -4987,24 +4987,31 @@ f_fopen(VALUE *v1, VALUE *v2)
/* initialize VALUE */ /* initialize VALUE */
result.v_subtype = V_NOSUBTYPE; result.v_subtype = V_NOSUBTYPE;
/* check for a valid mode [rwa][b+\0][b+\0] */
if (v1->v_type != V_STR || v2->v_type != V_STR) if (v1->v_type != V_STR || v2->v_type != V_STR)
return error_value(E_FOPEN1); return error_value(E_FOPEN1);
mode = v2->v_str->s_str; mode = v2->v_str->s_str;
if ((*mode != 'r') && (*mode != 'w') && (*mode != 'a')) if ((*mode != 'r') && (*mode != 'w') && (*mode != 'a'))
return error_value(E_FOPEN2); return error_value(E_FOPEN2);
if (mode[1] != '\0') { if (mode[1] != '\0') {
if (mode[1] != '+') if (mode[1] != '+' && mode[1] != 'b')
return error_value(E_FOPEN2);
if (mode[2] != '\0')
return error_value(E_FOPEN2); return error_value(E_FOPEN2);
if (mode[2] != '\0') {
if ((mode[2] != '+' && mode[2] != 'b') ||
mode[1] == mode[2])
return error_value(E_FOPEN2);
if (mode[3] != '\0')
return error_value(E_FOPEN2);
}
} }
/* try to open */
errno = 0; errno = 0;
id = openid(v1->v_str->s_str, v2->v_str->s_str); id = openid(v1->v_str->s_str, v2->v_str->s_str);
if (id == FILEID_NONE) if (id == FILEID_NONE)
return error_value(errno); return error_value(errno);
if (id < 0) if (id < 0)
return error_value(E_FOPEN3); return error_value(-id);
result.v_type = V_FILE; result.v_type = V_FILE;
result.v_file = id; result.v_file = id;
return result; return result;
@@ -5021,21 +5028,27 @@ f_freopen(int count, VALUE **vals)
/* initialize VALUE */ /* initialize VALUE */
result.v_subtype = V_NOSUBTYPE; result.v_subtype = V_NOSUBTYPE;
/* check for a valid mode [rwa][b+\0][b+\0] */
if (vals[0]->v_type != V_FILE) if (vals[0]->v_type != V_FILE)
return error_value(E_FREOPEN1); return error_value(E_FREOPEN1);
if (vals[1]->v_type != V_STR) if (vals[1]->v_type != V_STR)
return error_value(E_FREOPEN2); return error_value(E_FREOPEN2);
mode = vals[1]->v_str->s_str; mode = vals[1]->v_str->s_str;
if ((*mode != 'r') && (*mode != 'w') && (*mode != 'a')) if ((*mode != 'r') && (*mode != 'w') && (*mode != 'a'))
return error_value(E_FREOPEN2); return error_value(E_FREOPEN2);
if (mode[1] != '\0') { if (mode[1] != '\0') {
if (mode[1] != '+') if (mode[1] != '+' && mode[1] != 'b')
return error_value(E_FREOPEN2);
if (mode[2] != '\0')
return error_value(E_FREOPEN2); return error_value(E_FREOPEN2);
if (mode[2] != '\0') {
if ((mode[2] != '+' && mode[2] != 'b') ||
mode[1] == mode[2])
return error_value(E_FOPEN2);
if (mode[3] != '\0')
return error_value(E_FREOPEN2);
}
} }
/* try to reopen */
errno = 0; errno = 0;
if (count == 2) { if (count == 2) {
id = reopenid(vals[0]->v_file, mode, NULL); id = reopenid(vals[0]->v_file, mode, NULL);
@@ -6141,10 +6154,10 @@ f_fgetfield(VALUE *vp)
result.v_subtype = V_NOSUBTYPE; result.v_subtype = V_NOSUBTYPE;
if (vp->v_type != V_FILE) if (vp->v_type != V_FILE)
return error_value(E_FGETWORD1); return error_value(E_FGETFIELD1);
i = readid(vp->v_file, 14, &str); i = readid(vp->v_file, 14, &str);
if (i > 0) if (i > 0)
return error_value(E_FGETWORD2); return error_value(E_FGETFIELD2);
result.v_type = V_NULL; result.v_type = V_NULL;
if (i == 0) { if (i == 0) {
result.v_type = V_STR; result.v_type = V_STR;

View File

@@ -15,9 +15,39 @@ DESCRIPTION
opened for either reading, writing, or appending. The mode opened for either reading, writing, or appending. The mode
is controlled by the mode flag as follows: is controlled by the mode flag as follows:
"r" reading allow allow file is positioned file(*)
"w" writing mode reading writing truncated at mode
"a" appending ---- ------- ------- --------- --------- ----
r Y N N beginning text
rb Y N N beginning binary
r+ Y N N beginning text
r+b Y N N beginning binary
rb+ Y N N beginning binary
w N Y Y beginning text
wb N Y Y beginning binary
w+ Y Y Y beginning text
w+b Y Y Y beginning binary
wb+ Y Y Y beginning binary
a N Y Y end text
ab N Y Y end binary
a+ Y Y Y end text
a+b Y Y Y end binary
ab+ Y Y Y end binary
(*) NOTE on 'b' / binary/text mode:
The 'b' or fopen binary mode has no effect on POSIX / Linux
/ Un*x-like systems. On those systems a text file is the
same as a binary file (as it should be for any modern-day
operating system). Adding 'b' to an fopen has no effect
and is ignored.
Some non-POSIX systems sucn as MS Windoz treat text files
and binary files differently. In text mode MS Windoz consider
"\r\n" and end-of-line character. On an Apple MAC, the
text mode end-of-line character is "\r".
Names of files are subject to ~ expansion just like the C or Names of files are subject to ~ expansion just like the C or
Korn shell. For example, the file name: Korn shell. For example, the file name:
@@ -90,8 +120,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.2 $ ## @(#) $Revision: 29.3 $
## @(#) $Id: fopen,v 29.2 2000/06/07 14:02:33 chongo Exp $ ## @(#) $Id: fopen,v 29.3 2001/04/10 21:46:45 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fopen,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fopen,v $
## ##
## Under source code control: 1994/10/27 03:04:17 ## Under source code control: 1994/10/27 03:04:17

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.22 $ * @(#) $Revision: 29.23 $
* @(#) $Id: version.c,v 29.22 2001/04/08 22:05:40 chongo Exp $ * @(#) $Id: version.c,v 29.23 2001/04/10 22:13:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
* *
* Under source code control: 1990/05/22 11:00:58 * Under source code control: 1990/05/22 11:00:58
@@ -43,7 +43,7 @@ static char *program;
#define MAJOR_VER 2 /* major version */ #define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */ #define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 5 /* patch level or 0 if no patch */ #define MAJOR_PATCH 5 /* patch level or 0 if no patch */
#define MINOR_PATCH "2" /* test number or empty string if no patch */ #define MINOR_PATCH "2.1" /* test number or empty string if no patch */
/* /*
* calc version constants * calc version constants

58
win32.mkdef Normal file
View File

@@ -0,0 +1,58 @@
TERMCONTROL=-DUSE_WIN32
HAVE_VSPRINTF=-UDONT_HAVE_VSPRINTF
BYTE_ORDER=-DLITTLE_ENDIAN
LONG_BITS=32
LONGLONG_BITS=0
HAVE_FPOS=-DHAVE_NO_FPOS
HAVE_FPOS_POS=-DHAVE_NO_FPOS_POS
FPOS_POS_BITS=-UFPOS_POS_BITS
FPOS_BITS=-DFPOS_BITS=64
OFF_T_BITS=-DOFF_T_BITS=32
DEV_BITS=-DDEV_BITS=32
INODE_BITS=-DINODE_BITS=16
HAVE_OFFSCL=-UOFF_T_NON_SCALAR
HAVE_POSSCL=-UFILEPOS_NON_SCALAR
HAVE_CONST=-UHAVE_NO_CONST
HAVE_UID_T=-DHAVE_NO_UID_T
HAVE_NEWSTR=-UHAVE_NO_NEWSTR
HAVE_MEMMOVE=-UHAVE_NO_MEMMOVE
HAVE_USTAT=-DHAVE_NO_USTAT
HAVE_GETSID=-DHAVE_NO_GETSID
HAVE_GETPGID=-DHAVE_NO_GETPGID
HAVE_GETTIME=-DHAVE_NO_GETTIME
HAVE_GETPRID=-DHAVE_NO_GETPRID
HAVE_URANDOM_H=NO
HAVE_GETRUSAGE=-DHAVE_NO_GETRUSAGE
HAVE_STRDUP=-UHAVE_NO_STRDUP
ALIGN32=-UMUST_ALIGN32
HAVE_MALLOC_H=YES
HAVE_STDLIB_H=YES
HAVE_STRING_H=YES
HAVE_TIMES_H=NO
HAVE_SYS_TIMES_H=NO
HAVE_TIME_H=YES
HAVE_SYS_TIME_H=NO
HAVE_UNISTD_H=NO
LIBDIR=/lib/calc
HELPDIR=/lib/calc/help
INCDIRCALC=/include/calc
CUSTOMLIBDIR=/lib/calc/custom
CUSTOMHELPDIR=/lib/calc/help/custhelp
SCRIPTDIR=/lib/calc/cscript
MANDIR=
CATDIR=
MANEXT=
CATEXT=
NROFF=
NROFF_ARG=
MANMAKE=
MANMODE=
CALCPATH=./cal
CALCRC='/lib/calc/startup:~/.calcrc:./.calcinit'
USE_READLINE=
READLINE_LIB=
READLINE_INCLUDE=
CALCPAGER=
ECHO=

View File

@@ -90,8 +90,8 @@ CONST char *error_table[E__COUNT+2] = {
"File not open for reading for fgetstr", "File not open for reading for fgetstr",
"Non-file argument for fgetline", "Non-file argument for fgetline",
"File not open for reading for fgetline", "File not open for reading for fgetline",
"Non-file argument for fgetword", "Non-file argument for fgetfield",
"File not open for reading for fgetword", "File not open for reading for fgetfield",
"Non-file argument for rewind", "Non-file argument for rewind",
"Non-integer argument for files", "Non-integer argument for files",
"Non-string fmt argument for fprint", "Non-string fmt argument for fprint",

View File

@@ -87,8 +87,8 @@
#define E_FGETSTR2 10074 /* File not open for reading for fgetstr */ #define E_FGETSTR2 10074 /* File not open for reading for fgetstr */
#define E_FGETLINE1 10075 /* Non-file argument for fgetline */ #define E_FGETLINE1 10075 /* Non-file argument for fgetline */
#define E_FGETLINE2 10076 /* File not open for reading for fgetline */ #define E_FGETLINE2 10076 /* File not open for reading for fgetline */
#define E_FGETWORD1 10077 /* Non-file argument for fgetword */ #define E_FGETFIELD1 10077 /* Non-file argument for fgetfield */
#define E_FGETWORD2 10078 /* File not open for reading for fgetword */ #define E_FGETFIELD2 10078 /* File not open for reading for fgetfield */
#define E_REWIND1 10079 /* Non-file argument for rewind */ #define E_REWIND1 10079 /* Non-file argument for rewind */
#define E_FILES 10080 /* Non-integer argument for files */ #define E_FILES 10080 /* Non-integer argument for files */
#define E_PRINTF1 10081 /* Non-string fmt argument for fprint */ #define E_PRINTF1 10081 /* Non-string fmt argument for fprint */