Subversion Repositories Kolibri OS

Rev

Rev 5215 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /* unlink.c -- remove a file.
  2.  *
  3.  * Copyright (c) 1995 Cygnus Support
  4.  *
  5.  * The authors hereby grant permission to use, copy, modify, distribute,
  6.  * and license this software and its documentation for any purpose, provided
  7.  * that existing copyright notices are retained in all copies and that this
  8.  * notice is included verbatim in any distributions. No written agreement,
  9.  * license, or royalty fee is required for any of the authorized uses.
  10.  * Modifications to this software may be copyrighted by their authors
  11.  * and need not follow the licensing terms described here, provided that
  12.  * the new terms are clearly indicated on the first page of each file where
  13.  * they apply.
  14.  */
  15. #include <errno.h>
  16. #include <time.h>
  17. #include <sys/time.h>
  18. #include <sys/times.h>
  19.  
  20. #include "glue.h"
  21.  
  22. static int delete_file(const char *path)
  23. {
  24.      int retval;
  25.      __asm__ __volatile__ (
  26.      "pushl $0 \n\t"
  27.      "pushl $0 \n\t"
  28.      "movl %1, 1(%%esp) \n\t"
  29.      "pushl $0 \n\t"
  30.      "pushl $0 \n\t"
  31.      "pushl $0 \n\t"
  32.      "pushl $0 \n\t"
  33.      "pushl $8 \n\t"
  34.      "movl %%esp, %%ebx \n\t"
  35.      "movl $70, %%eax \n\t"
  36.      "int $0x40 \n\t"
  37.      "addl $28, %%esp \n\t"
  38.      :"=a" (retval)
  39.      :"r" (path)
  40.      :"ebx");
  41.   return retval;
  42. };
  43.  
  44.  
  45. int
  46. _DEFUN (unlink, (path),
  47.         char * path)
  48. {
  49.     int err;
  50.  
  51.     err = delete_file(path);
  52.  
  53.     if (!err)
  54.         return 0;
  55.  
  56.     if (err == 5)
  57.         errno = ENOENT;
  58.     else
  59.         errno = EIO;
  60.  
  61.     return (-1);
  62. }
  63.  
  64. int
  65. _DEFUN(link, (old, new),
  66.        const char *old _AND
  67.        const char *new)
  68. {
  69.   errno = EIO;
  70.   return (-1);
  71. }
  72.  
  73. clock_t
  74. times (struct tms *tp)
  75. {
  76.   return -1;
  77. }
  78.  
  79.