Corrections to SVN properties.
[AROS.git] / workbench / libs / codesets / developer / examples / b64d.c
blob83893a9e831139cf4408d21d7bcadf9e38417663
1 /***************************************************************************
3 codesets.library - Amiga shared library for handling different codesets
4 Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 Copyright (C) 2005-2013 by codesets.library Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 codesets.library project: http://sourceforge.net/projects/codesetslib/
19 Most of the code included in this file was relicensed from GPL to LGPL
20 from the source code of SimpleMail (http://www.sf.net/projects/simplemail)
21 with full permissions by its authors.
23 $Id$
25 ***************************************************************************/
27 #include <stdio.h>
28 #include <string.h>
30 #include <proto/exec.h>
31 #include <proto/codesets.h>
33 struct Library *CodesetsBase = NULL;
34 #if defined(__amigaos4__)
35 struct CodesetsIFace* ICodesets = NULL;
36 #endif
38 #if defined(__amigaos4__)
39 #define GETINTERFACE(iface, base) (iface = (APTR)GetInterface((struct Library *)(base), "main", 1L, NULL))
40 #define DROPINTERFACE(iface) (DropInterface((struct Interface *)iface), iface = NULL)
41 #else
42 #define GETINTERFACE(iface, base) TRUE
43 #define DROPINTERFACE(iface)
44 #endif
46 int main(int argc,char **argv)
48 int res;
50 if (argc==3)
53 if((CodesetsBase = OpenLibrary(CODESETSNAME,CODESETSVER)) &&
54 GETINTERFACE(ICodesets, CodesetsBase))
56 ULONG r;
58 r = CodesetsDecodeB64(CSA_B64SourceFile, (Tag)argv[1],
59 CSA_B64DestFile, (Tag)argv[2],
60 TAG_DONE);
61 printf("Res %d\n", (int)r);
63 DROPINTERFACE(ICodesets);
64 CloseLibrary(CodesetsBase);
65 CodesetsBase = NULL;
67 res = 0;
69 else
71 printf("can't open %s %d+\n",CODESETSNAME,CODESETSVER);
72 res = 20;
75 else
77 printf("Usage: b64d <in_file> <out_file>\n");
78 res = 10;
81 return res;