You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.3 KiB

  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: pkgsystem.cc,v 1.3 2004/02/27 00:43:16 mdz Exp $
  4. /* ######################################################################
  5. System - Abstraction for running on different systems.
  6. Basic general structure..
  7. ##################################################################### */
  8. /*}}}*/
  9. // Include Files /*{{{*/
  10. #include <apt-pkg/pkgsystem.h>
  11. #include <apt-pkg/policy.h>
  12. #include <cassert>
  13. #include <cstring>
  14. /*}}}*/
  15. pkgSystem *_system = 0;
  16. static pkgSystem *SysList[10];
  17. pkgSystem **pkgSystem::GlobalList = SysList;
  18. unsigned long pkgSystem::GlobalListLen = 0;
  19. // System::pkgSystem - Constructor /*{{{*/
  20. // ---------------------------------------------------------------------
  21. /* Add it to the global list.. */
  22. pkgSystem::pkgSystem()
  23. {
  24. assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
  25. SysList[GlobalListLen] = this;
  26. GlobalListLen++;
  27. }
  28. /*}}}*/
  29. // System::GetSystem - Get the named system /*{{{*/
  30. // ---------------------------------------------------------------------
  31. /* */
  32. pkgSystem *pkgSystem::GetSystem(const char *Label)
  33. {
  34. for (unsigned I = 0; I != GlobalListLen; I++)
  35. if (strcmp(SysList[I]->Label,Label) == 0)
  36. return SysList[I];
  37. return 0;
  38. }
  39. /*}}}*/