1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 1996, 1997 David Mosberger-Tang and Andreas Beck
3    This file is part of the SANE package.
4 
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18    As a special exception, the authors of SANE give permission for
19    additional uses of the libraries contained in this release of SANE.
20 
21    The exception is that, if you link a SANE library with other files
22    to produce an executable, this does not by itself cause the
23    resulting executable to be covered by the GNU General Public
24    License.  Your use of that executable is in no way restricted on
25    account of linking the SANE library code into it.
26 
27    This exception does not, however, invalidate any other reasons why
28    the executable file might be covered by the GNU General Public
29    License.
30 
31    If you submit changes to SANE to the maintainers to be included in
32    a subsequent release, you agree by submitting the changes that
33    those changes may be distributed with this exception intact.
34 
35    If you write modifications of your own for SANE, it is your choice
36    whether to permit this exception to apply to your modifications.
37    If you do not wish that, delete this exception notice.
38 
39    This file implements the backend-independent parts of SANE.  */
40 
41 #include <stdio.h>
42 
43 #include "../include/sane/sane.h"
44 
45 #ifndef SANE_I18N
46 #define SANE_I18N(text)   text
47 #endif
48 
49 SANE_String_Const
sane_strstatus(SANE_Status status)50 sane_strstatus (SANE_Status status)
51 {
52   static char buf[80];
53 
54   switch (status)
55     {
56     case SANE_STATUS_GOOD:
57       return SANE_I18N("Success");
58 
59     case SANE_STATUS_UNSUPPORTED:
60       return SANE_I18N("Operation not supported");
61 
62     case SANE_STATUS_CANCELLED:
63       return SANE_I18N("Operation was canceled");
64 
65     case SANE_STATUS_DEVICE_BUSY:
66       return SANE_I18N("Device busy");
67 
68     case SANE_STATUS_INVAL:
69       return SANE_I18N("Invalid argument");
70 
71     case SANE_STATUS_EOF:
72       return SANE_I18N("End of file reached");
73 
74     case SANE_STATUS_JAMMED:
75       return SANE_I18N("Document feeder jammed");
76 
77     case SANE_STATUS_NO_DOCS:
78       return SANE_I18N("Document feeder out of documents");
79 
80     case SANE_STATUS_COVER_OPEN:
81       return SANE_I18N("Scanner cover is open");
82 
83     case SANE_STATUS_IO_ERROR:
84       return SANE_I18N("Error during device I/O");
85 
86     case SANE_STATUS_NO_MEM:
87       return SANE_I18N("Out of memory");
88 
89     case SANE_STATUS_ACCESS_DENIED:
90       return SANE_I18N("Access to resource has been denied");
91 
92 #ifdef SANE_STATUS_WARMING_UP
93     case SANE_STATUS_WARMING_UP:
94       return SANE_I18N("Lamp not ready, please retry");
95 #endif
96 
97 #ifdef SANE_STATUS_HW_LOCKED
98     case SANE_STATUS_HW_LOCKED:
99       return SANE_I18N("Scanner mechanism locked for transport");
100 #endif
101 
102     default:
103       /* non-reentrant, but better than nothing */
104       sprintf (buf, "Unknown SANE status code %d", status);
105       return buf;
106     }
107 }
108