@@ -140,15 +140,15 @@ void showheldedpkgs(char *filterstr, char *dosdir) {
140140
141141#define NOTINST_SEARCHFLAG 1
142142#define NOTINST_MATCHFLAG 2
143- #define NOTINST_SMFLAG NOTINST_SEARCHFLAG+NOTINST_MATCHFLAG
143+ #define NOTINST_SMFLAG ( NOTINST_SEARCHFLAG+NOTINST_MATCHFLAG)
144144
145145// sparky4: SLOW BUT IT WORKS! :D
146146//TODO MAKE THIS FASTER (An idea is to use only matching 1st letters of the package to match packages in repo..)
147147void shownotinstalledpkgs (char * filterstr , char * dosdir , struct pkgdb * pkgdb , int verbosemode , char * * repolist ) {
148148 char * packagelist [packagelist_maxlen ];
149149 char * packagelist_ver [packagelist_maxlen ];
150150 int packagelist_len , x , numofpkginrepo , nomatch ;
151- int /*match*/ flag = 0 /*, searchflag*/ , matchtimes = 0 ;
151+ int flag = 0 , matchtimes = 0 ;
152152 struct pkgdb * curpkg ;
153153 struct pkgrepo * currep ;
154154 char * linebuf ;
@@ -169,24 +169,22 @@ void shownotinstalledpkgs(char *filterstr, char *dosdir, struct pkgdb *pkgdb, in
169169 numofpkginrepo = 1 ;
170170 for (curpkg = pkgdb -> nextpkg ; curpkg != NULL ; curpkg = curpkg -> nextpkg ) {
171171 numofpkginrepo ++ ;
172- // if ((numofpkginrepo % 10) == 0) printf(".");
173172 }
174- // puts("");
175173 // sparky4: if there is mor epackages on the system (old install) than on the repo do this.
176174 if (numofpkginrepo < packagelist_len ) numofpkginrepo = packagelist_len ;
177175
178176 // sparky4: the loop to check for not installed packages!
179177 for (curpkg = pkgdb -> nextpkg ; curpkg != NULL ; curpkg = curpkg -> nextpkg ) {
180178 // sparky4: initiate variable
181- /*search*/ flag & = 0 ;/* matchflag = 0;*/
179+ flag = 0 ;
182180 for (x = nomatch = 0 ; x <= numofpkginrepo ; x ++ ) {
183- if (/*searchflag == 0*/ flag & ~ NOTINST_SEARCHFLAG ) {
181+ if (flag == 0 ) {
184182 if (filterstr == NULL ) {
185- /*search*/ flag |= NOTINST_SEARCHFLAG ;
183+ flag |= NOTINST_SEARCHFLAG ;
186184 } else {
187- /*search*/ flag &= ~1 ;
188- if (fdnpkg_strcasestr (curpkg -> name , filterstr ) != NULL ) /*search*/ flag |= NOTINST_SEARCHFLAG ; /* look into pkg name */
189- if (fdnpkg_strcasestr (curpkg -> desc , filterstr ) != NULL ) /*search*/ flag |= NOTINST_SEARCHFLAG ; /* look into pkg desc */
185+ flag &= ~( NOTINST_SEARCHFLAG ) ;
186+ if (fdnpkg_strcasestr (curpkg -> name , filterstr ) != NULL ) flag |= NOTINST_SEARCHFLAG ; /* look into pkg name */
187+ if (fdnpkg_strcasestr (curpkg -> desc , filterstr ) != NULL ) flag |= NOTINST_SEARCHFLAG ; /* look into pkg desc */
190188 }
191189 }
192190 // sparky4: check if package is NOT installed
@@ -197,12 +195,12 @@ void shownotinstalledpkgs(char *filterstr, char *dosdir, struct pkgdb *pkgdb, in
197195 break ;
198196 }
199197
200- if ((nomatch == numofpkginrepo )) {
201- /*match*/ flag |= NOTINST_MATCHFLAG ; // sparky4: PACKAGE NOT INSTALLED
198+ if ((nomatch == numofpkginrepo + 1 )) {
199+ flag |= NOTINST_MATCHFLAG ; // sparky4: PACKAGE NOT INSTALLED
202200 }
203201 }
204- // if (nomatch == 0 ) printf("\tx == %d\tnomatch == %d\tflag == 0x%X\t%d\n", x, nomatch, flag, numofpkginrepo);
205- if (/*(searchflag != 0) && (matchflag != 0)*/ flag & ( NOTINST_MATCHFLAG ) ) {
202+ //0000 if (flag > 2 ) printf("\tx == %d\tnomatch == %d\tflag == 0x%X\t%d\n", x, nomatch, flag, numofpkginrepo);
203+ if (flag == NOTINST_SMFLAG ) {
206204 if (snprintf (linebuf , 80 , "%s - %s" , curpkg -> name , curpkg -> desc ) > 79 ) { /* truncated */
207205 linebuf [76 ] = '.' ;
208206 linebuf [77 ] = '.' ;
0 commit comments