/* * pHatt - PalmOS(TM) Hattrick (http://www.hattrick.org) Manager Assistant * * hrf2pdb.c - linux-wrap for convert * * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include "hrf2pdb.h" void usage(int e) { fprintf(stderr, "Error: "); switch ( e) { case ERR_OLD: fprintf(stderr, "Could not open old database\n"); break; case ERR_HRF: fprintf(stderr, "Could not open hrf file\n"); break; case ERR_NEW: fprintf(stderr, "Could not open new database\n"); break; case ERR_EMPTY: fprintf(stderr, "No hrf or new database given?\n"); break; case ERR_VERSION: fprintf(stderr, "Old database has wrong version\n"); break; case ERR_NOPLAYER: fprintf(stderr, "No players found in hrf file\n"); break; case ERR_DB: fprintf(stderr, "Old database is not in pHatt-Format\n"); break; case ERR_PARAM: fprintf(stderr, "Wrong Parameters\n"); break; case ERR_ALLOC: fprintf(stderr, "Could not allocate Memory\n"); break; case ERR_UTF: fprintf(stderr, "Illegal UTF-8 characters in Player name\n"); break; default: fprintf(stderr, "Unknown error\n"); break; } fprintf(stderr, "\n"); fprintf(stderr, "Usage: hrf2pdb [old.pdb] xy.hrf new.pdb\n"); fprintf(stderr, " whereby old.pdb is the previous pdb\n"); fprintf(stderr, " xy.hrf is the .hrf file to retrieve your players etc.\n"); fprintf(stderr, " and new.pdb is the output-file\n"); fprintf(stderr, " if no old pdb is given, a new one is created\n"); exit(1); } /* * MAIN */ int main (int ac, char *av[]) { /* Very basic checking */ switch ( ac ) { case 4: exit ( convert(av[1], av[2], av[3])); break; case 3: exit ( convert(NULL, av[1], av[2])); break; default: usage(ERR_PARAM); } exit(0); }