author | andyq <andyq> | 2002-10-16 16:27:00 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-16 16:27:00 (UTC) |
commit | ea11ae7dc31e23578d13f30315a3697cbce99c05 (patch) (unidiff) | |
tree | 38391e8c5d681a2bad804ec32aececd62befa19c | |
parent | df5c9a60e2ee3484f424b4d6aa2f158a9aade93b (diff) | |
download | opie-ea11ae7dc31e23578d13f30315a3697cbce99c05.zip opie-ea11ae7dc31e23578d13f30315a3697cbce99c05.tar.gz opie-ea11ae7dc31e23578d13f30315a3697cbce99c05.tar.bz2 |
Fixed bug with reading ipkg.conf (ignored src lines that were commented out
with # src
Also, now writes a nice comment out to the ipkg.conf file
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index b9ce227..b6e6e37 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -85,2 +85,9 @@ void DataManager :: loadServers() | |||
85 | { | 85 | { |
86 | { | ||
87 | cout << "Before ipkg.conf read" << endl; | ||
88 | vector<Server>::iterator it; | ||
89 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | ||
90 | cout << "servername - " << it->getServerName() << endl; | ||
91 | } | ||
92 | |||
86 | while ( fgets( line, sizeof line, fp) != NULL ) | 93 | while ( fgets( line, sizeof line, fp) != NULL ) |
@@ -88,3 +95,3 @@ void DataManager :: loadServers() | |||
88 | lineStr = line; | 95 | lineStr = line; |
89 | if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) ) | 96 | if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) |
90 | { | 97 | { |
@@ -92,3 +99,11 @@ void DataManager :: loadServers() | |||
92 | char url[100]; | 99 | char url[100]; |
93 | sscanf( lineStr, "%*[^ ] %s %s", alias, url ); | 100 | |
101 | |||
102 | // Looks a little wierd but read up to the r of src (throwing it away), | ||
103 | // then read up to the next space and throw that away, the alias | ||
104 | // is next. | ||
105 | // Should Handle #src, # src, src, and combinations of | ||
106 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); | ||
107 | cout << "Adding alias " << alias << " to list" << endl; | ||
108 | cout << lineStr << endl; | ||
94 | Server s( alias, url ); | 109 | Server s( alias, url ); |
@@ -108,2 +123,9 @@ void DataManager :: loadServers() | |||
108 | } | 123 | } |
124 | { | ||
125 | cout << "After ipkg.conf read" << endl; | ||
126 | vector<Server>::iterator it; | ||
127 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | ||
128 | cout << "servername - " << it->getServerName() << endl; | ||
129 | } | ||
130 | |||
109 | } | 131 | } |
@@ -113,7 +135,7 @@ void DataManager :: loadServers() | |||
113 | // don't already exist | 135 | // don't already exist |
114 | /* AQ - commented out as if you don't have a CF or SD card in then | 136 | /* AQ - commented out as if you don't have a CF or SD card in then |
115 | * this causes IPKG to try to create directories on non existant devices | 137 | * this causes IPKG to try to create directories on non existant devices |
116 | * (which of course fails), gives a nasty error message and can cause ipkg | 138 | * (which of course fails), gives a nasty error message and can cause ipkg |
117 | * to seg fault. | 139 | * to seg fault. |
118 | * | 140 | * |
119 | vector<Destination>::iterator dit; | 141 | vector<Destination>::iterator dit; |
@@ -172,3 +194,16 @@ void DataManager :: writeOutIpkgConf() | |||
172 | 194 | ||
173 | out << "# Written by NetworkPackageManager Package Manager" << endl; | 195 | out << "# Written by AQPkg" << endl; |
196 | out << "# Must have one or more source entries of the form:" << endl; | ||
197 | out << "#" << endl; | ||
198 | out << "# src <src-name> <source-url>" << endl; | ||
199 | out << "#" << endl; | ||
200 | out << "# and one or more destination entries of the form:" << endl; | ||
201 | out << "#" << endl; | ||
202 | out << "# dest <dest-name> <target-path>" << endl; | ||
203 | out << "#" << endl; | ||
204 | out << "# where <src-name> and <dest-names> are identifiers that" << endl; | ||
205 | out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; | ||
206 | out << "# URL that points to a directory containing a Familiar" << endl; | ||
207 | out << "# Packages file, and <target-path> should be a directory" << endl; | ||
208 | out << "# that exists on the target system." << endl << endl; | ||
174 | 209 | ||
@@ -192,2 +227,4 @@ void DataManager :: writeOutIpkgConf() | |||
192 | 227 | ||
228 | out << endl; | ||
229 | |||
193 | // Write out destinations | 230 | // Write out destinations |