From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-01-09 13:02:35
Hi! On Tue, Jan 07, 2003 at 10:49:10AM +0100, Piotr Fusik wrote: > >>> There could be: > >>> #define creat(name,mode) open(name,O_WRONLY|O_CREAT|O_TRUNC,mode) Makes sense. However, a real function would be even better, because it saves some code compared to a macro. I will add the macro now and add a creat function later when I have more time. > typedef long int off_t; > int __fastcall__ close (int fd); > int __fastcall__ write (int fd, const void* buf, unsigned count); > int __fastcall__ read (int fd, void* buf, unsigned count); > int rmdir (const char* name); > off_t __fastcall__ lseek(int fd, off_t offset, int whence); > > >>> I think these should go to unistd.h, together with: > >>> #define SEEK_SET 0 > >>> #define SEEK_CUR 1 > >>> #define SEEK_END 2 > >>> (note these defines are wrong in stdio.h) Using fcntl.h is the DOS/Windows way, using unistd.h is the Unix way. Since I didn't expect fcntl.h to grow, and unistd.h suggests Unix compatibility which is not possible, after some discussion fcntl.h was choosen instead of unistd.h. Regarding the #defines for seek: The C standard says that these have to go into stdio.h, so they are in the right place. Regarding the values: The standard does not say anything about the values of these constants, the it's up to the implementation to choose them as fits. Why do you think the values are wrong? > int mkdir (const char* name, ...); /* May take a mode argument */ > > >>> Should go to sys/stat.h. Same as above: DOS has it in fcntl.h. > stdio.h: > > #define unlink(name) remove (name) /* Unix */ > > >>> Should go to unistd.h. Dito. > Probably exporting 'unlink' equal to 'remove' > >>> is better than a macro. Since there is no module implementing "remove", this is not possible:-) There is a remove.s in my libsrc/common directory, but it hasn't been checked into the repository, because I will have to check back with Christian before doing so. But the idea itself is good, so once there is code for remove, I will use your suggested change. Thanks for all the feedback! Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-01-09 13:02:43 CET