aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2005-02-21 00:10:08 +0000
committerJason Woodward2005-02-21 00:10:08 +0000
commita41b7c82a4600cb353c85ab87b627e3996a634cb (patch)
tree755db0cf6486487d3f841cf80def2a564d9bbfc8
parent678a60b86186172562d23dbf4e9d502a8a95eca7 (diff)
downloadslapt-get-a41b7c82a4600cb353c85ab87b627e3996a634cb.tar.gz
configuration sources now dynamically created instead of static arrays
-rw-r--r--ChangeLog1
-rw-r--r--po/cs.po12
-rw-r--r--po/de.po12
-rw-r--r--po/el.po12
-rw-r--r--po/en.po12
-rw-r--r--po/es.po12
-rw-r--r--po/es_ES.po12
-rw-r--r--po/fr.po12
-rw-r--r--po/it.po12
-rw-r--r--po/nl.po12
-rw-r--r--po/no.po12
-rw-r--r--po/pl.po12
-rw-r--r--po/pt_BR.po12
-rw-r--r--po/pt_PT.po12
-rw-r--r--po/slapt-get.pot12
-rw-r--r--po/sv.po12
-rw-r--r--po/vi.po12
-rw-r--r--src/configuration.c84
-rw-r--r--src/configuration.h9
-rw-r--r--src/package.c30
20 files changed, 100 insertions, 216 deletions
diff --git a/ChangeLog b/ChangeLog
index dc7f6f4..aa52d0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
0.9.9i Feb 20, 2005
+ * configuration sources now dynamically created instead of static arrays
* --search return installed packages as well
* progress_cb for the progress callback is now part of rc_config structure (libslapt)
* added public add_exclude() to configuration.c (libslapt)
diff --git a/po/cs.po b/po/cs.po
index 96698bb..7f371f3 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Oto Petrik <oto.petrik@centrum.cz>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Nepodailo se alokovat(malloc)\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Maximln poet zdroj (%d) pekroen.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Maximln dlka zdroje (%d) pekroena.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "WORKINGDIR nen nastaven uvnit %s.\n"
diff --git a/po/de.po b/po/de.po
index 5df7085..c09ca6e 100644
--- a/po/de.po
+++ b/po/de.po
@@ -5,9 +5,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Niklas Volbers <mithrandir42@web.de>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -105,14 +105,6 @@ msgid "Failed to malloc\n"
msgstr "Fehler bei malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Maximale Anzahl der Quellen (%d) berschritten.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Maximale Lnge der Quelle (%d) berschritten.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "WORKINGDIR Anweisung (Arbeitsverzeichnis) ist nicht gegeben in %s.\n"
diff --git a/po/el.po b/po/el.po
index ebc0080..d9d9a87 100644
--- a/po/el.po
+++ b/po/el.po
@@ -5,9 +5,9 @@
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Savvas Eftratiadis <pigouinos@mailworks.org.\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -105,14 +105,6 @@ msgid "Failed to malloc\n"
msgstr " malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr " (%d) .\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr " (%d) .\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr " WORKINGDIR %s.\n"
diff --git a/po/en.po b/po/en.po
index 2d585b7..21804ad 100644
--- a/po/en.po
+++ b/po/en.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Jason Woodward <woodwardj@jaos.org>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Failed to malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Maximum number of sources (%d) exceeded.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Maximum length of source (%d) exceeded.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "WORKINGDIR directive not set within %s.\n"
diff --git a/po/es.po b/po/es.po
index af10c9f..042049d 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Ruben Gutierrez <ruben@snpp.com.ar>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Fall el malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Se ha excedido el nmero mximo de fuentes (%d).\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Se ha excedido el tamao mximo para la fuente (%d).\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "La directiva WORKINGDIR no est definida dentro de %s.\n"
diff --git a/po/es_ES.po b/po/es_ES.po
index 6442d67..5b648e9 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Ruben Gutierrez <ruben@snpp.com.ar>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "No se pudo hacer 'malloc'\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Se ha excedido el nmero mximo de fuentes (%d).\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Se ha excedido el tamao mximo para la fuente (%d).\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "La directiva WORKINGDIR no est definida dentro de %s.\n"
diff --git a/po/fr.po b/po/fr.po
index a3b33c9..d6982f1 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Jason Woodward <woodwardj@jaos.org>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "chou au malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr ""
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr ""
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr ""
diff --git a/po/it.po b/po/it.po
index e07f7bf..80c42c5 100644
--- a/po/it.po
+++ b/po/it.po
@@ -6,9 +6,9 @@
#,fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Francesco Gigli <jaramir@slack.it>\n"
"Language-Team: Italian <tp@lists.linux.it>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Errore in malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Massimale di sorgenti (%d) oltrepassato.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Massimale di lunghezza della sorgente (%d) oltrepassato.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "Direttiva WORKINGDIR non impostata in %s.\n"
diff --git a/po/nl.po b/po/nl.po
index e4aa947..7a49f9b 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Jason Woodward <woodwardj@jaos.org>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Kon niet malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Maximaal aantal bronnen (%d) overschreven.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Maximale lengte van bron (%d) overschreden.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "WORKINGDIR directive niet gezet binnen %s.\n"
diff --git a/po/no.po b/po/no.po
index 606633f..11a4591 100644
--- a/po/no.po
+++ b/po/no.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Joran Kvalvaag <jk@nerdworks.org>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Feilet ved malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Maksimalt antall kilder (%d) overskredet.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Maksimal lengde p kilde (%d) overskredet.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "WORKINGDIR direktiv ikke satt i %s.\n"
diff --git a/po/pl.po b/po/pl.po
index 0b6b430..ccbf9ed 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translators: Sajmon <sajmon@tenboard.com>, Paul Blazejowski <paulb@blazebox.homeip.net>, nixon <nixon@klub.chip.pl> and simon <ssiimm@poczta.onet.pl>\n"
"Language-Team: polish <slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -107,14 +107,6 @@ msgid "Failed to malloc\n"
msgstr "Nie powiodo si malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Przekroczono limit (%d) rde.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Przekroczono maksymaln dugo rda (%d)\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "dyrektywa WORKINGDIR nie jest ustawiona wewntrz %s.\n"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index ca2ff04..5790ca9 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Henrique Pinto <henrique.pinto@kdemail.net>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -105,14 +105,6 @@ msgid "Failed to malloc\n"
msgstr "malloc falhou\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Numero mximo de fontes (%d) excedido.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Tamanho mximo do fonte (%d) excedido.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "Diretiva WORKINGDIR no configurada em %s.\n"
diff --git a/po/pt_PT.po b/po/pt_PT.po
index f4f2948..6111817 100644
--- a/po/pt_PT.po
+++ b/po/pt_PT.po
@@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Miguel Santinho <msantinho@simplicidade.com>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -105,14 +105,6 @@ msgid "Failed to malloc\n"
msgstr "malloc falhou\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Numero mximo de fontes (%d) excedido.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Tamanho mximo da fonte (%d) excedido.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "Directiva WORKINGDIR no configurada em %s.\n"
diff --git a/po/slapt-get.pot b/po/slapt-get.pot
index 0f8079a..24d4ce9 100644
--- a/po/slapt-get.pot
+++ b/po/slapt-get.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Jason Woodward <woodwardj@jaos.org>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr ""
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr ""
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr ""
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr ""
diff --git a/po/sv.po b/po/sv.po
index 136fcb9..f761969 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Joel Bjurman <ypolt@lediga.st>\n"
"Language-Team: slapt-get-devel <slapt-get-devel@software.jaos.org>\n"
"MIME-Version: 1.0\n"
@@ -106,14 +106,6 @@ msgid "Failed to malloc\n"
msgstr "Misslyckades med minnesallokering malloc\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Maximalt antal kllor (%d) verskridet.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Maximal lngd p kllan (%d) verskridet.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "WORKINGDIR direktivet ej satt inom %s.\n"
diff --git a/po/vi.po b/po/vi.po
index 1e2904d..d9d3805 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: 0.9.9g\n"
+"Project-Id-Version: 0.9.9i\n"
"POT-Creation-Date: 2003-11-03 14:28+0000\n"
-"PO-Revision-Date: 2005-01-28 09:55+0500\n"
+"PO-Revision-Date: 2005-02-20 19:06+0500\n"
"Last-Translator: Nguyễn Văn Vũ <vncasper@yahoo.com>\n"
"Language-Team: gnome-vi <gnomevi-list@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
@@ -105,14 +105,6 @@ msgid "Failed to malloc\n"
msgstr "Bị lỗi khi cấp phát\n"
#, c-format
-msgid "Maximum number of sources (%d) exceeded.\n"
-msgstr "Số lượng nguồn tối đa (%d) được phép vượt trội.\n"
-
-#, c-format
-msgid "Maximum length of source (%d) exceeded.\n"
-msgstr "Chiều dài nguồn tối đa (%d) được phép vượt trội.\n"
-
-#, c-format
msgid "WORKINGDIR directive not set within %s.\n"
msgstr "Chỉ thị WORKINGDIR không được xác lập bên trong %s.\n"
diff --git a/src/configuration.c b/src/configuration.c
index bb45122..35caec3 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -30,7 +30,6 @@ rc_config *read_rc_config(const char *file_name){
global_config = slapt_malloc( sizeof *global_config );
/* initialize */
- global_config->sources.count = FALSE;
global_config->download_only = FALSE;
global_config->simulate = FALSE;
global_config->ignore_excludes = FALSE;
@@ -46,6 +45,9 @@ rc_config *read_rc_config(const char *file_name){
global_config->working_dir[0] = '\0';
global_config->remove_obsolete = FALSE;
global_config->progress_cb = NULL;
+ global_config->sources = slapt_malloc(sizeof *global_config->sources );
+ global_config->sources->url = slapt_malloc(sizeof *global_config->sources->url );
+ global_config->sources->count = 0;
rc = open_file(file_name,"r");
if( rc == NULL ) exit(1);
@@ -62,37 +64,8 @@ rc_config *read_rc_config(const char *file_name){
if( strstr(getline_buffer,SOURCE_TOKEN) != NULL ){ /* SOURCE URL */
- /* make sure we stay within the limits of MAX_SOURCES */
- if( global_config->sources.count == MAX_SOURCES ){
- fprintf(stderr,_("Maximum number of sources (%d) exceeded.\n"),MAX_SOURCES);
- continue;
- }
-
- if( strlen(getline_buffer) > strlen(SOURCE_TOKEN) ){
- if( (strlen(getline_buffer) - strlen(SOURCE_TOKEN)) >= MAX_SOURCE_URL_LEN ){
- fprintf(stderr,_("Maximum length of source (%d) exceeded.\n"),MAX_SOURCE_URL_LEN);
- continue;
- }
- strncpy(
- global_config->sources.url[global_config->sources.count],
- getline_buffer + strlen(SOURCE_TOKEN),
- (strlen(getline_buffer) - strlen(SOURCE_TOKEN))
- );
- global_config->sources.url[global_config->sources.count][
- (strlen(getline_buffer) - strlen(SOURCE_TOKEN))
- ] = '\0';
-
- /* make sure our url has a trailing '/' */
- if( global_config->sources.url[global_config->sources.count]
- [
- strlen(global_config->sources.url[global_config->sources.count]) - 1
- ] != '/'
- ){
- strcat(global_config->sources.url[global_config->sources.count],"/");
- }
- ++global_config->sources.count;
-
- }
+ if( strlen(getline_buffer) > strlen(SOURCE_TOKEN) )
+ add_source(global_config->sources,getline_buffer + strlen(SOURCE_TOKEN));
} else if( strstr(getline_buffer,WORKINGDIR_TOKEN) != NULL ){ /* WORKING DIR */
@@ -125,7 +98,7 @@ rc_config *read_rc_config(const char *file_name){
global_config->exclude_list->excludes = slapt_malloc( sizeof *global_config->exclude_list->excludes );
global_config->exclude_list->count = 0;
}
- if( global_config->sources.count == 0 ){
+ if( global_config->sources->count == 0 ){
fprintf(stderr,_("SOURCE directive not set within %s.\n"),file_name);
return NULL;
}
@@ -160,12 +133,18 @@ void working_dir_init(const rc_config *global_config){
void free_rc_config(rc_config *global_config){
unsigned int i;
- for(i = 0; i < global_config->exclude_list->count; i++){
+ for(i = 0; i < global_config->exclude_list->count; ++i){
free(global_config->exclude_list->excludes[i]);
}
-
free(global_config->exclude_list->excludes);
free(global_config->exclude_list);
+
+ for(i = 0; i < global_config->sources->count; ++i){
+ free(global_config->sources->url[i]);
+ }
+ free(global_config->sources->url);
+ free(global_config->sources);
+
free(global_config);
}
@@ -217,7 +196,7 @@ static struct exclude_list *parse_exclude(char *line){
return list;
}
-void add_exclude(struct exclude_list *list, char *e){
+void add_exclude(struct exclude_list *list,const char *e){
char **realloc_tmp;
realloc_tmp = realloc( list->excludes, sizeof *list->excludes * (list->count + 1) );
@@ -231,3 +210,36 @@ void add_exclude(struct exclude_list *list, char *e){
}
+void add_source(struct source_list *list,const char *s){
+ char **realloc_tmp;
+
+ realloc_tmp = realloc(list->url,sizeof *list->url * (list->count + 1) );
+
+ if( realloc_tmp == NULL ) return;
+
+ list->url = realloc_tmp;
+
+ if( s[strlen(s) - 1] != '/' ){
+ list->url[ list->count ] = slapt_malloc(
+ sizeof *list->url[list->count] * (strlen(s) + 2)
+ );
+ list->url[list->count] = strncat(
+ list->url[list->count],
+ s,
+ strlen(s) - 1
+ );
+ list->url[list->count] = strncat(
+ list->url[list->count],
+ "/",
+ strlen("/")
+ );
+ list->url[list->count][strlen(s) + 1] = '\0';
+ }else{
+ list->url[ list->count ] = strndup(s,strlen(s));
+ list->url[ list->count ][strlen(s)] = '\0';
+ }
+
+ ++list->count;
+
+}
+
diff --git a/src/configuration.h b/src/configuration.h
index 7ac27ca..dcb7d45 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -20,8 +20,6 @@
#define WORKINGDIR_TOKEN "WORKINGDIR="
#define WORKINGDIR_TOKEN_LEN 256
#define EXCLUDE_TOKEN "EXCLUDE="
-#define MAX_SOURCES 20
-#define MAX_SOURCE_URL_LEN 400
struct exclude_list {
char **excludes;
@@ -29,12 +27,12 @@ struct exclude_list {
};
struct source_list {
- char url[MAX_SOURCES][MAX_SOURCE_URL_LEN];
+ char **url;
unsigned int count;
};
typedef struct {
- struct source_list sources;
+ struct source_list *sources;
char working_dir[WORKINGDIR_TOKEN_LEN];
BOOL_T download_only;
BOOL_T dist_upgrade;
@@ -56,4 +54,5 @@ typedef struct {
rc_config *read_rc_config(const char *file_name);
void working_dir_init(const rc_config *global_config);
void free_rc_config(rc_config *global_config);
-void add_exclude(struct exclude_list *list, char *e);
+void add_exclude(struct exclude_list *list,const char *e);
+void add_source(struct source_list *list,const char *s);
diff --git a/src/package.c b/src/package.c
index e38af30..6fdb10d 100644
--- a/src/package.c
+++ b/src/package.c
@@ -1564,7 +1564,7 @@ int update_pkg_cache(const rc_config *global_config){
}
/* go through each package source and download the meta data */
- for(i = 0; i < global_config->sources.count; i++){
+ for(i = 0; i < global_config->sources->count; i++){
FILE *tmp_pkg_f,*tmp_patch_f,*tmp_checksum_f;
struct pkg_list *available_pkgs = NULL;
struct pkg_list *patch_pkgs = NULL;
@@ -1575,9 +1575,9 @@ int update_pkg_cache(const rc_config *global_config){
/* download our PKG_LIST */
- printf(_("Retrieving package data [%s]..."),global_config->sources.url[i]);
- pkg_filename = gen_filename_from_url(global_config->sources.url[i],PKG_LIST);
- pkg_head = head_mirror_data(global_config->sources.url[i],PKG_LIST);
+ printf(_("Retrieving package data [%s]..."),global_config->sources->url[i]);
+ pkg_filename = gen_filename_from_url(global_config->sources->url[i],PKG_LIST);
+ pkg_head = head_mirror_data(global_config->sources->url[i],PKG_LIST);
pkg_local_head = read_head_cache(pkg_filename);
/* open for reading if cached, otherwise write it from the downloaded data */
@@ -1588,7 +1588,7 @@ int update_pkg_cache(const rc_config *global_config){
}else{
if( global_config->dl_stats == TRUE ) printf("\n");
if( (tmp_pkg_f = open_file(pkg_filename,"w+b")) == NULL ) exit(1);
- if( get_mirror_data_from_source(tmp_pkg_f,global_config,global_config->sources.url[i],PKG_LIST) == 0 ){
+ if( get_mirror_data_from_source(tmp_pkg_f,global_config,global_config->sources->url[i],PKG_LIST) == 0 ){
rewind(tmp_pkg_f); /* make sure we are back at the front of the file */
available_pkgs = parse_packages_txt(tmp_pkg_f);
if( global_config->dl_stats == FALSE ) printf(_("Done\n"));
@@ -1610,9 +1610,9 @@ int update_pkg_cache(const rc_config *global_config){
/* download PATCHES_LIST */
- printf(_("Retrieving patch list [%s]..."),global_config->sources.url[i]);
- patch_filename = gen_filename_from_url(global_config->sources.url[i],PATCHES_LIST);
- patch_head = head_mirror_data(global_config->sources.url[i],PATCHES_LIST);
+ printf(_("Retrieving patch list [%s]..."),global_config->sources->url[i]);
+ patch_filename = gen_filename_from_url(global_config->sources->url[i],PATCHES_LIST);
+ patch_head = head_mirror_data(global_config->sources->url[i],PATCHES_LIST);
patch_local_head = read_head_cache(patch_filename);
/* open for reading if cached, otherwise write it from the downloaded data */
@@ -1623,7 +1623,7 @@ int update_pkg_cache(const rc_config *global_config){
}else{
if( global_config->dl_stats == TRUE ) printf("\n");
if( (tmp_patch_f = open_file(patch_filename,"w+b")) == NULL ) exit (1);
- if( get_mirror_data_from_source(tmp_patch_f,global_config,global_config->sources.url[i],PATCHES_LIST) == 0 ){
+ if( get_mirror_data_from_source(tmp_patch_f,global_config,global_config->sources->url[i],PATCHES_LIST) == 0 ){
rewind(tmp_patch_f); /* make sure we are back at the front of the file */
patch_pkgs = parse_packages_txt(tmp_patch_f);
if( global_config->dl_stats == FALSE ) printf(_("Done\n"));
@@ -1642,9 +1642,9 @@ int update_pkg_cache(const rc_config *global_config){
/* download checksum file */
- printf(_("Retrieving checksum list [%s]..."), global_config->sources.url[i]);
- checksum_filename = gen_filename_from_url(global_config->sources.url[i],CHECKSUM_FILE);
- checksum_head = head_mirror_data(global_config->sources.url[i],CHECKSUM_FILE);
+ printf(_("Retrieving checksum list [%s]..."), global_config->sources->url[i]);
+ checksum_filename = gen_filename_from_url(global_config->sources->url[i],CHECKSUM_FILE);
+ checksum_head = head_mirror_data(global_config->sources->url[i],CHECKSUM_FILE);
checksum_local_head = read_head_cache(checksum_filename);
/* open for reading if cached, otherwise write it from the downloaded data */
@@ -1655,7 +1655,7 @@ int update_pkg_cache(const rc_config *global_config){
if( global_config->dl_stats == TRUE ) printf("\n");
if( (tmp_checksum_f = open_file(checksum_filename,"w+b")) == NULL ) exit(1);
if( get_mirror_data_from_source(
- tmp_checksum_f,global_config,global_config->sources.url[i],CHECKSUM_FILE
+ tmp_checksum_f,global_config,global_config->sources->url[i],CHECKSUM_FILE
) != 0
){
source_dl_failed = 1;
@@ -1694,8 +1694,8 @@ int update_pkg_cache(const rc_config *global_config){
printf(_("Done\n"));
/* write package listings to disk */
- write_pkg_data(global_config->sources.url[i],pkg_list_fh_tmp,available_pkgs);
- write_pkg_data(global_config->sources.url[i],pkg_list_fh_tmp,patch_pkgs);
+ write_pkg_data(global_config->sources->url[i],pkg_list_fh_tmp,available_pkgs);
+ write_pkg_data(global_config->sources->url[i],pkg_list_fh_tmp,patch_pkgs);
}
if ( available_pkgs ) free_pkg_list(available_pkgs);