1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Cosmetic changes for (hopefully) better readability.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14837 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-02-21 10:22:02 +00:00
parent 18f1f75479
commit c4c25649f2
30 changed files with 93 additions and 77 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: mount_fstatfs.c,v 1.5 2005-02-18 18:53:16 obarthel Exp $
* $Id: mount_fstatfs.c,v 1.6 2005-02-21 10:21:42 obarthel Exp $
*
* :ts=4
*
@ -121,7 +121,7 @@ fstatfs(int file_descriptor, struct statfs *buf)
__convert_info_to_statfs(id,buf);
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: sas_profile.c,v 1.1.1.1 2004-07-26 16:31:04 obarthel Exp $
* $Id: sas_profile.c,v 1.2 2005-02-21 10:21:43 obarthel Exp $
*
* :ts=4
*
@ -133,7 +133,7 @@ send_profiler_message(ULONG clock_value,char * id,ULONG flags)
PutMsg(profiler_port,(struct Message *)spm);
WaitPort(reply_port);
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_ioctl.c,v 1.5 2005-02-18 18:53:16 obarthel Exp $
* $Id: socket_ioctl.c,v 1.6 2005-02-21 10:21:43 obarthel Exp $
*
* :ts=4
*
@ -85,7 +85,7 @@ ioctl(int sockfd,unsigned long request, ... /* char *arg */)
result = __IoctlSocket((LONG)fd->fd_DefaultFile,request,param);
PROFILE_ON();
if(result == OK)
if(result == 0)
{
int * option = (int *)param;

View File

@ -1,5 +1,5 @@
/*
* $Id: stat_fchmod.c,v 1.5 2005-02-18 18:53:16 obarthel Exp $
* $Id: stat_fchmod.c,v 1.6 2005-02-21 10:21:44 obarthel Exp $
*
* :ts=4
*
@ -155,7 +155,7 @@ fchmod(int file_descriptor, mode_t mode)
goto out;
}
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_dropiobreadbuffer.c,v 1.5 2005-02-20 15:46:52 obarthel Exp $
* $Id: stdio_dropiobreadbuffer.c,v 1.6 2005-02-21 10:21:44 obarthel Exp $
*
* :ts=4
*
@ -87,10 +87,10 @@ __drop_iob_read_buffer(struct iob * file)
{
SHOWMSG("that didn't work");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
result = -1;
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(fam.fam_Error);
goto out;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fclose.c,v 1.4 2005-02-20 13:19:40 obarthel Exp $
* $Id: stdio_fclose.c,v 1.5 2005-02-21 10:21:44 obarthel Exp $
*
* :ts=4
*
@ -54,7 +54,7 @@ fclose(FILE *stream)
{
struct iob * file = (struct iob *)stream;
struct file_action_message fam;
int result = OK;
int result = 0;
ENTER();

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fdhookentry.c,v 1.13 2005-02-20 15:46:52 obarthel Exp $
* $Id: stdio_fdhookentry.c,v 1.14 2005-02-21 10:21:45 obarthel Exp $
*
* :ts=4
*
@ -440,7 +440,7 @@ __fd_hook_entry(
break;
}
if(__grow_file_size(fd,new_position - fib->fib_Size) != OK)
if(__grow_file_size(fd,new_position - fib->fib_Size) < 0)
{
fam->fam_Error = __translate_io_error_to_errno(IoErr());
break;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fflush.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fflush.c,v 1.4 2005-02-21 10:21:48 obarthel Exp $
*
* :ts=4
*
@ -110,7 +110,7 @@ fflush(FILE *stream)
}
#endif /* UNIX_PATH_SEMANTICS */
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fgetc.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fgetc.c,v 1.4 2005-02-21 10:21:48 obarthel Exp $
*
* :ts=4
*
@ -81,7 +81,7 @@ int
__fgetc_check(FILE * stream)
{
struct iob * file = (struct iob *)stream;
int result = EOF;
int result = -1;
assert( stream != NULL );
@ -148,7 +148,7 @@ fgetc(FILE *stream)
}
#endif /* CHECK_FOR_NULL_POINTERS */
if(__fgetc_check(stream) != OK)
if(__fgetc_check(stream) < 0)
goto out;
result = __getc(stream);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fgets.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fgets.c,v 1.4 2005-02-21 10:21:48 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ fgets(char *s,int n,FILE *stream)
/* Take care of the checks and data structure changes that
* need to be handled only once for this stream.
*/
if(__fgetc_check(stream) != OK)
if(__fgetc_check(stream) < 0)
{
result = NULL;
goto out;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_filliobreadbuffer.c,v 1.6 2005-02-20 15:46:52 obarthel Exp $
* $Id: stdio_filliobreadbuffer.c,v 1.7 2005-02-21 10:21:48 obarthel Exp $
*
* :ts=4
*
@ -89,11 +89,12 @@ __fill_iob_read_buffer(struct iob * file)
num_bytes_read = (*file->iob_Action)(file,&fam);
if(num_bytes_read < 0)
{
SET_FLAG(file->iob_Flags,IOBF_ERROR);
D(("got error %ld",fam.fam_Error));
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(fam.fam_Error);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_flushiobwritebuffer.c,v 1.5 2005-02-20 15:46:52 obarthel Exp $
* $Id: stdio_flushiobwritebuffer.c,v 1.6 2005-02-21 10:21:48 obarthel Exp $
*
* :ts=4
*
@ -84,6 +84,7 @@ __flush_iob_write_buffer(struct iob * file)
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(fam.fam_Error);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fputc.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fputc.c,v 1.4 2005-02-21 10:21:48 obarthel Exp $
*
* :ts=4
*
@ -72,9 +72,10 @@ __fputc_check(FILE *stream)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -82,9 +83,10 @@ __fputc_check(FILE *stream)
{
SHOWMSG("this stream is not write enabled");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -94,7 +96,7 @@ __fputc_check(FILE *stream)
goto out;
}
result = OK;
result = 0;
out:
@ -148,7 +150,7 @@ fputc(int c,FILE *stream)
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
if(__fputc_check(stream) != OK)
if(__fputc_check(stream) < 0)
goto out;
result = __fputc(c,stream,(file->iob_Flags & IOBF_BUFFER_MODE));

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fputs.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fputs.c,v 1.4 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -79,7 +79,7 @@ fputs(const char *s, FILE *stream)
if(buffer_mode == IOBF_BUFFER_MODE_NONE)
buffer_mode = IOBF_BUFFER_MODE_LINE;
if(__fputc_check(stream) != OK)
if(__fputc_check(stream) < 0)
goto out;
while((c = (*s++)) != '\0')
@ -88,7 +88,7 @@ fputs(const char *s, FILE *stream)
goto out;
}
result = OK;
result = 0;
out:
@ -96,7 +96,7 @@ fputs(const char *s, FILE *stream)
may have buffered data around, queued to be printed right now.
This is intended to improve performance as it takes more effort
to write a single character to a file than to write a bunch. */
if(result == OK && (file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE)
if(result == 0 && (file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE)
{
if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fread.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fread.c,v 1.4 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -82,9 +82,10 @@ fread(void *ptr,size_t element_size,size_t count,FILE *stream)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -92,9 +93,10 @@ fread(void *ptr,size_t element_size,size_t count,FILE *stream)
{
SHOWMSG("this file is not read-enabled");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fseek.c,v 1.5 2005-02-20 15:46:52 obarthel Exp $
* $Id: stdio_fseek.c,v 1.6 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -80,9 +80,10 @@ fseek(FILE *stream, long int offset, int wherefrom)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -90,9 +91,10 @@ fseek(FILE *stream, long int offset, int wherefrom)
{
SHOWMSG("invalid wherefrom parameter");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fsetpos.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fsetpos.c,v 1.4 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -76,7 +76,7 @@ fsetpos(FILE *stream, fpos_t *pos)
goto out;
}
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_ftell.c,v 1.5 2005-02-20 15:46:52 obarthel Exp $
* $Id: stdio_ftell.c,v 1.6 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -74,9 +74,10 @@ ftell(FILE *stream)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_fwrite.c,v 1.4 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_fwrite.c,v 1.5 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -82,9 +82,10 @@ fwrite(const void *ptr,size_t element_size,size_t count,FILE *stream)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -92,9 +93,10 @@ fwrite(const void *ptr,size_t element_size,size_t count,FILE *stream)
{
SHOWMSG("this stream is not write-enabled");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_gets.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_gets.c,v 1.4 2005-02-21 10:21:49 obarthel Exp $
*
* :ts=4
*
@ -75,7 +75,7 @@ gets(char *s)
/* Take care of the checks and data structure changes that
* need to be handled only once for this stream.
*/
if(__fgetc_check(stdin) != OK)
if(__fgetc_check(stdin) < 0)
{
result = NULL;
goto out;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_puts.c,v 1.4 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_puts.c,v 1.5 2005-02-21 10:22:00 obarthel Exp $
*
* :ts=4
*
@ -78,7 +78,7 @@ puts(const char *s)
if(buffer_mode == IOBF_BUFFER_MODE_NONE)
buffer_mode = IOBF_BUFFER_MODE_LINE;
if(__fputc_check(stdout) != OK)
if(__fputc_check(stdout) < 0)
goto out;
while((c = (*s++)) != '\0')
@ -90,7 +90,7 @@ puts(const char *s)
if(__putc('\n',stdout,buffer_mode) == EOF)
goto out;
result = OK;
result = 0;
out:
@ -98,7 +98,7 @@ puts(const char *s)
may have buffered data around, queued to be printed right now.
This is intended to improve performance as it takes more effort
to write a single character to a file than to write a bunch. */
if(result == OK && (file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE)
if(result == 0 && (file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE)
{
if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_record_locking.c,v 1.1 2005-02-18 18:53:16 obarthel Exp $
* $Id: stdio_record_locking.c,v 1.2 2005-02-21 10:22:00 obarthel Exp $
*
* :ts=4
*
@ -1173,7 +1173,7 @@ __handle_record_locking(int cmd,struct flock * l,struct fd * fd,int * error_ptr)
}
}
result = OK;
result = 0;
out:
@ -1186,7 +1186,7 @@ __handle_record_locking(int cmd,struct flock * l,struct fd * fd,int * error_ptr)
UnLock(parent_dir);
PROFILE_ON();
if(result != OK && error != OK)
if(result != 0 && error != OK)
{
SetIoErr(error);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_setvbuf.c,v 1.4 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_setvbuf.c,v 1.5 2005-02-21 10:22:00 obarthel Exp $
*
* :ts=4
*
@ -105,9 +105,10 @@ setvbuf(FILE *stream,char *buf,int bufmode,size_t size)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -183,7 +184,7 @@ setvbuf(FILE *stream,char *buf,int bufmode,size_t size)
new_buffer = NULL;
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_ungetc.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_ungetc.c,v 1.4 2005-02-21 10:22:01 obarthel Exp $
*
* :ts=4
*
@ -74,9 +74,10 @@ ungetc(int c,FILE *stream)
{
SHOWMSG("this file is not even in use");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EBADF);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -85,9 +86,10 @@ ungetc(int c,FILE *stream)
{
SHOWMSG("can't even read from this file");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EACCES);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -96,9 +98,10 @@ ungetc(int c,FILE *stream)
{
SHOWMSG("cannot push back an EOF");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(EINVAL);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}
@ -121,9 +124,10 @@ ungetc(int c,FILE *stream)
{
SHOWMSG("no room to push back");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(ENOBUFS);
SET_FLAG(file->iob_Flags,IOBF_ERROR);
goto out;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_vfprintf.c,v 1.9 2005-02-20 13:19:40 obarthel Exp $
* $Id: stdio_vfprintf.c,v 1.10 2005-02-21 10:22:01 obarthel Exp $
*
* :ts=4
*
@ -172,7 +172,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
assert( FLAG_IS_SET(iob->iob_Flags,IOBF_IN_USE) );
assert( iob->iob_BufferSize > 0 );
if(__fputc_check(stream) != OK)
if(__fputc_check(stream) < 0)
goto out;
while((c = (*format++)) != '\0')

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_vfscanf.c,v 1.8 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_vfscanf.c,v 1.9 2005-02-21 10:22:01 obarthel Exp $
*
* :ts=4
*
@ -98,7 +98,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
}
#endif /* CHECK_FOR_NULL_POINTERS */
if(__fgetc_check(stream) != OK)
if(__fgetc_check(stream) < 0)
goto out;
/* Just so we can detect errors and tell them apart from

View File

@ -1,5 +1,5 @@
/*
* $Id: unistd_fchown.c,v 1.5 2005-02-18 18:53:17 obarthel Exp $
* $Id: unistd_fchown.c,v 1.6 2005-02-21 10:22:02 obarthel Exp $
*
* :ts=4
*
@ -159,7 +159,7 @@ fchown(int file_descriptor, uid_t owner, gid_t group)
goto out;
}
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: unistd_fdatasync.c,v 1.2 2005-02-18 18:53:17 obarthel Exp $
* $Id: unistd_fdatasync.c,v 1.3 2005-02-21 10:22:02 obarthel Exp $
*
* :ts=4
*
@ -79,7 +79,7 @@ fdatasync(int file_descriptor)
__sync_fd(fd,0); /* flush just the data */
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: unistd_fsync.c,v 1.2 2005-02-18 18:53:17 obarthel Exp $
* $Id: unistd_fsync.c,v 1.3 2005-02-21 10:22:02 obarthel Exp $
*
* :ts=4
*
@ -78,7 +78,7 @@ fsync(int file_descriptor)
__sync_fd(fd,1); /* flush everything */
result = OK;
result = 0;
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: unistd_translateu2a.c,v 1.5 2005-02-16 14:48:17 obarthel Exp $
* $Id: unistd_translateu2a.c,v 1.6 2005-02-21 10:22:02 obarthel Exp $
*
* :ts=4
*
@ -105,7 +105,7 @@ __translate_unix_to_amiga_path_name(char const ** name_ptr,struct name_translati
/* Prepend an absolute path to the name, if such a path was previously set
as the current directory. */
if(__translate_relative_path_name((const char **)&name,nti->substitute,sizeof(nti->substitute)) != OK)
if(__translate_relative_path_name((const char **)&name,nti->substitute,sizeof(nti->substitute)) < 0)
{
SHOWMSG("relative path name could not be worked into the pattern");
goto out;