MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / FindSection

Function FindSection

BaseTools/Source/C/Common/ParseInf.c:132–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132BOOLEAN
133FindSection (
134 IN MEMORY_FILE *InputFile,
135 IN CHAR8 *Section
136 )
137/*++
138
139Routine Description:
140
141 This function parses a file from the beginning to find a section.
142 The section string may be anywhere within a line.
143
144Arguments:
145
146 InputFile Memory file image.
147 Section Section to search for
148
149Returns:
150
151 FALSE if error or EOF
152 TRUE if section found
153
154--*/
155{
156 CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
157 CHAR8 *CurrentToken;
158
159 //
160 // Verify input is not NULL
161 //
162 assert (InputFile->FileImage);
163 assert (InputFile->Eof);
164 assert (InputFile->CurrentFilePointer);
165 assert (Section);
166
167 //
168 // Rewind to beginning of file
169 //
170 InputFile->CurrentFilePointer = InputFile->FileImage;
171
172 //
173 // Read lines until the section is found
174 //
175 while (InputFile->CurrentFilePointer < InputFile->Eof) {
176 //
177 // Read a line
178 //
179 ReadLine (InputFile, InputBuffer, MAX_LONG_FILE_PATH);
180
181 //
182 // Check if the section is found
183 //
184 CurrentToken = strstr (InputBuffer, Section);
185 if (CurrentToken != NULL) {
186 return TRUE;
187 }
188 }
189

Callers 1

FindTokenFunction · 0.85

Calls 2

ReadLineFunction · 0.85
strstrFunction · 0.85

Tested by

no test coverage detected