aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2008-11-28 06:20:40 +0000
committerJason Woodward2008-11-28 06:20:40 +0000
commitdcbd65be63e7a0c786ef86c42d9505d541cb067d (patch)
tree6c9ebd2fe151b76e70358bf38570ff5d7349636e
parent29707c29a09c1e997f1605f65ec09b92da9efa0b (diff)
downloadslapt-get-dcbd65be63e7a0c786ef86c42d9505d541cb067d.tar.gz
added ability to write priority to slapt_write_rc_config
-rw-r--r--src/configuration.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/configuration.c b/src/configuration.c
index 2aa82a8..7834b6d 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -524,11 +524,28 @@ int slapt_write_rc_config(const slapt_rc_config *global_config, const char *loca
for (i = 0; i < global_config->sources->count;++i) {
slapt_source_t *src = global_config->sources->src[i];
+ SLAPT_PRIORITY_T priority = src->priority;
+ const char *token = SLAPT_SOURCE_TOKEN;
if (global_config->sources->src[i]->disabled == SLAPT_TRUE)
- fprintf(rc,"%s%s\n",SLAPT_DISABLED_SOURCE_TOKEN, src->url);
- else
- fprintf(rc,"%s%s\n",SLAPT_SOURCE_TOKEN, src->url);
+ token = SLAPT_DISABLED_SOURCE_TOKEN;
+
+ if (priority > SLAPT_PRIORITY_DEFAULT) {
+ const char *priority_token;
+
+ if (priority == SLAPT_PRIORITY_PREFERRED)
+ priority_token = SLAPT_PRIORITY_PREFERRED_TOKEN;
+ else if (priority == SLAPT_PRIORITY_OFFICIAL)
+ priority_token = SLAPT_PRIORITY_OFFICIAL_TOKEN;
+ else if (priority == SLAPT_PRIORITY_CUSTOM)
+ priority_token = SLAPT_PRIORITY_CUSTOM_TOKEN;
+ else
+ priority_token = SLAPT_PRIORITY_DEFAULT_TOKEN;
+
+ fprintf(rc,"%s%s:%s\n",token, src->url, priority_token);
+ } else {
+ fprintf(rc,"%s%s\n",token, src->url);
+ }
}
fclose(rc);