Main Page | Alphabetical List | Class List | File List | Class Members | File Members

unistd.h

Go to the documentation of this file.
00001 /* =============
00002  * apeNEXT/nlibc
00003  * =============
00004  *
00005  * $Id: unistd.h,v 1.1 2006/05/06 08:17:18 pleiter Exp $
00006  * -------------------------------------------------------------------------- */
00007 
00008 #ifndef _NLIBC_OS1_UNISTD_H
00009 #define _NLIBC_OS1_UNISTD_H
00010 
00011 #include <nlibc.h>
00012 
00013 #include <os1/defs_os1.h>
00014 #include <errno.h>
00015 
00016 /* -------------------------------------------------------------------------- */
00047 /* -------------------------------------------------------------------------- */
00048 
00049 #ifndef __HAS_MAIN
00050 extern int unlink(const char*);
00051 #else
00052 #if !defined(__cflow_processed) || defined(_uses_unlink_unistd_h)
00053 int unlink(const char* pathname)
00054 {
00055   int ret;
00056   vector int sys_rval;
00057 
00058   asm("\t$sys_sh($SYS_SHCMD_UNLINK, %1)\n"
00059       "\tlmtr %0 $MEM_SYS_RVAL\n"
00060       : "=r" (sys_rval) : "r" (pathname));
00061 
00062   ret = 0;
00063   where (sys_rval.lo) {
00064     ret = -1;
00065   }
00066   where (sys_rval.lo == 1) {
00067     errno = sys_rval.hi;
00068   }
00069 
00070   return ret;
00071 }
00072 #endif // _uses_unlink_unistd_h
00073 #endif // Has Main
00074 
00075 
00076 
00077 /* -------------------------------------------------------------------------- */
00096 /* -------------------------------------------------------------------------- */
00097 
00098 #ifndef __HAS_MAIN
00099 extern int rmdir(const char*);
00100 #else
00101 #if !defined(__cflow_processed) || defined(_uses_rmdir_unistd_h)
00102 int rmdir(const char* pathname)
00103 {
00104   int ret;
00105   vector int sys_rval;
00106 
00107   asm("\t$sys_sh($SYS_SHCMD_RMDIR, %1)\n"
00108       "\tlmtr %0 $MEM_SYS_RVAL\n"
00109       : "=r" (sys_rval) : "r" (pathname));
00110 
00111   ret = 0;
00112   where (sys_rval.lo) {
00113     ret = -1;
00114   }
00115   where (sys_rval.lo == 1) {
00116     errno = sys_rval.hi;
00117   }
00118 
00119   return ret;
00120 }
00121 #endif // _uses_rmdir_unistd_h
00122 #endif // Has Main
00123 
00124 #endif /* _NLIBC_OS1_UNISTD_H */

Generated on Fri Jul 14 10:51:32 2006 for nlibc by doxygen 1.3.5