Codebase list cdebconf / 565f013
Some more commits for cdebconf update; fixes textdb module, as well as the text/slang/ncurses/bogl frontends added man pages for some of the executables r728 Randolph Chung 21 years ago
20 changed file(s) with 393 addition(s) and 163 deletion(s). Raw diff Collapse all Expand all
1919
2020 distclean: clean
2121 -rm -f config.status config.log config.cache globalmakeflags
22 -rm -f src/makefile src/config.h
22 -rm -f src/Makefile src/config.h man/Makefile
2323
2424 .PHONY: cdebconf clean distclean
1111 Macros are used for various convenience things, and follow the naming convention
1212 of their C++ or perl counterparts.
1313
14 :
14 In general the code follows the following conventions:
1515
16 $Id: coding.txt,v 1.3 2002/07/01 06:58:37 tausq Exp $
16 - variables and functions are lower-case. multi-word identifiers are joined
17 by underbars (like_this).
18 - tabs are 4 spaces. Avoid using ^I
19 - braces are always on a line by itself, and line up with the controlling
20 block construct.
21 - in general, keep things consistent with the surrounding code
22
23 $Id: coding.txt,v 1.4 2002/07/02 06:53:46 tausq Rel $
99 so that new modules (for different frontends and backends) can be "plugged
1010 in" without bloating the basic system.
1111
12 The system consists of the following objects: [see objects.dia]
12 The system consists of the following objects:
1313 * Template - definition of a piece of configuration info
1414 * Question - instantiation of a template -- with answer from the user, etc
1515 * Frontend - UI that interacts with the user to get answers to questions
16 * Database - stores and retrieves template and question data
16 * TemplateDb - database for storing template data
17 * QuestionDb - database for storing configuration data ("questions")
1718 * ConfModule - interface to config script
1819
1920 This closely follows the existing object hierarchy in perl-DebConf, though
2627 [*1] _Configuration Management_, revision 6.2 (draft) by Wichert Akkerman
2728 and Joey Hess
2829
29 $Id: design.txt,v 1.3 2002/07/01 06:58:37 tausq Exp $
30 $Id: design.txt,v 1.4 2002/07/02 06:53:46 tausq Rel $
doc/objects.dia less more
Binary diff not shown
1313 FRONTEND_MODULES=@FRONTEND_MODULES@
1414
1515 CC=@CC@
16 CFLAGS=@CFLAGS@
16 CFLAGS=@CFLAGS@ -I. -I$(srcdir)/src
1717 POD2MAN=@POD2MAN@
1818
1919 %.o: %.c
0 include ../globalmakeflags
1
2 VPATH = $(srcdir)/man
3
4 CENTER=Debconf
5 MANPAGES=dpkg-preconfigure.8 dpkg-reconfigure.8 debconf.7
6
7 all: $(MANPAGES)
8
9 $(MANPAGES):
10 @$(POD2MAN) --section=$(subst .,,$(suffix $@)) --center=$(CENTER) -d$(CENTER) $(srcdir)/man/$(basename $@).pod > $(basename $@).man
0 =head1 NAME
1
2 debconf - run a debconf-using program
3
4 =cut
5
6 =head1 SYNOPSIS
7
8 debconf [options] command [args]
9
10 =head1 DESCRIPTION
11
12 Debconf is a configuration system for Debian packages. For a debconf
13 overview and documentation for sysadmins, see L<debconf(7)>.
14
15 The B<debconf> program runs a program under debconf's control, setting it up
16 to talk with debconf on stdio. The program's output is expected to be debconf
17 protocol commands, and it is expected to read result codes on stdin. See
18 L<debconf-devel(7)> for details about the debconf protocol.
19
20 =head1 OPTIONS
21
22 =over 4
23
24 =item B<-o>I<package>, B<--owner=>I<package>
25
26 Tell debconf what package the command it is running is a part of. This is
27 necessary to get ownership of registered questions right, and to support
28 unregister and purge commands properly.
29
30 =item B<-f>I<type>, B<--frontend=>I<type>
31
32 Select the frontend to use.
33
34 =item B<-p>I<value>, B<--priority=>I<value>
35
36 Specify the minimum priority of question that will be displayed.
37
38 =item B<-s>, B<--showold>
39
40 Redisplay old, already seen questions.
41
42 =back
43
44 =head1 EXAMPLES
45
46 To debug a shell script that uses debconf, you might use:
47
48 DEBCONF_DEBUG=developer debconf my-shell-prog
49
50 Or, you might use this:
51
52 debconf --frontend=readline sh -x my-shell-prog
53
54 =head1 SEE ALSO
55
56 L<debconf-devel(7)>, L<debconf(7)>
57
58 =cut
59
60 =head1 AUTHOR
61
62 Joey Hess <joeyh@debian.org>
63
64 =cut
65
66 =head1 HISTORY
67
68 This manpage was "borrowed" from debconf.
69
70 =cut
71
0 =head1 NAME
1
2 dpkg-preconfigure - let packages ask questions prior to their installation
3
4 =head1 SYNOPSIS
5
6 dpkg-preconfigure [options] package.deb
7
8 dpkg-preconfigure --apt
9
10 =head1 DESCRIPTION
11
12 B<dpkg-preconfigure> lets packages ask questions before they are installed.
13 It operates on a set of debian packages, and all packages that use debconf
14 will have their config script run so they can examine the system and ask
15 questions.
16
17 =head1 OPTIONS
18
19 =over 4
20
21 =item B<-f>I<type>, B<--frontend=>I<type>
22
23 Select the frontend to use.
24
25 =item B<-p>I<value>, B<--priority=>I<value>
26
27 Set the lowest priority of questions you are interested in. Any questions
28 with a priority below the selected priority will be ignored and their
29 default answers will be used.
30
31 =item B<--apt>
32
33 Run in apt mode. It will expect to read a set of package filenames from
34 stdin, rather than getting them as parameters. Typically this is used to
35 make apt run dpkg-preconfigure on all packages before they are installed.
36 To do this, add something like this to /etc/apt/apt.conf:
37
38 // Pre-configure all packages before
39 // they are installed.
40 DPkg::Pre-Install-Pkgs {
41 "dpkg-preconfigure --apt --priority=low";
42 };
43
44 =item B<-h>, B<--help>
45
46 Display usage help.
47
48 =back
49
50 =cut
51
52 =head1 SEE ALSO
53
54 L<debconf(7)>
55
56 =cut
57
58 =head1 AUTHOR
59
60 Joey Hess <joeyh@debian.org>
61
62 =cut
63
64 =head1 HISTORY
65
66 This manpage was "borrowed" from debconf.
67
68 =cut
69
0 =head1 NAME
1
2 dpkg-reconfigure - reconfigure an already installed package
3
4 =head1 SYNOPSIS
5
6 dpkg-reconfigure [options] packages
7
8 =head1 DESCRIPTION
9
10 B<dpkg-reconfigure> reconfigures packages after they have already been
11 installed. Pass it the names of a package or packages to reconfigure.
12
13 This has the same effect as re-installing the package, basically. I hope
14 one day this will be called by dpkg --reconfigure
15
16 =head1 OPTIONS
17
18 =over 4
19
20 =item B<-f>I<type>, B<--frontend=>I<type>
21
22 Select the frontend to use. The default frontend can be permanently changed
23 by:
24
25 dpkg-reconfigure debconf
26
27 Note that if you normally have debconf set to use the noninteractive
28 frontend, dpkg-reconfigure will use the dialog frontend instead, so you
29 actually get to reconfigure the package.
30
31 =item B<-p>I<value>, B<--priority=>I<value>
32
33 Specify the minimum priority of question that will be displayed.
34 dpkg-reconfigure normally shows low priority questions no matter what your
35 default priority is.
36
37 =item B<--all>
38
39 Reconfigure all installed packages that use debconf. Warning: this may take
40 a long time.
41
42 =item B<-u>, B<--unseen-only>
43
44 By default, all questions are shown, even if they have already been
45 answered. If this parameter is set though, only questions that have not yet
46 been seen will be asked.
47
48 =item B<--force>
49
50 Force dpkg-reconfigure to reconfigure a package even if the package is in an
51 inconsistent or broken state. Use with caution.
52
53 =item B<-h>, B<--help>
54
55 Display usage help.
56
57 =back
58
59 =cut
60
61 =head1 SEE ALSO
62
63 L<debconf(7)>
64
65 =cut
66
67 =head1 AUTHOR
68
69 Joey Hess <joeyh@debian.org>
70
71 =cut
72
73 =head1 HISTORY
74
75 This manpage was "borrowed" from debconf.
76
77 =cut
78
00 include ../globalmakeflags
11
2 VPATH = $(srcdir)/src
2 vpath *.c $(srcdir)/src
3 vpath *.h $(srcdir)/src
34
45 MAJOR=0
56 MINOR=1
5353 path "/var/cache/debconf/config.dat";
5454 };
5555
56 instance "to_db" {
56 instance "to_db2" {
5757 driver "rfc822db";
5858 path "/tmp/test.dat";
5959 };
60
61 instance "to_db" {
62 driver "textdb";
63 path "/tmp/questions";
64 };
6065 };
6166
00 #ifndef _DATABASE_H_
11 #define _DATABASE_H_
22
3 /**
4 * \file database.h
5 * \brief Definitions of question_db and template_db objects
6 */
7
8 /**
9 * \def DEBCONF_MAX_CONFIGPATH_LEN
10 * \brief maximum length of a configuration path to a database config
11 */
312 #define DEBCONF_MAX_CONFIGPATH_LEN 128
413
514 /* Debconf database interfaces */
1019 struct question;
1120 struct question_db;
1221
22 /**
23 * Methods for a template database module
24 */
1325 struct template_db_module {
1426 int (*initialize)(struct template_db *db, struct configuration *cfg);
1527 int (*shutdown)(struct template_db *db);
2335 struct template *(*iterate)(struct template_db *db, void **iter);
2436 };
2537
38 /**
39 * Methods for a question database module
40 */
2641 struct question_db_module {
2742 int (*initialize)(struct question_db *db, struct configuration *cfg);
2843 int (*shutdown)(struct question_db *db);
+0
-60
src/makefile.in less more
0 include ../globalmakeflags
1
2 MAJOR=0
3 MINOR=1
4 MICRO=0
5 LDFLAGS=-L. -ldebconf @RPATH@
6 LIB=libdebconf.so
7 LIBNAME=libdebconf.so.$(MAJOR).$(MINOR).$(MICRO)
8 SONAME=libdebconf.so.$(MAJOR).$(MINOR)
9 DEBCONF=debconf
10 TOOLS=debconf-loadtemplate debconf-convertdb dpkg-reconfigure
11 BIN=$(DEBCONF) $(TOOLS)
12
13 LIBOBJS=commands.opic configuration.opic confmodule.opic debug.opic \
14 database.opic debconfclient.opic frontend.opic priority.opic \
15 strutl.opic question.opic template.opic
16
17 all: $(BIN) $(LIB) $(SONAME)
18 @$(MAKE) -C modules $@
19
20 $(BIN): $(LIB) $(addsuffix .o,$(BIN))
21 @for bin in $(BIN); do \
22 echo Compiling tool $$bin; \
23 $(CC) $(CFLAGS) -o $$bin $$bin.o $(LDFLAGS); \
24 done
25
26 $(LIBNAME): $(LIBOBJS)
27 @echo Creating shared library $@
28 @$(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ -ldl
29
30 $(SONAME) $(LIB): $(LIBNAME)
31 -@ln -sf $^ $@
32
33 install:
34 install -d -m 755 ${bindir}
35 install -d -m 755 ${sbindir}
36 install -d -m 755 ${etcdir}
37 install -d -m 755 ${libdir}
38 install -d -m 755 ${moddir}
39 install -d -m 755 ${sharedir}
40 install -m 755 debconf debconf-loadtemplate ${bindir}
41 install -m 755 dpkg-reconfigure ${sbindir}
42 install -m 755 $(LIBNAME) ${libdir}
43 ln -sf $(LIBNAME) ${libdir}/$(SONAME)
44 ln -sf $(LIBNAME) ${libdir}/$(LIB)
45 install -m 644 cdebconf.conf-dist ${etcdir}/cdebconf.conf
46 install -m 644 client/confmodule ${sharedir}
47 ln -sf ../../bin/$(DEBCONF) ${sharedir}/frontend
48 ifneq ($(TARGET),udeb)
49 install -m 755 debconf debconf-convertdb ${bindir}
50 install -d -m 755 ${incdir}
51 install -m 644 *.h ${incdir}
52 endif
53 @$(MAKE) -C modules $@
54
55 clean:
56 -@rm -f $(BIN) $(LIB) $(LIBNAME) $(SONAME) *~ *.o *.opic
57 @$(MAKE) -C modules clean
58
59 .PHONY: clean lib
0 include ../../globalmakeflags
1
02 SUBDIRS=db frontend
13
24 all install clean: $(addsuffix /Makefile,$(SUBDIRS))
88 #include <dirent.h>
99 #include <stdio.h>
1010 #include <string.h>
11 #include <unistd.h>
1112 #include <sys/types.h>
13 #include <sys/stat.h>
1214
1315 static void translate_tag_name(char *buf)
1416 {
1820 if (*t == '/') *t = ':'; /* : is illegal in templates etc */
1921 }
2022
21 static char *template_filename(struct configuration *cfg, const char *tag)
23 static char *template_filename(struct template_db *db, const char *tag)
2224 {
2325 static char filename[1024];
26 static char tmp[1024];
2427 char tagname[1024];
2528 filename[0] = 0;
2629
2730 strncpy(tagname, tag, sizeof(tagname));
2831 translate_tag_name(tagname);
2932
33 snprintf(tmp, sizeof(tmp), "%s::path", db->configpath);
34
3035 snprintf(filename, sizeof(filename), "%s/%s",
31 cfg->get(cfg, "database::driver::textdb::templatepath",
32 TEXTDB_TEMPLATE_PATH), tagname);
36 db->config->get(db->config, tmp, ""), tagname);
3337
3438 return filename;
3539 }
3640
37 static char *question_filename(struct configuration *cfg, const char *tag)
41 static char *question_filename(struct question_db *db, const char *tag)
3842 {
3943 static char filename[1024];
44 static char tmp[1024];
4045 char tagname[1024];
46
4147 filename[0] = 0;
4248
4349 strncpy(tagname, tag, sizeof(tagname));
4450 translate_tag_name(tagname);
4551
52 snprintf(tmp, sizeof(tmp), "%s::path", db->configpath);
53
4654 snprintf(filename, sizeof(filename), "%s/%s",
47 cfg->get(cfg, "database::driver::textdb::questionpath",
48 TEXTDB_QUESTION_PATH), tagname);
55 db->config->get(db->config, tmp, "."), tagname);
4956
5057 return filename;
5158 }
6875 }
6976
7077 static struct template *textdb_lookup_cached_template(
71 const struct database *db, const char *tag)
72 {
73 struct db_cache *dbdata = db->data;
78 const struct template_db *db, const char *tag)
79 {
80 struct template_db_cache *dbdata = db->data;
7481 struct template *result;
7582 for (result = dbdata->templates; result; result = result->next)
7683 {
7986 return result;
8087 }
8188
82 static void textdb_remove_cached_template(struct database *db,
89 static void textdb_remove_cached_template(struct template_db *db,
8390 const char *tag)
8491 {
85 struct db_cache *dbdata = db->data;
92 struct template_db_cache *dbdata = db->data;
8693 struct template **result;
8794 for (result = &dbdata->templates; *result; result = &(*result)->next)
8895 {
98105 static struct question *textdb_lookup_cached_question(
99106 const struct database *db, const char *tag)
100107 {
101 struct db_cache *dbdata = db->data;
108 struct question_db_cache *dbdata = db->data;
102109 struct question *result;
103110 for (result = dbdata->questions; result; result = result->next)
104111 {
108115 }
109116 */
110117
111 static int textdb_initialize(struct database *db, struct configuration *cfg)
112 {
113 struct db_cache *dbdata;
114 dbdata = malloc(sizeof(struct db_cache));
118 static int textdb_template_initialize(struct template_db *db, struct configuration *cfg)
119 {
120 struct template_db_cache *dbdata;
121 dbdata = malloc(sizeof(struct template_db_cache));
115122
116123 if (dbdata == NULL)
117124 return DC_NOTOK;
118125
119 dbdata->questions = NULL;
120126 dbdata->templates = NULL;
121127 db->data = dbdata;
122128
123129 return DC_OK;
124130 }
125131
126 static int textdb_load(struct database *db)
127 {
128 return DC_OK;
129 }
130
131 static int textdb_save(struct database *db)
132 {
133 return DC_OK;
134 }
135
136 static int textdb_template_set(struct database *db, struct template *t)
132 static int textdb_template_set(struct template_db *db, struct template *t)
137133 {
138134 FILE *outf;
139135 char *filename;
140136 struct language_description *langdesc;
141137
142138 if (t->tag == NULL) return DC_NOTOK;
143 filename = template_filename(db->config, t->tag);
139 filename = template_filename(db, t->tag);
144140
145141 if ((outf = fopen(filename, "w")) == NULL)
146142 return DC_NOTOK;
177173 return DC_OK;
178174 }
179175
180 static struct template *textdb_template_get_real(struct database *db,
176 static struct template *textdb_template_get_real(struct template_db *db,
181177 const char *ltag)
182178 {
183179 struct configuration *rec;
187183 const char *tmp;
188184
189185 if (ltag == NULL) return DC_NOTOK;
190 filename = template_filename(db->config, ltag);
186 filename = template_filename(db, ltag);
191187
192188 rec = config_new();
193189 if (rec->read(rec, filename) != DC_OK)
249245 return t;
250246 }
251247
252 static struct template *textdb_template_get(struct database *db,
248 static struct template *textdb_template_get(struct template_db *db,
253249 const char *ltag)
254250 {
255251 struct template *result;
257253 result = textdb_lookup_cached_template(db, ltag);
258254 if (!result && (result = textdb_template_get_real(db, ltag)))
259255 {
260 struct db_cache *dbdata = db->data;
256 struct template_db_cache *dbdata = db->data;
261257 result->next = dbdata->templates;
262258 dbdata->templates = result;
263259 }
265261 return result;
266262 }
267263
268 static int textdb_template_remove(struct database *db, const char *tag)
264 static int textdb_template_remove(struct template_db *db, const char *tag)
269265 {
270266 char *filename;
271267
273269
274270 textdb_remove_cached_template(db, tag);
275271
276 filename = template_filename(db->config, tag);
272 filename = template_filename(db, tag);
277273 if (unlink(filename) == 0)
278274 return DC_OK;
279275 else
280276 return DC_NOTOK;
281277 }
282278
283 static struct template *textdb_template_iterate(struct database *db,
279 static struct template *textdb_template_iterate(struct template_db *db,
284280 void **iter)
285281 {
286282 DIR *dir;
287283 struct dirent *ent;
284 char tmp[1024];
288285
289286 if (*iter == NULL)
290287 {
291 dir = opendir(db->config->get(db->config,
292 "database::driver::textdb::templatepath",
293 TEXTDB_TEMPLATE_PATH));
288 snprintf(tmp, sizeof(tmp), "%s::path", db->configpath);
289 dir = opendir(db->config->get(db->config, tmp, ""));
294290 if (dir == NULL)
295291 return NULL;
296292 *iter = dir;
309305 return textdb_template_get(db, ent->d_name);
310306 }
311307
312 static int textdb_question_set(struct database *db, struct question *q)
308 static int textdb_question_initialize(struct question_db *db, struct configuration *cfg)
309 {
310 struct question_db_cache *dbdata;
311 dbdata = malloc(sizeof(struct question_db_cache));
312
313 if (dbdata == NULL)
314 return DC_NOTOK;
315
316 dbdata->questions = NULL;
317 db->data = dbdata;
318
319 return DC_OK;
320 }
321
322 static int textdb_question_set(struct question_db *db, struct question *q)
313323 {
314324 FILE *outf;
315325 char *filename;
317327 struct questionowner *owner;
318328
319329 if (q->tag == NULL) return DC_NOTOK;
320 filename = question_filename(db->config, q->tag);
330 filename = question_filename(db, q->tag);
321331
322332 if ((outf = fopen(filename, "w")) == NULL)
323333 return DC_NOTOK;
355365 return DC_OK;
356366 }
357367
358 static struct question *textdb_question_get(struct database *db,
368 static struct question *textdb_question_get(struct question_db *db,
359369 const char *ltag)
360370 {
361371 struct configuration *rec;
364374 struct configitem *node;
365375
366376 if (ltag == NULL) return DC_NOTOK;
367 filename = question_filename(db->config, ltag);
377 filename = question_filename(db, ltag);
378
379 INFO(INFO_DEBUG, "%s: filename = [%s]\n", __FILE__, filename);
368380
369381 rec = config_new();
370382 if (rec->read(rec, filename) != DC_OK)
379391 q->value = STRDUP(unescapestr(rec->get(rec, "question::value", 0)));
380392 q->defaultval = STRDUP(unescapestr(rec->get(rec, "question::default", 0)));
381393 q->flags = rec->geti(rec, "question::flags", 0);
382 q->template = textdb_template_get(db,
383 unescapestr(rec->get(rec, "question::template", 0)));
394 q->template = db->tdb->methods.get(db->tdb,
395 unescapestr(rec->get(rec, "question::template", "")));
384396
385397 /* TODO: variables and owners */
386398 if ((node = rec->tree(rec, "question::variables")) != 0)
398410 question_owner_add(q, node->tag);
399411 }
400412
413 INFO(INFO_DEBUG, "Read q = %s\n", q->tag);
414
401415 if (q->tag == 0 || q->value == 0 || q->template == 0)
402416 {
403417 question_deref(q);
409423 return q;
410424 }
411425
412 static int textdb_question_disown(struct database *db, const char *tag,
426 static int textdb_question_disown(struct question_db *db, const char *tag,
413427 const char *owner)
414428 {
415429 struct question *q = textdb_question_get(db, tag);
420434 return DC_OK;
421435 }
422436
423 static struct question *textdb_question_iterate(struct database *db,
437 static struct question *textdb_question_iterate(struct question_db *db,
424438 void **iter)
425439 {
426440 DIR *dir;
427441 struct dirent *ent;
442 static const char *path = "";
443 char tmp[1024];
444 int ret;
445 struct stat st;
428446
429447 if (*iter == NULL)
430448 {
431 dir = opendir(db->config->get(db->config,
432 "database::driver::textdb::questionpath",
433 TEXTDB_QUESTION_PATH));
449 snprintf(tmp, sizeof(tmp), "%s::path", db->configpath);
450 path = db->config->get(db->config, tmp, ".");
451 INFO(INFO_VERBOSE, "Checking %s -> %s\n", tmp, path);
452
453 dir = opendir(path);
434454 if (dir == NULL)
435455 return NULL;
436456 *iter = dir;
440460 dir = (DIR *)*iter;
441461 }
442462
443 if ((ent = readdir(dir)) == NULL)
444 {
445 closedir(dir);
446 return NULL;
447 }
448
463 do {
464 if ((ent = readdir(dir)) == NULL)
465 {
466 INFO(INFO_DEBUG, "readdir returned NULL\n");
467 closedir(dir);
468 return NULL;
469 }
470
471 snprintf(tmp, sizeof(tmp), "%s/%s", path, ent->d_name);
472 ret = stat(tmp, &st);
473 } while (ret < 0 || S_ISDIR(st.st_mode));
474
475 INFO(INFO_DEBUG, "Getting %s\n", ent->d_name);
449476 return textdb_question_get(db, ent->d_name);
450477 }
451478
452 struct database_module debconf_database_module =
453 {
454 initialize: textdb_initialize,
455 load: textdb_load,
456 save: textdb_save,
457
458 template_set: textdb_template_set,
459 template_get: textdb_template_get,
460 template_remove: textdb_template_remove,
461 template_iterate: textdb_template_iterate,
462
463 question_get: textdb_question_get,
464 question_set: textdb_question_set,
465 question_disown: textdb_question_disown,
466 question_iterate: textdb_question_iterate
479 struct template_db_module debconf_template_db_module = {
480 initialize: textdb_template_initialize,
481 set: textdb_template_set,
482 get: textdb_template_get,
483 remove: textdb_template_remove,
484 iterate: textdb_template_iterate,
467485 };
486
487 struct question_db_module debconf_question_db_module = {
488 initialize: textdb_question_initialize,
489 set: textdb_question_set,
490 get: textdb_question_get,
491 disown: textdb_question_disown,
492 iterate: textdb_question_iterate,
493 };
494
00 #ifndef _TEXTDB_H_
11 #define _TEXTDB_H_
2
3 #define TEXTDB_TEMPLATE_PATH "./templates"
4 #define TEXTDB_QUESTION_PATH "./questions"
52
63 struct template;
74 struct question;
85
9 struct db_cache {
6 struct template_db_cache {
107 struct template *templates;
8 };
9
10 struct question_db_cache {
1111 struct question *questions;
1212 };
1313
4848 /* FIXME: Needs disabled button widget. */
4949 static void drawnavbuttons(struct frontend *ui, struct question *q)
5050 {
51 if(ui->cangoback(ui, q))
51 if(ui->methods.can_go_back(ui, q))
5252 bowl_new_button(_("Previous"), DC_GOBACK);
53 if(ui->cangoforward(ui, q))
53 if(ui->methods.can_go_forward(ui, q))
5454 bowl_new_button(_("Next"), DC_OK);
5555 }
5656
8686 drawdesctop(ui, q);
8787
8888 /* Should be: bowl_new_radio(); drawnavbuttons(ui, q); */
89 if(ui->cangoback(ui, q))
89 if(ui->methods.can_go_back(ui, q))
9090 bowl_new_button(_("Previous"), 0);
9191 bowl_new_button(_("Yes"), 1);
9292 bowl_new_button(_("No"), 2);
232232 ret = DC_OK;
233233 (*handler(q->template->type))(ui, q);
234234 if(ret == DC_OK)
235 ui->db->question_set(ui->db, q);
235 ui->qdb->methods.set(ui->qdb, q);
236236 else
237237 return ret;
238238
7070 mvwaddch(w, y, x, ' ');
7171 }
7272
73 static int cangoback(struct frontend *ui)
73 static int can_go_back(struct frontend *ui)
7474 {
7575 return 1;
7676 }
7777
78 static int cangoforward(struct frontend *ui)
78 static int can_go_forward(struct frontend *ui)
7979 {
8080 return 1;
8181 }
200200 /* draw the actual buttons, note that these are drawn in the
201201 * query window instead of in the parent (like the frame) */
202202
203 if (cangoback(ui))
203 if (can_go_back(ui))
204204 {
205205 if (selected == 0) wstandout(win); else wstandend(win);
206206 mvwprintw(win, ybut-1, 2, "<Previous>");
207207 }
208208
209 if (cangoforward(ui))
209 if (can_go_forward(ui))
210210 {
211211 if (selected == 1) wstandout(win); else wstandend(win);
212212 mvwprintw(win, ybut-1, COLS-10, "<Next>");
280280 switch (pos)
281281 {
282282 case 0:
283 if (cangoback(ui))
283 if (can_go_back(ui))
284284 ret = DC_GOBACK;
285285 /* go to previous if possible */
286286 break;
330330 switch (pos)
331331 {
332332 case 0:
333 if (cangoback(ui))
333 if (can_go_back(ui))
334334 ret = DC_GOBACK;
335335 /* go to previous if possible */
336336 break;
420420 switch (pos)
421421 {
422422 case 0:
423 if (cangoback(ui))
423 if (can_go_back(ui))
424424 ret = DC_GOBACK;
425425 /* go to previous if possible */
426426 break;
520520 switch (ret)
521521 {
522522 case DC_OK:
523 obj->db->question_set(obj->db, q);
523 obj->qdb->methods.set(obj->qdb, q);
524524 break;
525525 case DC_GOBACK:
526526 if (qlast != 0)
66 *
77 * Description: SLang-based cdebconf UI module
88 *
9 * $Id: slang.c,v 1.9 2002/07/01 06:58:38 tausq Exp $
9 * $Id: slang.c,v 1.10 2002/07/02 06:53:47 tausq Exp $
1010 *
1111 * cdebconf is (c) 2000-2001 Randolph Chung and others under the following
1212 * license.
272272 *
273273 * draws the navigation buttons (previous, next) onto the screen
274274 *
275 * TODO: if cangoback/forward is false, draw the buttons in a "disabled"
275 * TODO: if can_go_back/forward is false, draw the buttons in a "disabled"
276276 * color
277277 */
278278 static void slang_navbuttons(struct frontend *ui, struct question *q,
295295 /* draw the actual buttons, note that these are drawn in the
296296 * query window instead of in the parent (like the frame) */
297297
298 if (ui->cangoback(ui, q))
298 if (ui->methods.can_go_back(ui, q))
299299 {
300300 slang_printf(ybut - 1, 2, (selected == 0 ? win->selectedcolor :
301301 win->drawcolor), _(" <Previous> "));
302302 }
303303
304 if (ui->cangoforward(ui, q))
304 if (ui->methods.can_go_forward(ui, q))
305305 {
306306 slang_printf(ybut - 1, COLS-10, (selected == 1 ?
307307 win->selectedcolor : win->drawcolor), _(" <Next> "));
682682 switch (ret)
683683 {
684684 case DC_OK:
685 obj->db->question_set(obj->db, q);
685 obj->qdb->methods.set(obj->qdb, q);
686686 break;
687687 case DC_GOBACK:
688688 if (q->prev != NULL)
99 * friendly implementation. I've taken care to make the prompts work well
1010 * with screen readers and the like.
1111 *
12 * $Id: text.c,v 1.10 2002/07/01 06:58:38 tausq Exp $
12 * $Id: text.c,v 1.11 2002/07/02 06:53:47 tausq Exp $
1313 *
1414 * cdebconf is (c) 2000-2001 Randolph Chung and others under the following
1515 * license.
446446 texthandler_displaydesc(obj, q);
447447 ret = question_handlers[i].handler(obj, q);
448448 if (ret == DC_OK)
449 obj->db->question_set(obj->db, q);
449 obj->qdb->methods.set(obj->qdb, q);
450450 else
451451 return ret;
452452 break;