home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / newc_dev / newlist6.lzh / NewList6 / LinkStuff / DeleteLink.c < prev    next >
C/C++ Source or Header  |  1991-12-18  |  1KB  |  46 lines

  1. /*    DeleteLink  (or NewDeleteLink ;-)  
  2.  *        by
  3.  *    Phil Dietz -- NCEMRSoft 1991
  4.  *
  5.  *    USAGE:    DeleteLink <file>
  6.  *
  7.  *    SUMMARY:  Deletes a soft link pointing to an unmounted file
  8.  *              which Commodore's 'delete' SHOULD do, but doesn't.
  9.  *              Note:  DeleteLink will delete ANY file so use with
  10.  *                     extreme caution!
  11.  *
  12.  *    TIPS:     You know you have a bad soft link when:
  13.  *              NewList6 shows 'link -> :UNKNOWN FILE:
  14.  *          or     "       "   'link -> !some_file
  15.  *
  16.  *              The link is not bad, it's just that you can't delete
  17.  *              the link whenver you want.  That's why deletelink is here.
  18.  *
  19.  *    REQUIREMENTS:  WB2.0 version 37
  20.  *
  21.  *    CAUTION:  DeleteLink will delete ANY file.  Watch what
  22.  *              you are doing!
  23.  *                
  24.  *    COMPILE:  lc -Lt -ccurfist -rr -ms -O -v -b1 DeleteLink.c
  25.  */
  26.  
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <dos/dos.h>
  30. #include <dos/dosextens.h>
  31. #include <clib/dos_protos.h>
  32. #include <pragmas/dos_pragmas.h>
  33.  
  34. extern struct DOSBase *DOSBase;
  35.  
  36. int main(int argc, char **argv)
  37.    {
  38.    if (!(struct DosLibrary *)OpenLibrary("dos.library", 37)) exit(1);
  39.    if (argc<2) 
  40.       {
  41.       PutStr("Usage: DeleteLink <filename>\n");
  42.       exit(1);
  43.       }
  44.    if (!(DeleteFile(argv[1]))) PutStr("Failed.\n");
  45.    }
  46.