7 A Linux/Unix toolset and driver for Nokia mobile phones.
9 Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml.
11 Released under the terms of the GNU GPL, see file COPYING for more details.
13 Mainline code for gnokiid daemon. Handles command line parsing and
14 various daemon functions.
17 Revision 1.1.1.1 2001/11/25 21:59:18 short
18 :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
20 Revision 1.19 2001/06/28 00:28:45 pkot
21 Small docs updates (Pawel Kot)
23 Revision 1.18 2001/02/21 19:57:09 chris
24 More fiddling with the directory layout
26 Revision 1.17 2000/12/19 16:18:18 pkot
27 configure script updates and added shared function for configfile reading
38 #include <sys/types.h>
43 #include "cfgreader.h"
44 #include "gsm-common.h"
46 #include "data/virtmodem.h"
49 /* Global variables */
50 bool DebugMode; /* When true, run in debug mode */
51 char *Model; /* Model from .gnokiirc file. */
52 char *Port; /* Serial port from .gnokiirc file */
53 char *Initlength; /* Init length from .gnokiirc file */
54 char *Connection; /* Connection type from .gnokiirc file */
55 char *BinDir; /* Directory of the mgnokiidev command */
59 char *DefaultConnection = "serial";
60 char *DefaultBinDir = "/usr/local/sbin";
65 fprintf(stdout, _("gnokiid Version %s\n"
66 "Copyright (C) Hugh Blemings <hugh@blemings.org>, 1999\n"
67 "Copyright (C) Pavel Janík ml. <Pavel.Janik@suse.cz>, 1999\n"
68 "Built %s %s for %s on %s \n"), VERSION, __TIME__, __DATE__, Model, Port);
71 /* The function usage is only informative - it prints this program's usage and
72 command-line options.*/
77 fprintf(stdout, _(" usage: gnokiid {--help|--version}\n"
78 " --help display usage information."
79 " --version displays version and copyright information."
80 " --debug uses stdin/stdout for virtual modem comms.\n"));
83 /* Main function - handles command line arguments, passes them to separate
84 functions accordingly. */
86 int main(int argc, char *argv[])
89 GSM_ConnectionType connection = GCT_Serial;
97 if (readconfig(&Model, &Port, &Initlength, &Connection, &BinDir) < 0) {
102 /* Handle command line arguments. */
104 if (argc >= 2 && strcmp(argv[1], "--help") == 0) {
109 /* Display version, copyright and build information. */
111 if (argc >= 2 && strcmp(argv[1], "--version") == 0) {
116 if (argc >= 2 && strcmp(argv[1], "--debug") == 0) {
122 if (!strcmp(Connection, "infrared")) {
123 connection=GCT_Infrared;
126 TerminateThread=false;
128 if (VM_Initialise(Model, Port, Initlength, connection, BinDir, DebugMode, true) == false) {
133 if (TerminateThread==true) {