File: main.c

package info (click to toggle)
plotdrop 0.5.2-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 236 kB
  • ctags: 130
  • sloc: ansic: 1,040; makefile: 63
file content (49 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (3)
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

/* PlotDrop is free software, released under the GNU General Public License
 * See the COPYING file for licensing details.
 *
 * Copyright 2005 John Spray
 */

#include <libgnomevfs/gnome-vfs.h>
#include <glib.h>

#include "droplist.h"
#include "gnuplot.h"


int main(int argc, char **argv)
{
	gtk_set_locale ();
	gtk_init (&argc,&argv);

	gnome_vfs_init ();

	gchar *ver = gnuplot_get_version ();
	if (ver)
		fprintf (stdout, "Found gnuplot version '%s'\n", ver);
	else
		droplist_no_gnuplot ();

	droplist_init_gui ();

	if (argc > 1) {
		gchar *pwd = getcwd (NULL, 0); // g_get_current_dir?

		for (int i = 1; i < argc; ++i) {
			if (argv[i][0] == '/'/*g_path_is_absolute (argv[i])*/) {
				g_message ("filename absolute '%s'", argv[i]);
				droplist_add_file (argv[i]);
			} else {
				gchar *tmp = g_build_filename (pwd, argv[i], NULL);
				g_message ("built filename '%s'", tmp);
				droplist_add_file (tmp);
				g_free (tmp);
			}
		}

		g_free (pwd);
	}

	gtk_main ();
}