home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / UNSYS11.ZIP / UNSYS11.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-02-19  |  3.4 KB  |  105 lines

  1. /******************************************************************************/
  2. /* Program : UNSYS.C                                Creation Date: 08-12-1987 */
  3. /*                                                       Modified: 08-12-1987 */
  4. /* Author  : Richard P. Hendricks                   Last Modified: 02-19-1988 */
  5. /* Compiler: Turbo C, Version 1.0 Adapted from Lattice C Version 3.0          */
  6. /*                                02/05/87...02/05/87                         */
  7. /* Function: Remove the System Files from a disk, IBMDOS.COM, IBMBIO.COM and  */
  8. /*            COMMAND.COM. IBMDOS.COM and IBMBIO.COM are Hidden-System files  */
  9. /*            so these attributes must be removed before the file can be      */
  10. /*            deleted.                                                        */
  11. /*            - Version 1.0 Original Release                       08/12/1987 */
  12. /*            - Version 1.1 - Corrected OK/Failed Messages         02/19/1988 */
  13. /*                            to reflect that processing was                  */
  14. /*                            successful or not                               */
  15. /*                          - Commented on _chmod() function                  */
  16. /*                          - Used __DATE__ pre-define                        */
  17. /******************************************************************************/
  18. #include <stdio.h>
  19. #include <stat.h>
  20. #include <io.h>
  21. #include <dos.h>
  22.  
  23. #define FUNC_SET_ACCESS_MODE     1
  24.  
  25. main()
  26. {
  27. printf("UNSYS                    Version 1.1                 Date: %s\n", __DATE__ );
  28. printf("Function: Removes the System files that are placed on a drive through\n");
  29. printf("           the FORMAT d:/S or SYS d: commands.\n\n");
  30.  
  31. /******************************************************************************\
  32. **  _CHMOD() attempts to change the file attribute to the one designated. If  **
  33. **  successful then it returns a 0 status. If it fails then it returns a -1   **
  34. **  and toggles the attribute. Example: file is hidden, _chmod( ..FA_HIDDEN ) **
  35. **  will fail and the file will be un-hidden.                                 **
  36. \******************************************************************************/
  37.  
  38. printf("Removing IBMBIO.COM..unhide file..");
  39. if( _chmod("IBMBIO.COM",FUNC_SET_ACCESS_MODE,FA_HIDDEN) != 0 )
  40.    {
  41.    printf("OK");
  42.    }
  43.    else
  44.    {
  45.    printf("failed");
  46.    }
  47. printf("..remove system flag..");
  48. if( _chmod("IBMBIO.COM",FUNC_SET_ACCESS_MODE,FA_SYSTEM) != 0 )
  49.    {
  50.    printf("OK");
  51.    }
  52.    else
  53.    {
  54.    printf("failed");
  55.    }
  56. printf("..delete file..");
  57. if( unlink("IBMBIO.COM") == 0 )
  58.    {
  59.    printf("OK\n");
  60.    }
  61.    else
  62.    {
  63.    printf("failed\n");
  64.    }
  65.  
  66. printf("Removing IBMDOS.COM..unhide file..");
  67. if( _chmod("IBMDOS.COM",FUNC_SET_ACCESS_MODE,FA_HIDDEN) != 0 )
  68.    {
  69.    printf("OK");
  70.    }
  71.    else
  72.    {
  73.    printf("failed");
  74.    }
  75. printf("..remove system flag..");
  76. if( _chmod("IBMDOS.COM",FUNC_SET_ACCESS_MODE,FA_SYSTEM) != 0 )
  77.   {
  78.   printf("OK");
  79.   }
  80.   else
  81.   {
  82.   printf("failed");
  83.   }
  84. printf("..delete file..");
  85. if( unlink("IBMDOS.COM") == 0 )
  86.   {
  87.   printf("OK\n");
  88.   }
  89.   else
  90.   {
  91.   printf("failed\n");
  92.   }
  93.  
  94. printf("Removing COMMAND.COM.delete file..");
  95. if( unlink("COMMAND.COM") == 0 )
  96.   {
  97.   printf("OK\n");
  98.   }
  99.   else
  100.   {
  101.   printf("failed\n");
  102.   }
  103. }
  104. /* end-of-file                     UNSYS.C                       end-of-file */
  105.