]>
Commit | Line | Data |
---|---|---|
11e7af84 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3 | // $Id: debsrcrecords.cc,v 1.1 1999/04/04 01:17:29 jgg Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | Debian Source Package Records - Parser implementation for Debian style | |
7 | source indexes | |
8 | ||
9 | ##################################################################### */ | |
10 | /*}}}*/ | |
11 | // Include Files /*{{{*/ | |
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "apt-pkg/debsrcrecords.h" | |
14 | #endif | |
15 | ||
16 | #include <apt-pkg/debsrcrecords.h> | |
17 | #include <apt-pkg/error.h> | |
18 | /*}}}*/ | |
19 | ||
20 | // SrcRecordParser::Binaries - Return the binaries field /*{{{*/ | |
21 | // --------------------------------------------------------------------- | |
22 | /* This member parses the binaries field into a pair of class arrays and | |
23 | returns a list of strings representing all of the components of the | |
24 | binaries field. The returned array need not be freed and will be | |
25 | reused by the next Binaries function call. */ | |
26 | const char **debSrcRecordParser::Binaries() | |
27 | { | |
28 | string Bins = Sect.FindS("Binary"); | |
29 | char *Buf = Buffer; | |
30 | unsigned int Bin = 0; | |
31 | if (Bins.empty() == true) | |
32 | return 0; | |
33 | ||
34 | // Strip any leading spaces | |
35 | string::const_iterator Start = Bins.begin(); | |
36 | for (; Start != Bins.end() && isspace(*Start) != 0; Start++); | |
37 | ||
38 | string::const_iterator Pos = Start; | |
39 | while (Pos != Bins.end()) | |
40 | { | |
41 | // Skip to the next ',' | |
42 | for (; Pos != Bins.end() && *Pos != ','; Pos++); | |
43 | ||
44 | // Back remove spaces | |
45 | string::const_iterator End = Pos; | |
46 | for (; End > Start && (End[-1] == ',' || isspace(End[-1]) != 0); End--); | |
47 | ||
48 | // Stash the string | |
49 | memcpy(Buf,Start,End-Start); | |
50 | StaticBinList[Bin] = Buf; | |
51 | Bin++; | |
52 | Buf += End-Start; | |
53 | *Buf++ = 0; | |
54 | ||
55 | // Advance pos | |
56 | for (; Pos != Bins.end() && (*Pos == ',' || isspace(*Pos) != 0); Pos++); | |
57 | Start = Pos; | |
58 | } | |
59 | ||
60 | StaticBinList[Bin] = 0; | |
61 | return StaticBinList; | |
62 | } | |
63 | /*}}}*/ |