home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / utilities / system / shadowstart10.lha / ShadowStart10 / ShadowStart.c next >
Encoding:
C/C++ Source or Header  |  1994-11-17  |  3.3 KB  |  102 lines

  1. /* $Revision Header built automatically *************** (do not edit) ************
  2. **
  3. ** © Copyright by Lars Eilebrecht (Shadowfox)
  4. **
  5. ** File             : Work:Program/SC/PRG/ShadowStart/ShadowStart.c
  6. ** Created on       : Mittwoch, 16.11.94 17:23:09
  7. ** Created by       : Lars Eilebrecht
  8. ** Current revision : V1.0
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. **     Disable "WBStartup" and/or "User-Startup" during startup.
  14. **
  15. ** Revision V1.0
  16. ** --------------
  17. ** created on Mittwoch, 16.11.94 17:23:09  by  Lars Eilebrecht.   LogMessage :
  18. **     --- Initial release ---
  19. **
  20. *********************************************************************************/
  21. #define REVISION "1.0"
  22. #define REVDATE  "16.11.94"
  23. #define REVTIME  "17:23:09"
  24. #define AUTHOR   "Lars Eilebrecht"
  25. #define VERNUM   1
  26. #define REVNUM   0
  27. #define TITLE "ShadowStart "REVISION" ("REVDATE") © by Lars Eilebrecht (Shadowfox)"
  28.  
  29. #include <stdio.h>
  30. #include <exec/types.h>
  31. #include <intuition/intuition.h>
  32. #include <libraries/lowlevel.h>
  33. #include <libraries/dos.h>
  34.  
  35. #include <clib/exec_protos.h>
  36. #include <clib/intuition_protos.h>
  37.  
  38. #include <proto/lowlevel.h>
  39. #include <proto/dos.h>
  40.  
  41. static const char *ver ="$VER: "TITLE"\0";
  42.  
  43.  
  44. int main (int argc, char **argv)
  45. {
  46.   if(!LowLevelBase)                             // do we have 3.x?
  47.   {
  48.     printf("ShadowStart: Sorry, this program needs Kickstart 3.x!\n");
  49.     return RETURN_FAIL;
  50.   }
  51.   else
  52.   {
  53.     struct KeyQuery spacebar =                  // declare KeyQuery-struct
  54.                       {
  55.                         (UWORD)64,              // rawkeycode for spacebar
  56.                         FALSE,                  // not pressed yet...
  57.                       };
  58.  
  59.     if(Rename("SYS:_WBStartup","SYS:WBStartup"))// rename to original names...
  60.       Rename("SYS:_WBStartup.info","SYS:WBStartup.info");
  61.     Rename("SYS:S/_User-Startup","SYS:S/User-Startup");
  62.  
  63.     QueryKeys(&spacebar,(UBYTE)1);              // dirty spacebar check ;-)
  64.     if(spacebar.kq_Pressed)                     // Was it pressed? Silent exit, if not...
  65.     {
  66.       struct Library *IntuitionBase;
  67.  
  68.       if (IntuitionBase=OpenLibrary("intuition.library",37))
  69.       {
  70.         LONG result;
  71.         struct EasyStruct shadowES =            // declare EasyRequest-struct
  72.                           {
  73.                             sizeof(struct EasyStruct),
  74.                             0, // no flags
  75.                             "ShadowStart "REVISION" ("REVDATE") © by Lars `SFX' Eilebrecht",
  76.                             "\nSelect items to disable during startup.\n",
  77.                             "WBStartup + User-Startup|WBStartup|User-Startup|Cancel",
  78.                           };
  79.  
  80.         result=EasyRequest(NULL,&shadowES,NULL);
  81.         switch (result)
  82.         {                 // note: success of rename-operation isn't checked...
  83.           case 1: 
  84.             Rename("SYS:WBStartup","SYS:_WBStartup");
  85.             Rename("SYS:WBStartup.info","SYS:_WBStartup.info");
  86.             Rename("SYS:S/User-Startup","SYS:S/_User-Startup");
  87.             break;
  88.           case 2:
  89.             Rename("SYS:WBStartup","SYS:_WBStartup");
  90.             Rename("SYS:WBStartup.info","SYS:_WBStartup.info");
  91.             break;
  92.           case 3:
  93.             Rename("SYS:S/User-Startup","SYS:S/_User-Startup");
  94.             break;
  95.         }
  96.         CloseLibrary(IntuitionBase);
  97.       }
  98.     }
  99.     return 0;
  100.   }
  101. }
  102.