compat.c

ソースコードを見る。


関数

char * strdup (char *s)
char * getcwd (char *buf, int size)
pid_t waitpid (pid_t pid, int *statptr, int options)
void * memmove (void *dest, const void *src, size_t n)
char * strpbrk (const char *s, const char *accept)
 Find the first ocurrence in s of any character in accept.
size_t strlcpy (char *d, const char *s, size_t bufsize)
 Like strncpy but does not 0 fill the buffer and always null terminates.
size_t strlcat (char *d, const char *s, size_t bufsize)
 Like strncat() but does not 0 fill the buffer and always null terminates.
int sys_gettimeofday (struct timeval *tv)

関数

char* strdup ( char *  s  ) 

lib/compat.c33 行で定義されています。

参照元 access_match()auth_server()copy_argv()do_cmd()getpassf()gid_to_name()glob_expand()glob_expand_one()parse_size_arg()rsync_module()send_file_list()set_socket_options()setup_merge_file()string_set()uid_to_name().

00034 {
00035   int l = strlen(s) + 1;
00036   char *ret = (char *)malloc(l);
00037   if (ret)
00038     strcpy(ret,s);
00039   return ret;
00040 }

char* getcwd ( char *  buf,
int  size 
)

lib/compat.c44 行で定義されています。

参照元 push_dir().

00045 {
00046         return getwd(buf);
00047 }

pid_t waitpid ( pid_t  pid,
int *  statptr,
int  options 
)

lib/compat.c52 行で定義されています。

参照先 errno.

参照元 remember_children()sigchld_handler()wait_process().

00053 {
00054 #ifdef HAVE_WAIT4
00055         return wait4(pid, statptr, options, NULL);
00056 #else
00057         /* If wait4 is also not available, try wait3 for SVR3 variants */
00058         /* Less ideal because can't actually request a specific pid */
00059         /* At least the WNOHANG option is supported */
00060         /* Code borrowed from apache fragment written by dwd@bell-labs.com */
00061         int tmp_pid, dummystat;;
00062         if (kill(pid, 0) == -1) {
00063                 errno = ECHILD;
00064                 return -1;
00065         }
00066         if (statptr == NULL)
00067                 statptr = &dummystat;
00068         while (((tmp_pid = wait3(statptr, options, 0)) != pid) &&
00069                     (tmp_pid != -1) && (tmp_pid != 0) && (pid != -1))
00070             ;
00071         return tmp_pid;
00072 #endif
00073 }

void* memmove ( void *  dest,
const void *  src,
size_t  n 
)

lib/compat.c78 行で定義されています。

参照元 log_formatted()map_ptr()send_file_list().

00079 {
00080         bcopy((char *) src, (char *) dest, n);
00081         return dest;
00082 }

char* strpbrk ( const char *  s,
const char *  accept 
)

Find the first ocurrence in s of any character in accept.

Derived from glibc

lib/compat.c91 行で定義されています。

参照元 add_rule()set_refuse_options()write_arg().

00092 {
00093         while (*s != '\0')  {
00094                 const char *a = accept;
00095                 while (*a != '\0') {
00096                         if (*a++ == *s) return (char *)s;
00097                 }
00098                 ++s;
00099         }
00100 
00101         return NULL;
00102 }

size_t strlcpy ( char *  d,
const char *  s,
size_t  bufsize 
)

Like strncpy but does not 0 fill the buffer and always null terminates.

引数:
bufsize is the size of the destination buffer.
戻り値:
index of the terminating byte.

lib/compat.c115 行で定義されています。

参照元 add_rule()check_for_hostspec()client_addr()delete_item()do_mknod()gen_challenge()generate_files()get_dirlist()get_tmpname()log_formatted()lp_do_parameter()make_file()open_socket_out()parse_filter_file()parse_merge_name()pathjoin()pop_dir()push_local_filters()receive_file_entry()robust_unlink()run_test()rwrite()send_directory()send_file_entry()send_file_list()send_files()setup_merge_file()timestring().

00116 {
00117         size_t len = strlen(s);
00118         size_t ret = len;
00119         if (bufsize > 0) {
00120                 if (len >= bufsize)
00121                         len = bufsize-1;
00122                 memcpy(d, s, len);
00123                 d[len] = 0;
00124         }
00125         return ret;
00126 }

size_t strlcat ( char *  d,
const char *  s,
size_t  bufsize 
)

Like strncat() but does not 0 fill the buffer and always null terminates.

引数:
bufsize length of the buffer, which should be one more than the maximum resulting string length.

lib/compat.c137 行で定義されています。

参照元 log_formatted().

00138 {
00139         size_t len1 = strlen(d);
00140         size_t len2 = strlen(s);
00141         size_t ret = len1 + len2;
00142 
00143         if (len1 < bufsize - 1) {
00144                 if (len2 >= bufsize - len1)
00145                         len2 = bufsize - len1 - 1;
00146                 memcpy(d+len1, s, len2);
00147                 d[len1+len2] = 0;
00148         }
00149         return ret;
00150 }

int sys_gettimeofday ( struct timeval *  tv  ) 

lib/compat.c154 行で定義されています。

参照元 gen_challenge().

00155 {
00156 #ifdef HAVE_GETTIMEOFDAY_TZ
00157         return gettimeofday(tv, NULL);
00158 #else
00159         return gettimeofday(tv);
00160 #endif
00161 }


rsyncに対してSat Dec 5 19:45:43 2009に生成されました。  doxygen 1.4.7