File: callback.c

package info (click to toggle)
jazip 0.34-15
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 536 kB
  • ctags: 208
  • sloc: ansic: 2,632; perl: 343; makefile: 90; sh: 32
file content (129 lines) | stat: -rw-r--r-- 2,312 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
/*
 * jaZip for Linux (c) 1996  Jarrod A. Smith
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation.  No representations are made about the suitability of this
 * software for any purpose.  It is provided "as is" without express or 
 * implied warranty.
 */

#include <forms.h>
#include <mntent.h>
#include "jazip.h"

void file(FL_OBJECT *ob, long data)
{
	int	item;

	switch (item = fl_get_menu (ob)) {
		case FILE_EXIT:
			quit_it (ob, 1);
			break;
	}
	return;
}

void tools(FL_OBJECT *ob, long data)
{
	int	tool;

	switch (tool = fl_get_menu (ob)) {
		case TOOLS_INFO:
			iomega_info (ob, 1);
			break;
		case TOOLS_MOUNT:
			mount_it (ob, 1);
			break;
		case TOOLS_UMOUNT:
			umount_it (ob, 1);
			break;
		case TOOLS_EJECT:
			eject_it (ob, 1);
			break;
		case TOOLS_RO:
			ro_it (ob, 1);
			break;
		case TOOLS_RW:
			rw_it (ob, 1);
			break;
	}
	return;
}

void iomega_info(FL_OBJECT *ob, long data)
{
	int	rs;

	rs = is_mounted (dev);
	if (rs == 1) {
		sprintf (mesg, "Partition %s is mounted on %s as type %s",
		mnt_fsname, mnt_dir, mnt_type);
	} else if (rs == 0) {
		dostatus (dev);
	} else {
		sprintf (mesg, "unable to access %s", MOUNTED);
		show_mesg (ob, mesg);
		return;
	}
	show_mesg (ob, mesg);
}

void mount_it(FL_OBJECT *ob, long data)
{
	if ((is_mounted (dev)) != 0) {
		show_mesg (ob, mesg); 
		return;
	}
	z_mount (dev);
	show_mesg (ob, mesg);
	return;
}

void umount_it(FL_OBJECT *ob, long data)
{
	z_umount (dev);
	show_mesg( ob, mesg );
	return;
}

void eject_it(FL_OBJECT *ob, long data)
{
	if ((is_mounted (dev)) != 0) {
		umount_it(ob, 1);
		if ((is_mounted (dev)) != 0) return;
	}
	if (!z_eject (dev)) {
		show_mesg (ob, mesg);
		return;
	}
}

void ro_it(FL_OBJECT *ob, long data)
{
	if ((is_mounted (dev)) != 0) {
		show_mesg (ob, mesg); 
		return;
	}
	pmode (dev,2);
	show_mesg( ob, mesg );
	return;
}

void rw_it(FL_OBJECT *ob, long data)
{
	if ((is_mounted (dev)) != 0) {
		show_mesg (ob, mesg); 
		return;
	}
	pmode (dev,0);
	show_mesg( ob, mesg );
	return;
}

void quit_it(FL_OBJECT *ob, long data)
{
	exit(0);
}