X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=blobdiff_plain;f=src%2Flibpspp%2Flegacy-encoding.c;h=aaa1fb7392fc39874e4737453f745f14775a1785;hp=91ada6d541066e4837925f4ff462d13edce762d0;hb=9254d30d06a0565c89daccedd93a94c4c6086004;hpb=f5c108becd49d78f4898cab11352291f5689d24e diff --git a/src/libpspp/legacy-encoding.c b/src/libpspp/legacy-encoding.c index 91ada6d5..aaa1fb73 100644 --- a/src/libpspp/legacy-encoding.c +++ b/src/libpspp/legacy-encoding.c @@ -1,20 +1,18 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ #include @@ -26,16 +24,16 @@ static const char ascii_to_ebcdic[256]; static const char ebcdic_to_ascii[256]; void -legacy_recode (enum legacy_encoding from, const char *src, - enum legacy_encoding to, char *dst, +legacy_recode (const char *from, const char *src, + const char *to, char *dst, size_t size) { - if (from != to) + if (0 != strcmp (from, to)) { const char *table; size_t i; - table = from == LEGACY_ASCII ? ascii_to_ebcdic : ebcdic_to_ascii; + table = (0 == strcmp (from, "PSPP-LEGACY-ASCII")) ? ascii_to_ebcdic : ebcdic_to_ascii; for (i = 0; i < size; i++) dst[i] = table[(unsigned char) src[i]]; } @@ -47,14 +45,14 @@ legacy_recode (enum legacy_encoding from, const char *src, } char -legacy_to_native (enum legacy_encoding from, char c) +legacy_to_native (const char *from, char c) { legacy_recode (from, &c, LEGACY_NATIVE, &c, 1); return c; } char -legacy_from_native (enum legacy_encoding to, char c) +legacy_from_native (const char *to, char c) { legacy_recode (LEGACY_NATIVE, &c, to, &c, 1); return c;