File: gsynaptic.cc

package info (click to toggle)
synaptic 0.91.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,676 kB
  • sloc: cpp: 19,830; xml: 10,562; ansic: 2,084; makefile: 498; sed: 93; python: 82; sh: 52
file content (619 lines) | stat: -rw-r--r-- 19,137 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
/* gsynaptic.cc - main() 
 * 
 * Copyright (c) 2001-2003 Alfredo K. Kojima
 * 
 * Author: Alfredo K. Kojima <kojima@conectiva.com.br>
 *
 * 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 <iostream>

#include "config.h"

#include "i18n.h"

#include "rconfiguration.h"
#include "raptoptions.h"
#include "rpackagelister.h"
#include <cmath>
#include <apt-pkg/configuration.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <X11/Xlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <cstdlib>
#include <cassert>
#include <errno.h>
#include <fstream>
#include <cstring>

#include "rgmainwindow.h"
#include "rguserdialog.h"
#include "locale.h"
#include "stdio.h"
#include "rgutils.h"
#include "rgpackagestatus.h"



typedef enum {
   UPDATE_ASK,
   UPDATE_CLOSE,
   UPDATE_AUTO
} UpdateType;


bool ShowHelp(CommandLine & CmdL)
{
   std::cout <<
#ifndef HAVE_RPM
      PACKAGE " for Debian " VERSION
#else
      _config->Find("Synaptic::MyName", PACKAGE) + " " VERSION
#endif
      "\n\n" <<
      _("Usage: synaptic [options]\n") <<
      _("-h   This help text\n") <<
      _("-r   Open in the repository screen\n") <<
      _("-f=? Give an alternative filter file\n") <<
      _("-t   Give an alternative main window title (e.g. hostname with `uname -n`)\n") <<
      _("-i=? Start with the initial Filter with given name\n") <<
      _("-o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n")<<
      _("--upgrade-mode  Call Upgrade and display changes\n") <<
      _("--dist-upgrade-mode  Call DistUpgrade and display changes\n") <<
      _("--update-at-startup  Call \"Reload\" on startup\n")<<
      _("--non-interactive Never prompt for user input\n") << 
      _("--task-window Open with task window\n") <<
      _("--add-cdrom Add a cdrom at startup (needs path for cdrom)\n") <<
      _("--ask-cdrom Ask for adding a cdrom and exit\n") <<
      _("--test-me-harder  Run test in a loop\n");
   exit(0);
}

CommandLine::Args Args[] = {
   {
   'h', "help", "help", 0}
   , {
   'f', "filter-file", "Volatile::filterFile", CommandLine::HasArg}
   , {
   'r', "repositories", "Volatile::startInRepositories", 0}
   , {
   'i', "initial-filter", "Volatile::initialFilter", CommandLine::HasArg}
   , {
   0, "set-selections", "Volatile::Set-Selections", 0}
   , {
   0, "set-selections-file", "Volatile::Set-Selections-File", CommandLine::HasArg}
   , {
   0, "non-interactive", "Volatile::Non-Interactive", 0}
   , {
   0, "upgrade-mode", "Volatile::Upgrade-Mode", 0}
   , {
   0, "dist-upgrade-mode", "Volatile::DistUpgrade-Mode", 0}
   , {
   0, "add-cdrom", "Volatile::AddCdrom-Mode", CommandLine::HasArg}
   , {
   0, "ask-cdrom", "Volatile::AskCdrom-Mode", 0}
   , {
   0, "parent-window-id", "Volatile::ParentWindowId", CommandLine::HasArg}
   , {
   0, "progress-str", "Volatile::InstallProgressStr", CommandLine::HasArg} 
   , {
   0, "finish-str", "Volatile::InstallFinishedStr", CommandLine::HasArg} 
   , {
   't', "title", "Volatile::MyName", CommandLine::HasArg}
   , {
   0, "update-at-startup", "Volatile::Update-Mode", 0}
   , {
   0, "hide-main-window", "Volatile::HideMainwindow", 0}
   , {
   0, "task-window", "Volatile::TaskWindow", 0}
   , {
   0, "test-me-harder", "Volatile::TestMeHarder", 0}
   , {
   'o', "option", 0, CommandLine::ArbItem}
   , {
   0, 0, 0, 0}
};


static void SetLanguages()
{
   string LangList;
   if (_config->FindB("Synaptic::DynamicLanguages", true) == false) {
      LangList = _config->Find("Synaptic::Languages", "");
   } else {
      char *lang = getenv("LANG");
      if (lang == NULL) {
         lang = getenv("LC_MESSAGES");
         if (lang == NULL) {
            lang = getenv("LC_ALL");
         }
      }
      if (lang != NULL && strcmp(lang, "C") != 0)
         LangList = lang;
   }

   _config->Set("Volatile::Languages", LangList);
}

void welcome_dialog(RGMainWindow *mainWindow)
{
      // show welcome dialog
      if (_config->FindB("Synaptic::showWelcomeDialog", true) &&
	  !_config->FindB("Volatile::Upgrade-Mode",false)) {
         RGGtkBuilderUserDialog dia(mainWindow);
         dia.run("welcome");
         GtkWidget *cb = GTK_WIDGET(gtk_builder_get_object(dia.getGtkBuilder(),
                                              "checkbutton_show_again"));
         assert(cb);
         _config->Set("Synaptic::showWelcomeDialog",
                      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb)));
      }
}

void update_check(RGMainWindow *mainWindow, RPackageLister *lister)
{
   struct stat st;

   // check when the last update happend updates
   UpdateType update =
      (UpdateType) _config->FindI("Synaptic::update::type", UPDATE_ASK);
   if(update != UPDATE_CLOSE) {
      // check when last update happend
      int lastUpdate = _config->FindI("Synaptic::update::last",0);
      int minimal= _config->FindI("Synaptic::update::minimalIntervall", 48);

      // check for the mtime of the various package lists
      vector<string> filenames = lister->getPolicyArchives(true);
      for (int i=0;i<filenames.size();i++) {
	 stat(filenames[i].c_str(), &st);
	 if(filenames[i] != "/var/lib/dpkg/status")
	    lastUpdate = max(lastUpdate, (int)st.st_mtime);
      }
      
      // new apt uses this
      string update_stamp = _config->FindDir("Dir::State","var/lib/apt");
      update_stamp += "update-stamp";
      if(FileExists(update_stamp)) {
	 stat(update_stamp.c_str(), &st);
	 lastUpdate = max(lastUpdate, (int)st.st_mtime);
      }

      // 3600s=1h 
      if((lastUpdate + minimal*3600) < time(NULL)) {
	 if(update == UPDATE_AUTO) 
	    mainWindow->cbUpdateClicked(NULL, mainWindow);
	 else {
	    RGGtkBuilderUserDialog dia(mainWindow);
	    int res = dia.run("update_outdated",true);
	    GtkWidget *cb = GTK_WIDGET(gtk_builder_get_object(dia.getGtkBuilder(),
						 "checkbutton_remember"));
	    assert(cb);
	    if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb))) {
	       if(res == GTK_RESPONSE_CANCEL)
		  _config->Set("Synaptic::update::type", UPDATE_CLOSE);
	       if(res == GTK_RESPONSE_OK)
		  _config->Set("Synaptic::update::type", UPDATE_AUTO);
	    }
	    if(res == GTK_RESPONSE_OK)
	       mainWindow->cbUpdateClicked(NULL, mainWindow);
	 }
      }
   }
}


// lock stuff
static int sigterm_unix_signal_pipe_fds[2];
static GIOChannel *sigterm_iochn;

static void 
handle_sigusr1 (int value)
{
   static char marker[1] = {'S'};

   /* write a 'S' character to the other end to tell about
    * the signal. Note that 'the other end' is a GIOChannel thingy
    * that is only called from the mainloop - thus this is how we
    * defer this since UNIX signal handlers are evil
    *
    * Oh, and write(2) is indeed reentrant */
   write (sigterm_unix_signal_pipe_fds[1], marker, 1);
}

static gboolean
sigterm_iochn_data (GIOChannel *source, 
		    GIOCondition condition, 
		    gpointer user_data)
{
   GError *err = NULL;
   gchar data[1];
   gsize bytes_read;
   
   RGMainWindow *me = (RGMainWindow *)user_data;

   /* Empty the pipe */
   if (G_IO_STATUS_NORMAL != 
       g_io_channel_read_chars (source, data, 1, &bytes_read, &err)) {
      g_warning("Error emptying callout notify pipe: %s", err->message);
      g_error_free (err);
      return TRUE;
   }
   if(data[0] == 'S')
      me->activeWindowToForeground();

   return TRUE;
}

// test if a lock is aquired already, return 0 if no lock is found, 
// the pid of the locking application or -1 on error
pid_t TestLock(string File)
{
   int FD = open(File.c_str(),0);
   if(FD < 0) {
      if(errno == ENOENT) {
	 // File does not exist, no there can't be a lock
	 return 0; 
      } else {
	 //cout << "open, errno: " << errno << endl;
	 //perror("open");
	 return(-1);
      }
   }
   struct flock fl;
   fl.l_type = F_WRLCK;
   fl.l_whence = SEEK_SET;
   fl.l_start = 0;
   fl.l_len = 0;
   if (fcntl(FD, F_GETLK, &fl) < 0) {
      int Tmp = errno;
      close(FD);
      cerr << "fcntl error" << endl;
      errno = Tmp;
      return(-1);
   }
   close(FD);
   // lock is available
   if(fl.l_type == F_UNLCK)
      return(0);
   // file is locked by another process
   return (fl.l_pid);
}

// check if we can get a lock, must be done after we read the configuration
// if a lock is found and the app is synaptic send it a "come to foreground"
// signal (USR1) or if not synaptic display a error and exit
// 1. check if there is another synaptic running
//    a) if so, check if it runs interactive and we are not running interactive
//       *) if so, send signal and show message
//       *) if not, send signal
// 2. check if we can get a /var/lib/dpkg/lock 
//    *) if not, show message and fail
void check_and_aquire_lock()
{
   if (getuid() != 0) 
      return;

   GtkWidget *dia;
   gchar *msg = NULL;
   pid_t LockedApp, runsNonInteractive;
   bool weNonInteractive;

   string SynapticLock = RConfDir()+"/lock";
   string SynapticNonInteractiveLock = RConfDir()+"/lock.non-interactive";
   weNonInteractive = _config->FindB("Volatile::Non-Interactive", false);

   // 1. test for another synaptic
   LockedApp = TestLock(SynapticLock);
   if(LockedApp > 0) {
      runsNonInteractive = TestLock(SynapticNonInteractiveLock);
      //cout << "runsNonIteractive: " << runsNonInteractive << endl;
      //cout << "weNonIteractive: " << weNonInteractive << endl;
      if(weNonInteractive && runsNonInteractive <= 0) {
	 // message that we can't turn a non-interactive into a interactive
	 // one
	 msg = g_strdup_printf("<big><b>%s</b></big>\n\n%s",
			       _("Another synaptic is running"),
			       _("There is another synaptic running in "
				 "interactive mode. Please close it first. "
				 ));
      } else if(runsNonInteractive > 0) {
	 msg = g_strdup_printf("<big><b>%s</b></big>\n\n%s",
			       _("Another synaptic is running"),
			       _("There is another synaptic running in "
				 "non-interactive mode. Please wait for it "
				 "to finish first."
				 ));
      }

      if(msg != NULL) {
	 dia = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
					GTK_MESSAGE_ERROR, 
					GTK_BUTTONS_CLOSE, 
					NULL);

         gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dia), msg);
	 gtk_dialog_run(GTK_DIALOG(dia));
	 gtk_widget_destroy(dia);
      }
      g_free(msg);

      cout << "Another synaptic is running. Trying to bring it to the foreground" << endl;
      kill(LockedApp, SIGUSR1);
      exit(0);
   }

   // 2. test if we can get a lock
   string AdminDir = flNotFile(_config->Find("Dir::State::status"));
   LockedApp = TestLock(AdminDir + "lock");
   if (LockedApp > 0) {
      msg = g_strdup_printf("<big><b>%s</b></big>\n\n%s",
			    _("Unable to get exclusive lock"),
			    _("This usually means that another "
			      "package management application "
			      "(like apt-get or aptitude) is "
			      "already running. Please close that "
			      "application first."));
      dia = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
					GTK_MESSAGE_ERROR, 
					GTK_BUTTONS_CLOSE,
					NULL);

      gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dia), msg);
      gtk_dialog_run(GTK_DIALOG(dia));
      g_free(msg);
      exit(1);
   }
   
   // we can't get a lock?!?
   if(GetLock(SynapticLock, true) < 0) {
      _error->DumpErrors();
      exit(1);
   }
   // if we run nonInteracitvely, get a seond lock
   if(weNonInteractive && GetLock(SynapticNonInteractiveLock, true) < 0) {
      _error->DumpErrors();
      exit(1);
   }
}

int main(int argc, char **argv)
{
#ifdef ENABLE_NLS
   bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
   bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
   textdomain(GETTEXT_PACKAGE);

#ifdef HAVE_RPM
   bind_textdomain_codeset("rpm", "UTF-8");
#endif
#endif

   if (!gtk_init_check(&argc, &argv)) {
      std::cout <<
         _("Failed to initialize GTK.\n") <<
         "\n" <<
         _("Probably you're running Synaptic on Wayland with root permission.\n") <<
         _("Please restart your session without Wayland, or run Synaptic without root permission\n");
      exit(1);
   };
   //XSynchronize(dpy, 1);
   
   // read the cmdline
   CommandLine CmdL(Args, _config);

   if (CmdL.Parse(argc, (const char **)argv) == false) {
      RGUserDialog userDialog;
      userDialog.showErrors();
      exit(1);
   }
   
   if (_config->FindB("help") == true)
      ShowHelp(CmdL);

   if (getuid() != 0) {
      RGUserDialog userDialog;
      userDialog.warning(g_strdup_printf("<b><big>%s</big></b>\n\n%s",
                                         _("Starting \"Synaptic Package Manager\" without "
                                           "administrative privileges"),
				         _("You will not be able to apply "
				           "any changes, but you can still "
					   "export the marked changes or "
					   "create a download script "
					   "for them.")));
   }

   if (!RInitConfiguration("synaptic.conf")) {
      RGUserDialog userDialog;
      userDialog.showErrors();
      exit(1);
   }

   bool UpdateMode = _config->FindB("Volatile::Update-Mode",false);
   bool NonInteractive = _config->FindB("Volatile::Non-Interactive", false);

   // check if there is another application runing and
   // act accordingly
   check_and_aquire_lock();

   // read configuration early
   _roptions->restore();

   SetLanguages();

   // init the static pkgStatus class. this loads the status pixmaps 
   // and colors
   RGPackageStatus::pkgStatus.init();

   RPackageLister *packageLister = new RPackageLister();
   RGMainWindow *mainWindow = new RGMainWindow(packageLister, "main");

   // install a sigusr1 signal handler and put window into 
   // foreground when called. use the io_watch trick because gtk is not
   // reentrant
   // SIGUSR1 handling via pipes  
   if (pipe (sigterm_unix_signal_pipe_fds) != 0) {
      g_warning ("Could not setup pipe, errno=%d", errno);
      return 1;
   }
   sigterm_iochn = g_io_channel_unix_new (sigterm_unix_signal_pipe_fds[0]);
   if (sigterm_iochn == NULL) {
      g_warning("Could not create GIOChannel");
      return 1;
   }
   g_io_add_watch (sigterm_iochn, G_IO_IN, sigterm_iochn_data, mainWindow);
   signal (SIGUSR1, handle_sigusr1);
   // -------------------------------------------------------------

   // read which default distro to use
   string s = _config->Find("Synaptic::DefaultDistro", "");
   if (s != "")
      _config->Set("APT::Default-Release", s);

#ifndef HAVE_RPM
   mainWindow->setTitle(_("Synaptic Package Manager "));
#else
   mainWindow->setTitle(_config->Find("Synaptic::MyName", "Synaptic"));
#endif
   // this is for stuff like "synaptic -t `uname -n`"
   s = _config->Find("Volatile::MyName","");
   if(s.size() > 0)
      mainWindow->setTitle(s);
   
   if(_config->FindB("Volatile::HideMainwindow", false))
      mainWindow->hide();
   else
      mainWindow->show();

   RGFlushInterface();

   mainWindow->setInterfaceLocked(true);

   string cd_mount_point = _config->Find("Volatile::AddCdrom-Mode", "");
   if(!cd_mount_point.empty()) {
      _config->Set("Acquire::cdrom::mount",cd_mount_point);
      _config->Set("APT::CDROM::NoMount", true);
      mainWindow->cbAddCDROM(NULL, mainWindow);
   } else if(_config->FindB("Volatile::AskCdrom-Mode",false)) {
      mainWindow->cbAddCDROM(NULL, mainWindow);
      return 0;
   }

   //no need to open a cache that will invalid after the update
   if(!UpdateMode) {
      mainWindow->setTreeLocked(true);
      if(!packageLister->openCache()) {
	 mainWindow->showErrors();
	 exit(1);
      }
      mainWindow->restoreState();
      mainWindow->showErrors();
      mainWindow->setTreeLocked(false);
   }
   
   if (_config->FindB("Volatile::startInRepositories", false)) {
      mainWindow->cbShowSourcesWindow(NULL, mainWindow);
   }

   // selections from stdin
   if (_config->FindB("Volatile::Set-Selections", false) == true) {
      packageLister->unregisterObserver(mainWindow);
      packageLister->readSelections(cin);
      packageLister->registerObserver(mainWindow);
   }

   // selections from a file
   string selections_filename;
   selections_filename = _config->Find("Volatile::Set-Selections-File", "");
   if (selections_filename != "") {
      packageLister->unregisterObserver(mainWindow);
      ifstream selfile(selections_filename.c_str());
      packageLister->readSelections(selfile);
      selfile.close();
      packageLister->registerObserver(mainWindow);
   }

   mainWindow->setInterfaceLocked(false);

   if(UpdateMode) {
      mainWindow->cbUpdateClicked(NULL, mainWindow);
      mainWindow->setTreeLocked(true);
      if(!packageLister->openCache()) {
	 mainWindow->showErrors();
	 exit(1);
      }
      mainWindow->restoreState();
      mainWindow->setTreeLocked(false);
      mainWindow->showErrors();
      mainWindow->changeView(PACKAGE_VIEW_STATUS, _("Installed (upgradable)"));
   }

   if(_config->FindB("Volatile::TestMeHarder", false))
   {
      _config->Set("Volatile::Non-Interactive","true");
      _config->Set("Synaptic::closeZvt","true");

      while(true)
      {
	 mainWindow->cbUpdateClicked(NULL, mainWindow);
	 mainWindow->changeView(PACKAGE_VIEW_STATUS, _("Installed"));
	 GtkTreePath *p = gtk_tree_path_new_from_string("0");
	 mainWindow->cbPackageListRowActivated(NULL, p, NULL, mainWindow);

	 GObject *o = (GObject*)g_object_new( G_TYPE_OBJECT,NULL);
	 g_object_set_data(o, "me", mainWindow);
	 mainWindow->cbPkgAction(GTK_WIDGET(o), (void*)PKG_REINSTALL);
	 mainWindow->cbProceedClicked(NULL, mainWindow);
      }
   }

   if(_config->FindB("Volatile::Upgrade-Mode",false) 
      || _config->FindB("Volatile::DistUpgrade-Mode",false) ) {
      mainWindow->cbUpgradeClicked(NULL, mainWindow);
      mainWindow->changeView(PACKAGE_VIEW_CUSTOM, _("Marked Changes"));
   }

   if(_config->FindB("Volatile::TaskWindow",false)) {
      mainWindow->cbTasksClicked(NULL, mainWindow);
   }

   string filter = _config->Find("Volatile::initialFilter","");
   if(filter != "")
      mainWindow->changeView(PACKAGE_VIEW_CUSTOM, filter);

   if (NonInteractive) {
      mainWindow->cbProceedClicked(NULL, mainWindow);
   } else {
      welcome_dialog(mainWindow);
      gtk_widget_grab_focus( GTK_WIDGET(gtk_builder_get_object(
                                          mainWindow->getGtkBuilder(),
                                          "entry_fast_search")));
#if 0
      update_check(mainWindow, packageLister);
#endif 
      gtk_main();
   }

   return 0;
}


// vim:sts=4:sw=4