1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy. 2141cc406Sopenharmony_ci Copyright (C) 1996, 1997 David Mosberger-Tang and Andreas Beck 3141cc406Sopenharmony_ci This file is part of the SANE package. 4141cc406Sopenharmony_ci 5141cc406Sopenharmony_ci This program is free software; you can redistribute it and/or 6141cc406Sopenharmony_ci modify it under the terms of the GNU General Public License as 7141cc406Sopenharmony_ci published by the Free Software Foundation; either version 2 of the 8141cc406Sopenharmony_ci License, or (at your option) any later version. 9141cc406Sopenharmony_ci 10141cc406Sopenharmony_ci This program is distributed in the hope that it will be useful, but 11141cc406Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 12141cc406Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13141cc406Sopenharmony_ci General Public License for more details. 14141cc406Sopenharmony_ci 15141cc406Sopenharmony_ci You should have received a copy of the GNU General Public License 16141cc406Sopenharmony_ci along with this program. If not, see <https://www.gnu.org/licenses/>. 17141cc406Sopenharmony_ci 18141cc406Sopenharmony_ci As a special exception, the authors of SANE give permission for 19141cc406Sopenharmony_ci additional uses of the libraries contained in this release of SANE. 20141cc406Sopenharmony_ci 21141cc406Sopenharmony_ci The exception is that, if you link a SANE library with other files 22141cc406Sopenharmony_ci to produce an executable, this does not by itself cause the 23141cc406Sopenharmony_ci resulting executable to be covered by the GNU General Public 24141cc406Sopenharmony_ci License. Your use of that executable is in no way restricted on 25141cc406Sopenharmony_ci account of linking the SANE library code into it. 26141cc406Sopenharmony_ci 27141cc406Sopenharmony_ci This exception does not, however, invalidate any other reasons why 28141cc406Sopenharmony_ci the executable file might be covered by the GNU General Public 29141cc406Sopenharmony_ci License. 30141cc406Sopenharmony_ci 31141cc406Sopenharmony_ci If you submit changes to SANE to the maintainers to be included in 32141cc406Sopenharmony_ci a subsequent release, you agree by submitting the changes that 33141cc406Sopenharmony_ci those changes may be distributed with this exception intact. 34141cc406Sopenharmony_ci 35141cc406Sopenharmony_ci If you write modifications of your own for SANE, it is your choice 36141cc406Sopenharmony_ci whether to permit this exception to apply to your modifications. 37141cc406Sopenharmony_ci If you do not wish that, delete this exception notice. 38141cc406Sopenharmony_ci 39141cc406Sopenharmony_ci This file implements the backend-independent parts of SANE. */ 40141cc406Sopenharmony_ci 41141cc406Sopenharmony_ci#include <stdio.h> 42141cc406Sopenharmony_ci 43141cc406Sopenharmony_ci#include "../include/sane/sane.h" 44141cc406Sopenharmony_ci 45141cc406Sopenharmony_ci#ifndef SANE_I18N 46141cc406Sopenharmony_ci#define SANE_I18N(text) text 47141cc406Sopenharmony_ci#endif 48141cc406Sopenharmony_ci 49141cc406Sopenharmony_ciSANE_String_Const 50141cc406Sopenharmony_cisane_strstatus (SANE_Status status) 51141cc406Sopenharmony_ci{ 52141cc406Sopenharmony_ci static char buf[80]; 53141cc406Sopenharmony_ci 54141cc406Sopenharmony_ci switch (status) 55141cc406Sopenharmony_ci { 56141cc406Sopenharmony_ci case SANE_STATUS_GOOD: 57141cc406Sopenharmony_ci return SANE_I18N("Success"); 58141cc406Sopenharmony_ci 59141cc406Sopenharmony_ci case SANE_STATUS_UNSUPPORTED: 60141cc406Sopenharmony_ci return SANE_I18N("Operation not supported"); 61141cc406Sopenharmony_ci 62141cc406Sopenharmony_ci case SANE_STATUS_CANCELLED: 63141cc406Sopenharmony_ci return SANE_I18N("Operation was canceled"); 64141cc406Sopenharmony_ci 65141cc406Sopenharmony_ci case SANE_STATUS_DEVICE_BUSY: 66141cc406Sopenharmony_ci return SANE_I18N("Device busy"); 67141cc406Sopenharmony_ci 68141cc406Sopenharmony_ci case SANE_STATUS_INVAL: 69141cc406Sopenharmony_ci return SANE_I18N("Invalid argument"); 70141cc406Sopenharmony_ci 71141cc406Sopenharmony_ci case SANE_STATUS_EOF: 72141cc406Sopenharmony_ci return SANE_I18N("End of file reached"); 73141cc406Sopenharmony_ci 74141cc406Sopenharmony_ci case SANE_STATUS_JAMMED: 75141cc406Sopenharmony_ci return SANE_I18N("Document feeder jammed"); 76141cc406Sopenharmony_ci 77141cc406Sopenharmony_ci case SANE_STATUS_NO_DOCS: 78141cc406Sopenharmony_ci return SANE_I18N("Document feeder out of documents"); 79141cc406Sopenharmony_ci 80141cc406Sopenharmony_ci case SANE_STATUS_COVER_OPEN: 81141cc406Sopenharmony_ci return SANE_I18N("Scanner cover is open"); 82141cc406Sopenharmony_ci 83141cc406Sopenharmony_ci case SANE_STATUS_IO_ERROR: 84141cc406Sopenharmony_ci return SANE_I18N("Error during device I/O"); 85141cc406Sopenharmony_ci 86141cc406Sopenharmony_ci case SANE_STATUS_NO_MEM: 87141cc406Sopenharmony_ci return SANE_I18N("Out of memory"); 88141cc406Sopenharmony_ci 89141cc406Sopenharmony_ci case SANE_STATUS_ACCESS_DENIED: 90141cc406Sopenharmony_ci return SANE_I18N("Access to resource has been denied"); 91141cc406Sopenharmony_ci 92141cc406Sopenharmony_ci#ifdef SANE_STATUS_WARMING_UP 93141cc406Sopenharmony_ci case SANE_STATUS_WARMING_UP: 94141cc406Sopenharmony_ci return SANE_I18N("Lamp not ready, please retry"); 95141cc406Sopenharmony_ci#endif 96141cc406Sopenharmony_ci 97141cc406Sopenharmony_ci#ifdef SANE_STATUS_HW_LOCKED 98141cc406Sopenharmony_ci case SANE_STATUS_HW_LOCKED: 99141cc406Sopenharmony_ci return SANE_I18N("Scanner mechanism locked for transport"); 100141cc406Sopenharmony_ci#endif 101141cc406Sopenharmony_ci 102141cc406Sopenharmony_ci default: 103141cc406Sopenharmony_ci /* non-reentrant, but better than nothing */ 104141cc406Sopenharmony_ci sprintf (buf, "Unknown SANE status code %d", status); 105141cc406Sopenharmony_ci return buf; 106141cc406Sopenharmony_ci } 107141cc406Sopenharmony_ci} 108