2 errno - return or set a stored error-number
8 errnum integer, 0 <= errnum <= 32767
14 Whenever an operation or evaluation of function returns an error-value,
15 the numerical code for that value is stored as calc_errno.
17 errno() returns the current value of calc_errno.
19 errno(errnum) sets calc_errno to the value errnum and returns its
22 To detect whether an error occurs during some sequence of operations,
23 one may immediately before that sequence set the stored error-number
24 to zero by errno(0), and then after the operations, whether or not
25 an error has occurred will be indicated by errno() being nonzero or
26 zero. If a non-zero value is returned, that value will be the code
27 for the most recent error encountered.
29 The default argument for the functions error() and strerror() is the
30 currently stored error-number; in particular, if no error-value has
31 been returned after the last errno(0), strerror() will return
35 Assuming there is no file with name "not_a_file"
38 ; errmax(errcount()+4)
40 ; badfile = fopen("not_a_file", "r")
41 ; print errno(), error(), strerror()
42 2 System error 2 No such file or directory
45 ; print errno(), error(), strerror()
46 10001 Error 10001 Division by zero
55 errmax, errcount, error, strerror, iserror, newerror, errorcodes,
58 ## Copyright (C) 1999-2006 Landon Curt Noll
60 ## Calc is open software; you can redistribute it and/or modify it under
61 ## the terms of the version 2.1 of the GNU Lesser General Public License
62 ## as published by the Free Software Foundation.
64 ## Calc is distributed in the hope that it will be useful, but WITHOUT
65 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
66 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
67 ## Public License for more details.
69 ## A copy of version 2.1 of the GNU Lesser General Public License is
70 ## distributed with calc under the filename COPYING-LGPL. You should have
71 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
72 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
74 ## @(#) $Revision: 30.1 $
75 ## @(#) $Id: errno,v 30.1 2007/03/16 11:10:42 chongo Exp $
76 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/errno,v $
78 ## Under source code control: 1994/10/27 03:05:08
79 ## File existed as early as: 1994
81 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
82 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/