5 A Linux/Unix toolset and driver for Nokia mobile phones.
7 Released under the terms of the GNU GPL, see file COPYING for more details.
9 Mainline code for gnokiid daemon. Handles command line parsing and
10 various daemon functions.
20 #include <sys/types.h>
25 #include "files/cfgreader.h"
26 #include "gsm-common.h"
28 #include "data/virtmodem.h"
30 /* Global variables */
31 bool DebugMode; /* When true, run in debug mode */
32 char *Model; /* Model from .gnokiirc file. */
33 char *Port; /* Port from .gnokiirc file */
34 char *Initlength; /* Init length from .gnokiirc file */
35 char *Connection; /* Connection type from .gnokiirc file */
36 char *SynchronizeTime;
37 char *BinDir; /* Directory of the mgnokiidev command */
44 fprintf(stdout, _("gnokiid Version %s\n"
45 "Copyright (C) Hugh Blemings <hugh@linuxcare.com>, 1999\n"
46 "Copyright (C) Pavel JanÃk ml. <Pavel.Janik@linux.cz>, 1999\n"
47 "Built %s %s for %s on %s \n"), VERSION, __TIME__, __DATE__, Model, Port);
50 /* The function usage is only informative - it prints this program's usage and
51 command-line options.*/
56 fprintf(stdout, _(" usage: gnokiid {--help|--version}\n"
57 " --help display usage information."
58 " --version displays version and copyright information."
59 " --debug uses stdin/stdout for virtual modem comms.\n"));
62 /* Main function - handles command line arguments, passes them to separate
63 functions accordingly. */
65 int main(int argc, char *argv[])
68 GSM_ConnectionType connection;
77 if (strcmp(GetMygnokiiVersion(),VERSION)!=0)
78 fprintf(stderr,_("WARNING: version of installed libmygnokii.so (%s) is different to version of gnokiid (%s)\n"),GetMygnokiiVersion(),VERSION);
81 if (CFG_ReadConfig(&Model, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,true) < 0) {
85 /* Handle command line arguments. */
87 if (argc >= 2 && strcmp(argv[1], "--help") == 0) {
92 /* Display version, copyright and build information. */
94 if (argc >= 2 && strcmp(argv[1], "--version") == 0) {
99 if (argc >= 2 && strcmp(argv[1], "--debug") == 0) {
106 connection=GetConnectionTypeFromString(Connection);
108 /* MBUS wasn't tested */
109 if (connection!=GCT_FBUS && connection!=GCT_MBUS &&
110 connection!=GCT_Infrared && connection!=GCT_Tekram) {
111 fprintf(stdout,_("Incorrect connection type!\n"));
115 TerminateThread=false;
117 if (VM_Initialise(Model, Port, Initlength, connection, BinDir, DebugMode, true, SynchronizeTime) == false)
121 if (TerminateThread==true) {