Added manpage. The page is not complete but one can see how the program
[infodrom/dtaus] / main.c
1 /*
2     main.c - Datentraegeraustausch mit einer Bank
3     Copyright (c) 1996  Martin Schulze <joey@orgatech.de>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU 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, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19     $Id$
20  */
21
22 #include <stdio.h>
23 #include "dtaus.h"
24
25 void help ()
26 {
27   printf ("dtaus - Belegloser Datenträgeraustausch mit einer Bank\n\n");
28   printf ("  -dtaus        Erzeugt eine Bankdatei\n");
29   printf ("  -control      Liest eine Bankdatei und erzeugt die Kontrolldatei\n");
30   printf ("\n");
31   printf ("  -d <dtaus>    Bankdatei [dtaus0.txt]\n");
32   printf ("  -c <control>  Steuerdatei [dtaus0.ctl]\n");
33   printf ("  -b <begleit>  Begleitzettel für die Bank dtaus0.doc]\n");
34   printf ("  -o <kontroll> Kontrolldatei zum Abheften [dtaus0.sik]\n");
35 }
36
37 #define DTAUS   1
38 #define CONTROL 2
39
40 void main (int argc, char **argv)
41 {
42   char *dtaus[60];
43   char *control[60];
44   char *beleg[60];
45   char *check[60];
46   int action = 0;
47   int i = 0;
48
49   strcpy ((char *)dtaus, "dtaus0.txt");
50   strcpy ((char *)control, "dtaus0.ctl");
51   strcpy ((char *)beleg, "dtaus0.doc");
52   strcpy ((char *)check, "dtaus0.sik");
53
54   while (argc - i > 1) {
55     i++;
56     if ( !strcmp(argv[i], "-h") ) {
57       help(); exit(0);
58     } else if ( !strcmp(argv[i], "-v") ) {
59       printf ("dtaus version 0.2 - Copyright (c) 1997 by Martin Schulze <joey@infodrom.north.de>\n");
60       exit (0);
61     } else if ( !strcmp(argv[i], "-d") ) {
62       if (argc - i > 1) {
63         i++;
64         strcpy ((char *)dtaus, argv[i]);
65       }
66     } else if ( !strcmp(argv[i], "-c") ) {
67       if (argc - i > 1) {
68         i++;
69         strcpy ((char *)control, argv[i]);
70       }
71     } else if ( !strcmp(argv[i], "-b") ) {
72       if (argc - i > 1) {
73         i++;
74         strcpy ((char *)beleg, argv[i]);
75       }
76     } else if ( !strcmp(argv[i], "-o") ) {
77       if (argc - i > 1) {
78         i++;
79         strcpy ((char *)check, argv[i]);
80       }
81     } else if ( !strcmp(argv[i], "-dtaus") ) {
82       action = DTAUS;
83     } else if ( !strcmp(argv[i], "-control") ) {
84       action = CONTROL;
85     } 
86   }
87
88   if (action == DTAUS)
89     control2dtaus ((char *)control, (char *)dtaus, (char *)beleg, (char *)check);
90   else if (action == CONTROL)
91     dtaus2control ((char *)dtaus, (char *)control);
92   else
93     printf ("Keine Routine angegeben (-dtaus bzw. -control vergessen).\n");
94 }