aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorJason Woodward2010-06-09 00:24:07 -0400
committerJason Woodward2010-06-09 00:38:39 -0400
commit33eb4afdaaae102ce44232d28c227ba98318d5d3 (patch)
treeceb93c84dbafdac28af7f0063e5e30bb05bdca83 /src/main.c
parent8f196b6232e9f4eba6fe340e25c11af917215d17 (diff)
downloadslapt-get-33eb4afdaaae102ce44232d28c227ba98318d5d3.tar.gz
Updated API, generalizing several types into slapt_list_t
Replaced slapt_pkg_action_args_t, struct slapt_exclude_list, and struct slapt_suggests with slapt_list_t, a generic string list type. Added support functions slapt_parse_delimited_list, slapt_init_list, slapt_add_list_item, slapt_remove_list_item, and slapt_free_list in support of slapt_list_t. Removed now unnecessary slapt_init_exclude_list, slapt_add_exclude, slapt_remove_exclude, slapt_free_exclude_list, slapt_init_pkg_action_args, slapt_add_pkg_action_args, and slapt_free_pkg_action_args. Added convenience function slapt_parse_delimited_list that can generate a slapt_list_t from the exclude list, suggestions, dependencies, and conflicts. This greatly simplified the exclude parsing and dependency parsing.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 6c054f4..6d9e562 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,7 +26,7 @@ extern int optind, opterr, optopt;
int main( int argc, char *argv[] )
{
slapt_rc_config *global_config, *initial_config; /* our config struct */
- slapt_pkg_action_args_t *paa;
+ slapt_list_t *paa;
int c = 0;
enum slapt_action do_action = 0;
@@ -318,13 +318,13 @@ int main( int argc, char *argv[] )
}
break;
case INSTALL:
- paa = slapt_init_pkg_action_args((argc - optind));
+ paa = slapt_init_list();
while (optind < argc) {
- slapt_add_pkg_action_args(paa,argv[optind]);
+ slapt_add_list_item(paa,argv[optind]);
++optind;
}
slapt_pkg_action_install( global_config, paa );
- slapt_free_pkg_action_args(paa);
+ slapt_free_list(paa);
break;
case INSTALL_DISK_SET:
{
@@ -352,28 +352,28 @@ int main( int argc, char *argv[] )
}
- paa = slapt_init_pkg_action_args(set_pkgs->pkg_count);
+ paa = slapt_init_list();
for (set_i = 0; set_i < set_pkgs->pkg_count; ++set_i) {
- slapt_add_pkg_action_args(paa,set_pkgs->pkgs[set_i]->name);
+ slapt_add_list_item(paa,set_pkgs->pkgs[set_i]->name);
}
slapt_free_pkg_list(set_pkgs);
slapt_free_pkg_list(avail_pkgs);
slapt_pkg_action_install( global_config, paa );
- slapt_free_pkg_action_args(paa);
+ slapt_free_list(paa);
}
break;
case REMOVE:
- paa = slapt_init_pkg_action_args((argc - optind));
+ paa = slapt_init_list();
while (optind < argc) {
- slapt_add_pkg_action_args(paa,argv[optind]);
+ slapt_add_list_item(paa,argv[optind]);
++optind;
}
slapt_pkg_action_remove( global_config, paa );
- slapt_free_pkg_action_args(paa);
+ slapt_free_list(paa);
break;
case SHOW:
while (optind < argc) {