]>
git.saurik.com Git - apt.git/blob - apt-private/private-output.cc
1 // Include files /*{{{*/
4 #include <apt-pkg/configuration.h>
5 #include <apt-pkg/strutl.h>
6 #include <apt-pkg/error.h>
7 #include <apt-pkg/cachefile.h>
8 #include <apt-pkg/pkgrecords.h>
9 #include <apt-pkg/policy.h>
10 #include <apt-pkg/depcache.h>
11 #include <apt-pkg/pkgcache.h>
12 #include <apt-pkg/cacheiterators.h>
14 #include <apt-private/private-output.h>
15 #include <apt-private/private-cachefile.h>
26 #include <sys/ioctl.h>
33 std::ostream
c0out(0);
34 std::ostream
c1out(0);
35 std::ostream
c2out(0);
36 std::ofstream
devnull("/dev/null");
39 unsigned int ScreenWidth
= 80 - 1; /* - 1 for the cursor */
41 // SigWinch - Window size change signal handler /*{{{*/
42 // ---------------------------------------------------------------------
44 static void SigWinch(int)
50 if (ioctl(1, TIOCGWINSZ
, &ws
) != -1 && ws
.ws_col
>= 5)
51 ScreenWidth
= ws
.ws_col
- 1;
55 bool InitOutput() /*{{{*/
57 if (!isatty(STDOUT_FILENO
) && _config
->FindI("quiet", -1) == -1)
58 _config
->Set("quiet","1");
60 c0out
.rdbuf(cout
.rdbuf());
61 c1out
.rdbuf(cout
.rdbuf());
62 c2out
.rdbuf(cout
.rdbuf());
63 if (_config
->FindI("quiet",0) > 0)
64 c0out
.rdbuf(devnull
.rdbuf());
65 if (_config
->FindI("quiet",0) > 1)
66 c1out
.rdbuf(devnull
.rdbuf());
68 // deal with window size changes
69 signal(SIGWINCH
,SigWinch
);
74 _config
->Set("APT::Color", "false");
75 _config
->Set("APT::Color::Highlight", "");
76 _config
->Set("APT::Color::Neutral", "");
79 _config
->CndSet("APT::Color::Highlight", "\x1B[32m");
80 _config
->CndSet("APT::Color::Neutral", "\x1B[0m");
82 _config
->CndSet("APT::Color::Red", "\x1B[31m");
83 _config
->CndSet("APT::Color::Green", "\x1B[32m");
84 _config
->CndSet("APT::Color::Yellow", "\x1B[33m");
85 _config
->CndSet("APT::Color::Blue", "\x1B[34m");
86 _config
->CndSet("APT::Color::Magenta", "\x1B[35m");
87 _config
->CndSet("APT::Color::Cyan", "\x1B[36m");
88 _config
->CndSet("APT::Color::White", "\x1B[37m");
94 static std::string
GetArchiveSuite(pkgCacheFile
&/*CacheFile*/, pkgCache::VerIterator ver
) /*{{{*/
96 std::string suite
= "";
97 if (ver
&& ver
.FileList())
99 pkgCache::VerFileIterator VF
= ver
.FileList();
100 for (; VF
.end() == false ; ++VF
)
102 if(VF
.File() == NULL
|| VF
.File().Archive() == NULL
)
103 suite
= suite
+ "," + _("unknown");
105 suite
= suite
+ "," + VF
.File().Archive();
106 //suite = VF.File().Archive();
108 suite
= suite
.erase(0, 1);
113 static std::string
GetFlagsStr(pkgCacheFile
&CacheFile
, pkgCache::PkgIterator P
)/*{{{*/
115 pkgDepCache
*DepCache
= CacheFile
.GetDepCache();
116 pkgDepCache::StateCache
&state
= (*DepCache
)[P
];
118 std::string flags_str
;
119 if (state
.NowBroken())
121 if (P
.CurrentVer() && state
.Upgradable())
123 else if (P
.CurrentVer() != NULL
)
130 static std::string
GetCandidateVersion(pkgCacheFile
&CacheFile
, pkgCache::PkgIterator P
)/*{{{*/
132 pkgPolicy
*policy
= CacheFile
.GetPolicy();
133 pkgCache::VerIterator cand
= policy
->GetCandidateVer(P
);
135 return cand
? cand
.VerStr() : "(none)";
138 static std::string
GetInstalledVersion(pkgCacheFile
&/*CacheFile*/, pkgCache::PkgIterator P
)/*{{{*/
140 pkgCache::VerIterator inst
= P
.CurrentVer();
142 return inst
? inst
.VerStr() : "(none)";
145 static std::string
GetVersion(pkgCacheFile
&/*CacheFile*/, pkgCache::VerIterator V
)/*{{{*/
147 pkgCache::PkgIterator P
= V
.ParentPkg();
148 if (V
== P
.CurrentVer())
150 std::string inst_str
= DeNull(V
.VerStr());
151 #if 0 // FIXME: do we want this or something like this?
152 pkgDepCache
*DepCache
= CacheFile
.GetDepCache();
153 pkgDepCache::StateCache
&state
= (*DepCache
)[P
];
154 if (state
.Upgradable())
155 return "**"+inst_str
;
161 return DeNull(V
.VerStr());
165 static std::string
GetArchitecture(pkgCacheFile
&CacheFile
, pkgCache::PkgIterator P
)/*{{{*/
167 pkgPolicy
*policy
= CacheFile
.GetPolicy();
168 pkgCache::VerIterator inst
= P
.CurrentVer();
169 pkgCache::VerIterator cand
= policy
->GetCandidateVer(P
);
171 // this may happen for packages in dpkg "deinstall ok config-file" state
172 if (inst
.IsGood() == false && cand
.IsGood() == false)
173 return P
.VersionList().Arch();
175 return inst
? inst
.Arch() : cand
.Arch();
178 static std::string
GetShortDescription(pkgCacheFile
&CacheFile
, pkgRecords
&records
, pkgCache::PkgIterator P
)/*{{{*/
180 pkgPolicy
*policy
= CacheFile
.GetPolicy();
182 pkgCache::VerIterator ver
;
184 ver
= P
.CurrentVer();
186 ver
= policy
->GetCandidateVer(P
);
188 std::string ShortDescription
= "(none)";
191 pkgCache::DescIterator Desc
= ver
.TranslatedDescription();
192 pkgRecords::Parser
& parser
= records
.Lookup(Desc
.FileList());
194 ShortDescription
= parser
.ShortDesc();
196 return ShortDescription
;
199 void ListSingleVersion(pkgCacheFile
&CacheFile
, pkgRecords
&records
, /*{{{*/
200 pkgCache::VerIterator V
, std::ostream
&out
,
201 bool include_summary
)
203 pkgCache::PkgIterator P
= V
.ParentPkg();
205 pkgDepCache
*DepCache
= CacheFile
.GetDepCache();
206 pkgDepCache::StateCache
&state
= (*DepCache
)[P
];
208 std::string suite
= GetArchiveSuite(CacheFile
, V
);
209 std::string name_str
= P
.Name();
211 if (_config
->FindB("APT::Cmd::use-format", false))
213 std::string format
= _config
->Find("APT::Cmd::format", "${db::Status-Abbrev} ${Package} ${Version} ${Origin} ${Description}");
214 std::string output
= format
;
216 output
= SubstVar(output
, "${db::Status-Abbrev}", GetFlagsStr(CacheFile
, P
));
217 output
= SubstVar(output
, "${Package}", name_str
);
218 output
= SubstVar(output
, "${installed:Version}", GetInstalledVersion(CacheFile
, P
));
219 output
= SubstVar(output
, "${candidate:Version}", GetCandidateVersion(CacheFile
, P
));
220 output
= SubstVar(output
, "${Version}", GetVersion(CacheFile
, V
));
221 output
= SubstVar(output
, "${Description}", GetShortDescription(CacheFile
, records
, P
));
222 output
= SubstVar(output
, "${Origin}", GetArchiveSuite(CacheFile
, V
));
223 out
<< output
<< std::endl
;
225 // raring/linux-kernel version [upradable: new-version]
227 pkgPolicy
*policy
= CacheFile
.GetPolicy();
228 std::string VersionStr
= GetVersion(CacheFile
, V
);
229 std::string CandidateVerStr
= GetCandidateVersion(CacheFile
, P
);
230 std::string InstalledVerStr
= GetInstalledVersion(CacheFile
, P
);
231 std::string StatusStr
;
232 if(P
.CurrentVer() == V
&& state
.Upgradable()) {
233 strprintf(StatusStr
, _("[installed,upgradable to: %s]"),
234 CandidateVerStr
.c_str());
235 } else if (P
.CurrentVer() == V
) {
236 if(!V
.Downloadable())
237 StatusStr
= _("[installed,local]");
239 if(V
.Automatic() && state
.Garbage
)
240 StatusStr
= _("[installed,auto-removable]");
241 else if (state
.Flags
& pkgCache::Flag::Auto
)
242 StatusStr
= _("[installed,automatic]");
244 StatusStr
= _("[installed]");
245 } else if (P
.CurrentVer() &&
246 policy
->GetCandidateVer(P
) == V
&&
247 state
.Upgradable()) {
248 strprintf(StatusStr
, _("[upgradable from: %s]"),
249 InstalledVerStr
.c_str());
251 if (V
.ParentPkg()->CurrentState
== pkgCache::State::ConfigFiles
)
252 StatusStr
= _("[residual-config]");
256 out
<< std::setiosflags(std::ios::left
)
257 << _config
->Find("APT::Color::Highlight", "")
259 << _config
->Find("APT::Color::Neutral", "")
263 << GetArchitecture(CacheFile
, P
);
265 out
<< " " << StatusStr
;
269 << " " << GetShortDescription(CacheFile
, records
, P
)
275 // ShowList - Show a list /*{{{*/
276 // ---------------------------------------------------------------------
277 /* This prints out a string of space separated words with a title and
278 a two space indent line wraped to the current screen width. */
279 bool ShowList(ostream
&out
,string Title
,string List
,string VersionsList
)
281 if (List
.empty() == true)
283 // trim trailing space
284 int NonSpace
= List
.find_last_not_of(' ');
287 List
= List
.erase(NonSpace
+ 1);
288 if (List
.empty() == true)
292 // Acount for the leading space
293 int ScreenWidth
= ::ScreenWidth
- 3;
295 out
<< Title
<< endl
;
296 string::size_type Start
= 0;
297 string::size_type VersionsStart
= 0;
298 while (Start
< List
.size())
300 if(_config
->FindB("APT::Get::Show-Versions",false) == true &&
301 VersionsList
.size() > 0) {
302 string::size_type End
;
303 string::size_type VersionsEnd
;
305 End
= List
.find(' ',Start
);
306 VersionsEnd
= VersionsList
.find('\n', VersionsStart
);
308 out
<< " " << string(List
,Start
,End
- Start
) << " (" <<
309 string(VersionsList
,VersionsStart
,VersionsEnd
- VersionsStart
) <<
312 if (End
== string::npos
|| End
< Start
)
313 End
= Start
+ ScreenWidth
;
316 VersionsStart
= VersionsEnd
+ 1;
318 string::size_type End
;
320 if (Start
+ ScreenWidth
>= List
.size())
323 End
= List
.rfind(' ',Start
+ScreenWidth
);
325 if (End
== string::npos
|| End
< Start
)
326 End
= Start
+ ScreenWidth
;
327 out
<< " " << string(List
,Start
,End
- Start
) << endl
;
335 // ShowBroken - Debugging aide /*{{{*/
336 // ---------------------------------------------------------------------
337 /* This prints out the names of all the packages that are broken along
338 with the name of each each broken dependency and a quite version
341 The output looks like:
342 The following packages have unmet dependencies:
343 exim: Depends: libc6 (>= 2.1.94) but 2.1.3-10 is to be installed
344 Depends: libldap2 (>= 2.0.2-2) but it is not going to be installed
345 Depends: libsasl7 but it is not going to be installed
347 void ShowBroken(ostream
&out
,CacheFile
&Cache
,bool Now
)
349 if (Cache
->BrokenCount() == 0)
352 out
<< _("The following packages have unmet dependencies:") << endl
;
353 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
355 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
359 if (Cache
[I
].NowBroken() == false)
364 if (Cache
[I
].InstBroken() == false)
368 // Print out each package and the failed dependencies
369 out
<< " " << I
.FullName(true) << " :";
370 unsigned const Indent
= I
.FullName(true).size() + 3;
372 pkgCache::VerIterator Ver
;
375 Ver
= I
.CurrentVer();
377 Ver
= Cache
[I
].InstVerIter(Cache
);
379 if (Ver
.end() == true)
385 for (pkgCache::DepIterator D
= Ver
.DependsList(); D
.end() == false;)
387 // Compute a single dependency element (glob or)
388 pkgCache::DepIterator Start
;
389 pkgCache::DepIterator End
;
390 D
.GlobOr(Start
,End
); // advances D
392 if (Cache
->IsImportantDep(End
) == false)
397 if ((Cache
[End
] & pkgDepCache::DepGNow
) == pkgDepCache::DepGNow
)
402 if ((Cache
[End
] & pkgDepCache::DepGInstall
) == pkgDepCache::DepGInstall
)
410 for (unsigned J
= 0; J
!= Indent
; J
++)
414 if (FirstOr
== false)
416 for (unsigned J
= 0; J
!= strlen(End
.DepType()) + 3; J
++)
420 out
<< ' ' << End
.DepType() << ": ";
423 out
<< Start
.TargetPkg().FullName(true);
425 // Show a quick summary of the version requirements
426 if (Start
.TargetVer() != 0)
427 out
<< " (" << Start
.CompType() << " " << Start
.TargetVer() << ")";
429 /* Show a summary of the target package if possible. In the case
430 of virtual packages we show nothing */
431 pkgCache::PkgIterator Targ
= Start
.TargetPkg();
432 if (Targ
->ProvidesList
== 0)
435 pkgCache::VerIterator Ver
= Cache
[Targ
].InstVerIter(Cache
);
437 Ver
= Targ
.CurrentVer();
439 if (Ver
.end() == false)
442 ioprintf(out
,_("but %s is installed"),Ver
.VerStr());
444 ioprintf(out
,_("but %s is to be installed"),Ver
.VerStr());
448 if (Cache
[Targ
].CandidateVerIter(Cache
).end() == true)
450 if (Targ
->ProvidesList
== 0)
451 out
<< _("but it is not installable");
453 out
<< _("but it is a virtual package");
456 out
<< (Now
?_("but it is not installed"):_("but it is not going to be installed"));
472 // ShowNew - Show packages to newly install /*{{{*/
473 // ---------------------------------------------------------------------
475 void ShowNew(ostream
&out
,CacheFile
&Cache
)
477 /* Print out a list of packages that are going to be installed extra
478 to what the user asked */
481 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
483 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
484 if (Cache
[I
].NewInstall() == true) {
485 List
+= I
.FullName(true) + " ";
486 VersionsList
+= string(Cache
[I
].CandVersion
) + "\n";
490 ShowList(out
,_("The following NEW packages will be installed:"),List
,VersionsList
);
493 // ShowDel - Show packages to delete /*{{{*/
494 // ---------------------------------------------------------------------
496 void ShowDel(ostream
&out
,CacheFile
&Cache
)
498 /* Print out a list of packages that are going to be removed extra
499 to what the user asked */
502 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
504 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
505 if (Cache
[I
].Delete() == true)
507 if ((Cache
[I
].iFlags
& pkgDepCache::Purge
) == pkgDepCache::Purge
)
508 List
+= I
.FullName(true) + "* ";
510 List
+= I
.FullName(true) + " ";
512 VersionsList
+= string(Cache
[I
].CandVersion
)+ "\n";
516 ShowList(out
,_("The following packages will be REMOVED:"),List
,VersionsList
);
519 // ShowKept - Show kept packages /*{{{*/
520 // ---------------------------------------------------------------------
522 void ShowKept(ostream
&out
,CacheFile
&Cache
)
526 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
528 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
531 if (Cache
[I
].Upgrade() == true || Cache
[I
].Upgradable() == false ||
532 I
->CurrentVer
== 0 || Cache
[I
].Delete() == true)
535 List
+= I
.FullName(true) + " ";
536 VersionsList
+= string(Cache
[I
].CurVersion
) + " => " + Cache
[I
].CandVersion
+ "\n";
538 ShowList(out
,_("The following packages have been kept back:"),List
,VersionsList
);
541 // ShowUpgraded - Show upgraded packages /*{{{*/
542 // ---------------------------------------------------------------------
544 void ShowUpgraded(ostream
&out
,CacheFile
&Cache
)
548 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
550 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
553 if (Cache
[I
].Upgrade() == false || Cache
[I
].NewInstall() == true)
556 List
+= I
.FullName(true) + " ";
557 VersionsList
+= string(Cache
[I
].CurVersion
) + " => " + Cache
[I
].CandVersion
+ "\n";
559 ShowList(out
,_("The following packages will be upgraded:"),List
,VersionsList
);
562 // ShowDowngraded - Show downgraded packages /*{{{*/
563 // ---------------------------------------------------------------------
565 bool ShowDowngraded(ostream
&out
,CacheFile
&Cache
)
569 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
571 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
574 if (Cache
[I
].Downgrade() == false || Cache
[I
].NewInstall() == true)
577 List
+= I
.FullName(true) + " ";
578 VersionsList
+= string(Cache
[I
].CurVersion
) + " => " + Cache
[I
].CandVersion
+ "\n";
580 return ShowList(out
,_("The following packages will be DOWNGRADED:"),List
,VersionsList
);
583 // ShowHold - Show held but changed packages /*{{{*/
584 // ---------------------------------------------------------------------
586 bool ShowHold(ostream
&out
,CacheFile
&Cache
)
590 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
592 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
593 if (Cache
[I
].InstallVer
!= (pkgCache::Version
*)I
.CurrentVer() &&
594 I
->SelectedState
== pkgCache::State::Hold
) {
595 List
+= I
.FullName(true) + " ";
596 VersionsList
+= string(Cache
[I
].CurVersion
) + " => " + Cache
[I
].CandVersion
+ "\n";
600 return ShowList(out
,_("The following held packages will be changed:"),List
,VersionsList
);
603 // ShowEssential - Show an essential package warning /*{{{*/
604 // ---------------------------------------------------------------------
605 /* This prints out a warning message that is not to be ignored. It shows
606 all essential packages and their dependents that are to be removed.
607 It is insanely risky to remove the dependents of an essential package! */
608 bool ShowEssential(ostream
&out
,CacheFile
&Cache
)
612 bool *Added
= new bool[Cache
->Head().PackageCount
];
613 for (unsigned int I
= 0; I
!= Cache
->Head().PackageCount
; I
++)
616 for (unsigned J
= 0; J
< Cache
->Head().PackageCount
; J
++)
618 pkgCache::PkgIterator
I(Cache
,Cache
.List
[J
]);
619 if ((I
->Flags
& pkgCache::Flag::Essential
) != pkgCache::Flag::Essential
&&
620 (I
->Flags
& pkgCache::Flag::Important
) != pkgCache::Flag::Important
)
623 // The essential package is being removed
624 if (Cache
[I
].Delete() == true)
626 if (Added
[I
->ID
] == false)
629 List
+= I
.FullName(true) + " ";
630 //VersionsList += string(Cache[I].CurVersion) + "\n"; ???
636 if (I
->CurrentVer
== 0)
639 // Print out any essential package depenendents that are to be removed
640 for (pkgCache::DepIterator D
= I
.CurrentVer().DependsList(); D
.end() == false; ++D
)
642 // Skip everything but depends
643 if (D
->Type
!= pkgCache::Dep::PreDepends
&&
644 D
->Type
!= pkgCache::Dep::Depends
)
647 pkgCache::PkgIterator P
= D
.SmartTargetPkg();
648 if (Cache
[P
].Delete() == true)
650 if (Added
[P
->ID
] == true)
655 snprintf(S
,sizeof(S
),_("%s (due to %s) "),P
.FullName(true).c_str(),I
.FullName(true).c_str());
657 //VersionsList += "\n"; ???
663 return ShowList(out
,_("WARNING: The following essential packages will be removed.\n"
664 "This should NOT be done unless you know exactly what you are doing!"),List
,VersionsList
);
668 // Stats - Show some statistics /*{{{*/
669 // ---------------------------------------------------------------------
671 void Stats(ostream
&out
,pkgDepCache
&Dep
)
673 unsigned long Upgrade
= 0;
674 unsigned long Downgrade
= 0;
675 unsigned long Install
= 0;
676 unsigned long ReInstall
= 0;
677 for (pkgCache::PkgIterator I
= Dep
.PkgBegin(); I
.end() == false; ++I
)
679 if (Dep
[I
].NewInstall() == true)
683 if (Dep
[I
].Upgrade() == true)
686 if (Dep
[I
].Downgrade() == true)
690 if (Dep
[I
].Delete() == false && (Dep
[I
].iFlags
& pkgDepCache::ReInstall
) == pkgDepCache::ReInstall
)
694 ioprintf(out
,_("%lu upgraded, %lu newly installed, "),
698 ioprintf(out
,_("%lu reinstalled, "),ReInstall
);
700 ioprintf(out
,_("%lu downgraded, "),Downgrade
);
702 ioprintf(out
,_("%lu to remove and %lu not upgraded.\n"),
703 Dep
.DelCount(),Dep
.KeepCount());
705 if (Dep
.BadCount() != 0)
706 ioprintf(out
,_("%lu not fully installed or removed.\n"),
710 // YnPrompt - Yes No Prompt. /*{{{*/
711 // ---------------------------------------------------------------------
712 /* Returns true on a Yes.*/
713 bool YnPrompt(bool Default
)
715 /* nl_langinfo does not support LANGUAGE setting, so we unset it here
716 to have the help-message (hopefully) match the expected characters */
717 char * language
= getenv("LANGUAGE");
718 if (language
!= NULL
)
719 language
= strdup(language
);
720 if (language
!= NULL
)
721 unsetenv("LANGUAGE");
724 // TRANSLATOR: Yes/No question help-text: defaulting to Y[es]
725 // e.g. "Do you want to continue? [Y/n] "
726 // The user has to answer with an input matching the
727 // YESEXPR/NOEXPR defined in your l10n.
728 c2out
<< " " << _("[Y/n]") << " " << std::flush
;
730 // TRANSLATOR: Yes/No question help-text: defaulting to N[o]
731 // e.g. "Should this file be removed? [y/N] "
732 // The user has to answer with an input matching the
733 // YESEXPR/NOEXPR defined in your l10n.
734 c2out
<< " " << _("[y/N]") << " " << std::flush
;
736 if (language
!= NULL
)
738 setenv("LANGUAGE", language
, 0);
742 if (_config
->FindB("APT::Get::Assume-Yes",false) == true)
744 // TRANSLATOR: "Yes" answer printed for a yes/no question if --assume-yes is set
745 c1out
<< _("Y") << std::endl
;
748 else if (_config
->FindB("APT::Get::Assume-No",false) == true)
750 // TRANSLATOR: "No" answer printed for a yes/no question if --assume-no is set
751 c1out
<< _("N") << std::endl
;
755 char response
[1024] = "";
756 std::cin
.getline(response
, sizeof(response
));
761 if (strlen(response
) == 0)
767 Res
= regcomp(&Pattern
, nl_langinfo(YESEXPR
),
768 REG_EXTENDED
|REG_ICASE
|REG_NOSUB
);
772 regerror(Res
,&Pattern
,Error
,sizeof(Error
));
773 return _error
->Error(_("Regex compilation error - %s"),Error
);
776 Res
= regexec(&Pattern
, response
, 0, NULL
, 0);
782 // AnalPrompt - Annoying Yes No Prompt. /*{{{*/
783 // ---------------------------------------------------------------------
784 /* Returns true on a Yes.*/
785 bool AnalPrompt(const char *Text
)
788 std::cin
.getline(Buf
,sizeof(Buf
));
789 if (strcmp(Buf
,Text
) == 0)