source: titan/titan/ipkg.h @ 13075

Last change on this file since 13075 was 13075, checked in by nit, 12 years ago

[titan] fix memleak

File size: 16.6 KB
Line 
1#ifndef IPKG_H
2#define IPKG_H
3
4#define IPKG_LIB
5#include "../libipkg/libipkg.h"
6#include "../libipkg/args.h"
7
8struct ipkg
9{
10        char* name;
11        char* desc;
12        char* version;
13        char* section;
14        char* showname;
15        struct ipkg* prev;
16        struct ipkg* next;
17};
18
19struct ipkg *ipkg = NULL;
20
21void debugipkg()
22{
23        struct ipkg *node = ipkg;
24       
25        while(node != NULL)
26        {
27                if(node->name != NULL)
28                        printf("pkg name: %s\n", node->name);
29                if(node->desc != NULL)
30                        printf("pkg desc: %s\n", node->desc);
31                if(node->version != NULL)
32                        printf("pkg version: %s\n", node->version);
33                if(node->section != NULL)
34                        printf("pkg section: %s\n", node->section);
35                if(node->showname != NULL)
36                        printf("pkg showname: %s\n", node->showname);
37                node = node->next;
38        }
39}
40
41struct ipkg* addipkg(char *name, char* desc, char* version, char* section, char* showname, struct ipkg* last)
42{
43        //debug(1000, "in");
44        struct ipkg *newnode = NULL, *prev = NULL, *node = ipkg;
45
46        newnode = (struct ipkg*)malloc(sizeof(struct ipkg));   
47        if(newnode == NULL)
48        {
49                err("no memory");
50                return NULL;
51        }
52        memset(newnode, 0, sizeof(struct ipkg));
53
54        newnode->name = ostrcat(name, NULL, 0, 0);
55        newnode->desc = ostrcat(desc, NULL, 0, 0);
56        newnode->version = ostrcat(version, NULL, 0, 0);
57        newnode->section = ostrcat(section, NULL, 0, 0);
58        newnode->showname = ostrcat(showname, NULL, 0, 0);
59
60        if(last == NULL)
61        {
62                while(node != NULL)
63                {
64                        prev = node;
65                        node = node->next;
66                }
67        }
68        else
69        {
70                prev = last;
71                node = last->next;
72        }
73
74        if(prev == NULL)
75                ipkg = newnode;
76        else
77        {
78                prev->next = newnode;
79                newnode->prev = prev;
80        }
81        newnode->next = node;
82        if(node != NULL) node->prev = newnode;
83
84        //debug(1000, "out");
85        return newnode;
86}
87
88void delipkg(struct ipkg* ipkgnode)
89{
90        //debug(1000, "in");
91        struct ipkg *node = ipkg, *prev = ipkg;
92
93        while(node != NULL)
94        {
95                if(node == ipkgnode)
96                {
97                        if(node == ipkg)
98                        {
99                                ipkg = node->next;
100                                if(ipkg != NULL)
101                                        ipkg->prev = NULL;
102                        }
103                        else
104                        {
105                                prev->next = node->next;
106                                if(node->next != NULL)
107                                        node->next->prev = prev;
108                        }
109
110                        free(node->name);
111                        node->name = NULL;
112
113                        free(node->desc);
114                        node->desc = NULL;
115
116                        free(node->version);
117                        node->version = NULL;
118
119                        free(node->section);
120                        node->section = NULL;
121
122                        free(node->showname);
123                        node->showname = NULL;
124
125                        free(node);
126                        node = NULL;
127                        break;
128                }
129
130                prev = node;
131                node = node->next;
132        }
133        //debug(1000, "out");
134}
135
136void freeipkg()
137{
138        debug(1000, "in");
139        struct ipkg *node = ipkg, *prev = ipkg;
140
141        while(node != NULL)
142        {
143                prev = node;
144                node = node->next;
145                if(prev != NULL)
146                        delipkg(prev);
147        }
148        debug(1000, "out");
149}
150
151int ipkg_list_cb(char *name, char *desc, char *version, pkg_state_status_t status, void *userdata)
152{
153        int count = 0;
154        char* tmpstr = NULL;
155        struct splitstr* ret = NULL;
156       
157        tmpstr = ostrcat(name, NULL, 0, 0);
158        ret = strsplit(tmpstr, "-", &count);
159        free(tmpstr); tmpstr = NULL;
160
161        if(desc)
162                addipkg(name, desc, version, (&ret[2])->part, (&ret[3])->part, NULL);
163        else
164                addipkg(name, NULL, version, (&ret[2])->part, (&ret[3])->part, NULL);
165
166        free(ret); ret = NULL;
167
168        return 0;
169}
170
171int ipkg_status_cb(char *name, int istatus, char *desc, void *userdata)
172{
173        addipkg(name, desc, NULL, NULL, NULL, NULL);
174        return 0;
175}
176
177int ipkg_update(void)
178{
179        int err = 0;
180        args_t args;
181
182        args_init(&args);
183        err = ipkg_lists_update(&args);
184        args_deinit(&args);
185
186        return err;
187}
188
189int ipkg_list(void)
190{
191        int err = 0;
192        args_t args;
193       
194        args_init(&args);
195        err = ipkg_packages_list(&args, NULL, ipkg_list_cb, NULL);
196        args_deinit(&args);
197
198        return err;
199}
200
201int ipkg_status(const char* package)
202{
203        int err = 0;
204        args_t args;
205
206        args_init(&args);
207        err = ipkg_packages_status(&args, package, ipkg_status_cb, NULL);
208        args_deinit(&args);
209
210        return err;
211}
212
213int ipkg_info(const char* package)
214{
215        int err = 0;
216        args_t args;
217
218        args_init(&args);
219        err = ipkg_packages_info(&args, package, ipkg_status_cb, NULL);
220        args_deinit(&args);
221
222        return err;
223}
224
225int ipkg_install(const char* package)
226{
227        printf("package: %s\n",package);
228
229        int err = 0;
230        args_t args;
231        args_init(&args);
232
233printf("4444444\n");
234        err = ipkg_packages_install(&args, package);
235printf("5555555\n");
236        args_deinit(&args);
237printf("6666666\n");
238        return err;
239}
240
241int ipkg_remove(const char* package, int purge)
242{
243        int err = 0;
244        args_t args;
245
246        args_init(&args);
247        err = ipkg_packages_remove(&args, package, purge);
248        args_deinit(&args);
249
250        return err;
251}
252
253int ipkg_upgrade(void)
254{
255        int err = 0;
256        args_t args;
257
258        args_init(&args);
259        err = ipkg_packages_upgrade(&args);
260        args_deinit(&args);
261
262        return err;
263}
264
265int ipkg_download(ipkg_conf_t *conf, const char *src, const char *filename)
266{
267        int err = 0, count = 0, i = 0, withoutgui = 0;
268        char* ip = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL;
269        struct splitstr* ret = NULL;
270
271        if(src == NULL) return 1;
272
273        ip = string_replace("http://", "", src, 0);
274
275        if(ip != NULL)
276                pos = strchr(ip, '/');
277        if(pos != NULL)
278        {
279                pos[0] = '\0';
280                path = pos + 1;
281        }
282
283        tmpstr = ostrcat("", path, 0, 0);
284        ret = strsplit(tmpstr, "/", &count);
285        free(tmpstr); tmpstr = NULL;
286       
287        for(i = 0; i < count; i++)
288        {
289                if(ostrcmp("Packages.gz", (&ret[i])->part) == 0)
290                        withoutgui = 1;
291        }
292        free(ret); ret = NULL;
293       
294        if(withoutgui == 1)
295        {
296                if(ostrcmp("97.74.32.10", ip) == 0)
297                {
298                        if(ostrcmp(path, "//97.74.32.10/svn/ipk/sh4/titan") != 0)               
299                        {
300                                textbox(_("Message"), _("check your Secret Feed !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);               
301                                free(ip); ip = NULL;
302                                return;
303                        }
304                }
305
306                char* checkfile = NULL;
307                checkfile = ostrcat("/tmp/Packages.", ip, 0, 0);
308
309                if(!file_exist(checkfile)) // +status.ipkg = date + 1day
310                {
311                        char* tmppath = NULL;
312                        tmppath = ostrcat(tmppath, path, 1, 0);
313                        tmppath = string_replace("Packages.gz", "Packages.preview.tar.gz", tmppath, 1);
314                        gethttp(ip, tmppath, 80, "/tmp/Packages.preview.tar.gz", "YXRlbWlvOkZIWlZCR2huemZ2RWhGREZUR3p1aWY1Njc2emhqR1RVR0JOSGpt", NULL);
315                        free(tmppath); tmppath = NULL;
316                       
317                        system("tar -zxvf /tmp/Packages.preview.tar.gz -C /tmp");
318                        unlink("/tmp/Packages.preview.tar.gz");
319                        writesys(checkfile, ".", 1);
320                }
321                free(checkfile); checkfile = NULL;             
322                err = gethttp(ip, path, 80, (char*)filename, "YXRlbWlvOkZIWlZCR2huemZ2RWhGREZUR3p1aWY1Njc2emhqR1RVR0JOSGpt", NULL);
323        }
324        else
325                err = screendownload("Download", ip, path, 80, (char*)filename, "YXRlbWlvOkZIWlZCR2huemZ2RWhGREZUR3p1aWY1Njc2emhqR1RVR0JOSGpt", 0);
326
327        free(ip); ip = NULL;
328        return err;
329}
330
331int ipkg_files(const char* package)
332{
333        int err = 0;
334        args_t args;
335
336        args_init(&args);
337        err = ipkg_package_files(&args, package, ipkg_list_cb, NULL);
338        args_deinit(&args);
339
340        return err;
341}
342
343int ipkg_search(const char* package)
344{
345        int err = 0;
346        args_t args;
347
348        args_init(&args);
349        err = ipkg_file_search(&args, package, ipkg_list_cb, NULL);
350        args_deinit(&args);
351
352        return err;
353}
354
355char* get_ipk_section()
356{
357        struct ipkg *node = ipkg;
358        char* sectionlist = NULL;
359        char* namelist = NULL;
360        char* tmpstr = NULL;
361        while(node != NULL)
362        {
363                if(node->name != NULL && node->section != NULL)
364                {
365                        tmpstr = ostrcat("-", node->section, 0, 0);
366                        tmpstr = ostrcat(tmpstr, "-", 1, 0);
367                        if(!string_find(tmpstr,namelist))
368                        {
369                                namelist = ostrcat(namelist, node->name, 1, 0);
370                                namelist = ostrcat(namelist, " ", 1, 0);
371                                sectionlist = ostrcat(sectionlist, node->section, 1, 0);
372                                sectionlist = ostrcat(sectionlist, "\n", 1, 0);
373                        }
374                        free(tmpstr), tmpstr = NULL;
375                }
376                node = node->next;
377        }
378        free(namelist), namelist = NULL;
379        return sectionlist;
380}
381
382/* not needed anymore
383char* get_ipk_list(char* section)
384{
385        struct ipkg *node = ipkg;
386        char* namelist = NULL;
387        char* tmpstr = NULL;
388        while(node != NULL)
389        {
390                if(node->name != NULL && node->version != NULL && section != NULL)
391                {
392                        tmpstr = ostrcat("titan-plugin-", section, 0, 0);
393                        tmpstr = ostrcat(tmpstr, "-", 1, 0);
394                        if(string_find(tmpstr,node->name))
395                        {
396                                namelist = ostrcat(namelist, node->name, 1, 0);
397                                namelist = ostrcat(namelist, "\n", 1, 0);
398                        }
399                        free(tmpstr), tmpstr = NULL;
400                }
401                node = node->next;
402        }
403        return namelist;
404}
405*/
406
407char* ipk_listbox(char* defaultstr, char* str, char* skinname, char* skintitle, char* skinpath, int showpng)
408{
409        debug(1000, "in");
410        char* skinname1 = NULL;
411        char* skinpath1 = NULL;
412        char* tmpskinpath = NULL;
413        int rcret = 0;
414
415        if(str == NULL)
416                return 0;
417
418        if(skinname == NULL)
419        {
420                debug(60, "skinname default=menulist");
421                skinname1 = ostrcat(skinname, "menulist", 1, 0);
422        }
423        else
424        {
425                debug(60, "skinname changed=%s", skinname);
426                skinname1 = ostrcat(skinname, "", 0, 0);
427        }
428
429        if(skinpath == NULL)
430        {
431                debug(60, "skinpath default=skin/");
432                skinpath1 = ostrcat(skinpath, "skin/", 1, 0);
433        }
434        else
435        {
436                debug(60, "skinpath changed=%s", skinpath);
437                skinpath1 = ostrcat(skinpath, "", 0, 0);
438        }
439
440        struct skin* screen = getscreen(skinname1);
441        struct skin* listbox = getscreennode(screen, "listbox");
442       
443        listbox->aktpage = -1;
444        listbox->aktline = 1;
445
446        if(skintitle != NULL)
447        {
448                debug(60, "skintitle changed=%s", skintitle);
449                changetitle(screen, _(skintitle));
450        }
451
452        struct skin* tmp = NULL;
453        char* tmpstr = NULL;
454        char* defaultdir = NULL;
455        char* tmpinfo = NULL;
456        char* tmptitle = NULL;
457        char* showname = NULL;
458//      char* tmpstr1 = NULL;
459//      char* tmpck = NULL;
460        char* tmpsplit = NULL;
461        char* tmpck = NULL;
462        char* tmpstr1 = NULL;
463        char* tmpstr4 = NULL;
464        char* tmpstr5 = NULL;
465        if(showpng == 1)
466        {
467                struct splitstr* ret1 = NULL;
468                struct splitstr* ret2 = NULL;
469                struct splitstr* ret3 = NULL;
470                int count = 0;
471                int i = 0;
472                ret1 = strsplit(str, "\n", &count);
473       
474                for( i = 0; i < count; i++)
475                {
476                        int count2 = 0;
477                        tmpsplit = ostrcat(tmpsplit, (&ret1[i])->part, 1, 0);
478                        free(ret2); ret2 = NULL;
479                        ret2 = strsplit(tmpsplit, "-", &count2);
480       
481                        tmp = addlistbox(screen, listbox, tmp, 1);
482                       
483                        if(tmp != NULL)
484                        {
485                                changetext(tmp, _((&ret1[i])->part));
486                                changename(tmp, (&ret1[i])->part);
487       
488                                tmp->del = 1;
489                                tmp->textposx = 120;
490                                tmp->height = 50;
491        //                              tmp->fontsize = 30;
492                                tmp->valign = convertxmlentry("middle", 0);
493                                tmp->hspace = 5;
494                                debug(60, "showpng changed=%d", showpng);
495       
496                                if(showpng == 1)
497                                {
498                                        if(string_find("%pluginpath%",skinpath1))
499                                        {
500                                                struct splitstr* ret6 = NULL;
501                                                int count6 = 0;
502                                                char* tmpstr6 = NULL;
503                                                tmpstr6 = ostrcat("", skinpath1, 0, 0);
504                                                ret6 = strsplit(tmpstr6, "%", &count6);
505                                                defaultdir = ostrcat(getconfig("skinpath", NULL), "/skin/panel_", 0, 0);
506                                                defaultdir = ostrcat(defaultdir, (&ret1[i])->part, 1, 0);
507                                                defaultdir = ostrcat(defaultdir, ".png", 1, 0);
508       
509                                                if(!file_exist(defaultdir))
510                                                {
511                                                        defaultdir = ostrcat(getconfig("pluginpath", NULL), (&ret6[1])->part, 0, 0);
512                                                        defaultdir = ostrcat(defaultdir, "panel_", 0, 0);
513                                                        defaultdir = ostrcat(defaultdir, (&ret1[i])->part, 1, 0);
514                                                        defaultdir = ostrcat(defaultdir, ".png", 1, 0);
515                                                }
516                                                free(ret6), ret6 = NULL;
517                                        }
518                                        else
519                                        {
520                                                defaultdir = ostrcat(getconfig("skinpath", NULL), skinpath1, 0, 0);
521                                                defaultdir = ostrcat(defaultdir, "/skin/panel_", 0, 0);
522                                                defaultdir = ostrcat(defaultdir, (&ret1[i])->part, 1, 0);
523                                                defaultdir = ostrcat(defaultdir, ".png", 1, 0);
524                                        }
525       
526                                        debug(60, "defaultdir %s", defaultdir);
527                                        if(file_exist(defaultdir))
528                                        {
529                                                tmpskinpath = ostrcat("", defaultdir, 0, 0);
530                                                changepic(tmp, tmpskinpath);
531                                                free(tmpskinpath); tmpskinpath = NULL;
532                                        }
533                                        else
534                                        {
535                                                tmpskinpath = ostrcat(skinpath1, "panel_default.png", 0, 0);
536                                                changepic(tmp, tmpskinpath);
537                                                free(tmpskinpath); tmpskinpath = NULL;
538                                        }
539                                        free(defaultdir); defaultdir = NULL;
540                                }
541       
542                                if(defaultstr != NULL)
543                                {
544                                        setlistboxselection(listbox, defaultstr);
545                                //      if(ostrcmp(defaultstr, (&ret1[i])->part) == 0)
546                                //              listbox->aktline = i + 1;
547                                }
548                        }
549                }
550        }
551        else if(showpng == 2)
552        {
553                tmpck = get_ipk_listinstall();
554                struct ipkg *node = ipkg;
555                while(node != NULL)
556                {
557                        printf("name: %s\n", node->name);
558                        printf("section: %s\n", node->section);
559                        printf("showname: %s\n", node->showname);
560                        printf("str: %s\n", str);
561                                                                       
562                        if(node->section != NULL && ostrcmp(str, node->section) == 0)
563                        {
564                                struct splitstr* ret1 = NULL;
565                                int count1 = 0;                 
566                                tmpstr1 = ostrcat("", node->showname, 0, 0);
567                                ret1 = strsplit(tmpstr1, ".", &count1);
568                                int max = count1;
569                                int i = 0;
570                                showname = ostrcat("", (&ret1[0])->part, 0, 0);
571                                free(ret1),ret1 = NULL;
572                               
573                                struct splitstr* ret3 = NULL;
574                                int count3 = 0;
575                                int a = 0;
576                                tmpstr1 = ostrcat("", tmpck, 0, 0);
577       
578                                debug(60, "tmpck: (%d) %s", i, tmpstr1);
579       
580                                ret3 = strsplit(tmpstr1, "\n", &count3);
581                                int skip = 0;
582                                for(a = 0; a < count3; a++)
583                                {
584                                        if(ostrcmp((&ret3[a])->part, node->name) == 0)
585                                        {
586                                                debug(60, "set skiped=1");
587                                                skip = 1;
588                                                continue;
589                                        }
590                                }
591                                if(skip == 0)
592                                {
593                                        tmp = addlistbox(screen, listbox, tmp, 1);
594                                        tmp->del = 1;
595                                        tmp->valign = convertxmlentry("middle", 0);
596                                        printf("321111\n");
597                                        tmp->textposx = 250;
598                                        tmp->height = 170;
599                                        tmp->textposx2 = 270;
600                                        tmp->type=TEXTBOX;
601                                        tmp->wrap=YES;
602                                        tmp->hspace = 5;
603                                        debug(60, "showpng changed=%d", showpng);
604       
605                                        defaultdir = ostrcat("", skinpath1, 0, 0);
606                                        defaultdir = ostrcat(defaultdir, "titan-pluginpreview-", 1, 0);
607                                        defaultdir = ostrcat(defaultdir, showname, 1, 0);
608                                        defaultdir = ostrcat(defaultdir, ".png", 1, 0);
609       
610                                        debug(60, "defaultdir %s", defaultdir);
611       
612                                        if(file_exist(defaultdir))
613                                        {
614                                                debug(60, "defaultdir found");
615                                                tmpskinpath = ostrcat(skinpath1, "titan-pluginpreview-", 0, 0);
616                                                tmpskinpath = ostrcat(tmpskinpath, showname, 1, 0);
617                                                tmpskinpath = ostrcat(tmpskinpath, ".png", 1, 0);
618                                                changepic(tmp, tmpskinpath);
619                                                free(tmpskinpath); tmpskinpath = NULL;
620                                        }       
621                                        else
622                                        {
623                                                debug(60, "defaultdir not found use default.png");
624                                                tmpskinpath = ostrcat("", "skin/plugin.png", 0, 0);
625                                                changepic(tmp, tmpskinpath);
626                                                free(tmpskinpath); tmpskinpath = NULL;
627                                        }
628                                        free(defaultdir); defaultdir = NULL;
629       
630                                        if(defaultstr != NULL)
631                                        {
632                                                setlistboxselection(listbox, defaultstr);
633                                        //      if(ostrcmp(defaultstr, (&ret1[i])->part) == 0)
634                                        //              listbox->aktline = i + 1;
635                                        }
636                                        tmptitle = ostrcat(tmptitle, showname, 1, 0);
637                                        tmptitle = ostrcat(tmptitle, " v.", 1, 0);
638                                        tmptitle = ostrcat(tmptitle, node->version, 1, 0);
639                                        changetext(tmp, _(tmptitle));
640                                        changename(tmp, tmptitle);
641       
642                                        tmpinfo = ostrcat(tmpinfo, "\nSection: ", 1, 0);
643                                        tmpinfo = ostrcat(tmpinfo, node->section, 1, 0);
644                                        tmpinfo = ostrcat(tmpinfo, "\nDescription:\n", 1, 0);
645                                        if(node->desc != NULL)
646                                                tmpinfo = ostrcat(tmpinfo, node->desc, 1, 0);
647                                        else
648                                                tmpinfo = ostrcat(tmpinfo, _("no description found"), 1, 0);                           
649                                        changetext2(tmp, _(tmpinfo));
650       
651                                        free(tmpinfo); tmpinfo = NULL;
652                                        free(tmptitle); tmptitle = NULL;
653                                        free(tmpstr1);tmpstr1 = NULL;
654                                        free(showname);showname = NULL;
655                                }
656                        }                       
657                        node = node->next;
658                }
659        }
660        listbox->aktpage = -1;
661        drawscreen(screen,0);
662        addscreenrc(screen, listbox);
663
664        while (1)
665        {
666                rcret = waitrc(screen, 0, 0);
667
668                if(rcret==getrcconfigint("rcexit",NULL)) break;
669                if(listbox->select != NULL && rcret==getrcconfigint("rcok",NULL))
670                {
671                        tmpstr = ostrcat(tmpstr, listbox->select->name, 1, 0);
672                        break;
673                }
674        }
675        free(skinname1); skinname1 = NULL;
676        free(skinpath1); skinpath1 = NULL;
677        delownerrc(screen);
678        delmarkedscreennodes(screen, 1);
679        clearscreen(screen);
680        debug(1000, "out");
681        return tmpstr;
682
683}
684
685char* get_ipk_tmpinstall(char* ipk)
686{
687        debug(60, "in");
688
689        char* cmd = NULL, *tmpstr = NULL;
690        cmd = ostrcat(cmd, "ipkg install /tmp/", 1, 0);
691        cmd = ostrcat(cmd, ipk, 1, 0);
692
693        tmpstr = command(cmd);
694
695        debug(60, "out %s",cmd);
696        free(cmd); cmd = NULL;
697        return tmpstr;
698}
699
700char* get_ipk_listinstall()
701{
702        debug(60, "in");
703        char* cmd = NULL, *tmpstr = NULL;
704
705        cmd = ostrcat(cmd, "ipkg list_installed | awk '{ print $1 }' | sed 's/Successfully//' | sed 's/titan-plugin-//'", 1, 0);
706
707        tmpstr = command(cmd);
708
709        debug(60, "out %s",cmd);
710        free(cmd); cmd = NULL;
711        return tmpstr;
712}
713
714char* get_ipk_tmplistinstall()
715{
716        debug(60, "in");
717        char* cmd = NULL, *tmpstr = NULL;
718
719        cmd = ostrcat(cmd, "ls /tmp | grep '.ipk'", 1, 0);
720
721        tmpstr = command(cmd);
722
723        debug(60, "out %s",cmd);
724        free(cmd); cmd = NULL;
725        return tmpstr;
726}
727
728char* get_ipk_remove(char* ipk)
729{
730        debug(60, "in %s",ipk);
731        char* cmd = NULL, *tmpstr = NULL;
732
733        if(ipk == NULL) return NULL;
734
735        cmd = ostrcat(cmd, "ipkg remove titan-plugin-", 1, 0);
736        cmd = ostrcat(cmd, ipk, 1, 0);
737
738        tmpstr = command(cmd);
739
740        debug(60, "out");
741        free(cmd); cmd = NULL;
742        return tmpstr;
743}
744
745char* get_ipk_info(char* section)
746{
747        debug(60, "in %s",section);
748        char* cmd = NULL, *tmpstr = NULL;
749
750        if(section == NULL) return NULL;
751
752        cmd = ostrcat(cmd, "ipkg list *-", 1, 0);
753        cmd = ostrcat(cmd, section, 1, 0);
754        cmd = ostrcat(cmd, " | cut -d'-' -f6 | sed 's/Successfully terminated.//'", 1, 0);
755
756        tmpstr = command(cmd);
757
758        debug(60, "out %s",cmd);
759        free(cmd); cmd = NULL;
760        return tmpstr;
761}
762
763#endif
764
Note: See TracBrowser for help on using the repository browser.