source:
rtems/contrib/crossrpms/patches/newlib-1.16.0-rtems4.9-20090207.diff
@
deb0a5a3
Last change on this file since deb0a5a3 was deb0a5a3, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/07/09 at 08:56:59 | |
---|---|
|
|
File size: 34.2 KB |
-
newlib/configure.host
diff -Naur newlib-1.16.0.orig/newlib/configure.host newlib-1.16.0/newlib/configure.host
old new 528 528 # NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that. 529 529 *-*-rtems*) 530 530 default_newlib_io_long_long="yes" 531 default_newlib_io_c99_formats="yes" 531 532 newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_OPENDIR -DNO_EXEC -DHAVE_FCNTL" 532 533 ;; 533 534 # VxWorks supplies its own version of malloc, and the newlib one -
newlib/libc/include/getopt.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/getopt.h newlib-1.16.0/newlib/libc/include/getopt.h
old new 89 89 90 90 /* include files needed by this include file */ 91 91 92 /* macros defined by this include file */ 93 #define NO_ARG 0 94 #define REQUIRED_ARG 1 95 #define OPTIONAL_ARG 2 96 97 /* types defined by this include file */ 98 99 struct option 100 { 101 char *name; /* the name of the long option */ 102 int has_arg; /* one of the above macros */ 103 int *flag; /* determines if getopt_long() returns a 104 * value for a long option; if it is 105 * non-NULL, 0 is returned as a function 106 * value and the value of val is stored in 107 * the area pointed to by flag. Otherwise, 108 * val is returned. */ 109 int val; /* determines the value to return if flag is 110 * NULL. */ 111 }; 92 /* These #defines are to keep the namespace clear... */ 93 #define getopt_r __getopt_r 94 #define getopt_long_r __getopt_long_r 95 #define getopt_long_only_r __getopt_long_only_r 112 96 113 97 #ifdef __cplusplus 114 98 extern "C" 115 99 { 116 #endif 100 101 #endif /* __cplusplus */ 102 103 /* types defined by this include file */ 104 struct option 105 { 106 char *name; /* the name of the long option */ 107 int has_arg; /* one of the above macros */ 108 int *flag; /* determines if getopt_long() returns a 109 * value for a long option; if it is 110 * non-NULL, 0 is returned as a function 111 * value and the value of val is stored in 112 * the area pointed to by flag. Otherwise, 113 * val is returned. */ 114 int val; /* determines the value to return if flag is 115 * NULL. */ 116 117 }; 118 119 /* The getopt_data structure is for reentrancy. Its members are similar to 120 the externally-defined variables. */ 121 typedef struct getopt_data 122 { 123 char *optarg; 124 int optind, opterr, optopt, optwhere; 125 } getopt_data; 117 126 118 127 /* externally-defined variables */ 119 128 extern char *optarg; … … 122 131 extern int optopt; 123 132 124 133 /* function prototypes */ 125 int _EXFUN (getopt, (int __argc, char *const __argv[], const char *__optstring)); 126 int _EXFUN (getopt_long, (int __argc, char *const __argv[], const char *__shortopts, const struct option *__longopts, int *__longind)); 127 int _EXFUN (getopt_long_only, (int __argc, char *const __argv[], const char *__shortopts, const struct option *__longopts, int *__longind)); 134 int _EXFUN (getopt, 135 (int __argc, char *const __argv[], const char *__optstring)); 136 137 int _EXFUN (getopt_long, 138 (int __argc, char *const __argv[], const char *__shortopts, 139 const struct option * __longopts, int *__longind)); 140 141 int _EXFUN (getopt_long_only, 142 (int __argc, char *const __argv[], const char *__shortopts, 143 const struct option * __longopts, int *__longind)); 144 145 int _EXFUN (__getopt_r, 146 (int __argc, char *const __argv[], const char *__optstring, 147 struct getopt_data * __data)); 148 149 int _EXFUN (__getopt_long_r, 150 (int __argc, char *const __argv[], const char *__shortopts, 151 const struct option * __longopts, int *__longind, 152 struct getopt_data * __data)); 153 154 int _EXFUN (__getopt_long_only_r, 155 (int __argc, char *const __argv[], const char *__shortopts, 156 const struct option * __longopts, int *__longind, 157 struct getopt_data * __data)); 128 158 129 159 #ifdef __cplusplus 130 160 }; 131 161 132 #endif 162 #endif /* __cplusplus */ 133 163 134 164 #endif /* GETOPT_H */ 135 165 -
newlib/libc/include/inttypes.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/inttypes.h newlib-1.16.0/newlib/libc/include/inttypes.h
old new 242 242 #define SCNxMAX __SCNMAX(x) 243 243 244 244 /* ptr types */ 245 #if __have_longlong64 246 #define __PRIPTR(x) __STRINGIFY(ll##x) 247 #define __SCNPTR(x) __STRINGIFY(ll##x) 245 #if __ptrint_t_long_defined 246 #define __PRIPTR(x) __STRINGIFY(l##x) 247 #define __SCNPTR(x) __STRINGIFY(l##x) 248 #elif __ptrint_t_int_defined 249 #define __PRIPTR(x) __STRINGIFY(x) 250 #define __SCNPTR(x) __STRINGIFY(x) 248 251 #elif __have_long64 249 252 #define __PRIPTR(x) __STRINGIFY(l##x) 250 253 #define __SCNPTR(x) __STRINGIFY(l##x) -
newlib/libc/include/machine/ieeefp.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/machine/ieeefp.h newlib-1.16.0/newlib/libc/include/machine/ieeefp.h
old new 62 62 # define __IEEE_BIG_ENDIAN 63 63 # endif 64 64 #else 65 # define __IEEE_BIG_ENDIAN66 65 # ifdef __ARMEL__ 66 # define __IEEE_LITTLE_ENDIAN 67 # else 68 # define __IEEE_BIG_ENDIAN 69 # endif 70 # ifdef __ARMWEL__ 67 71 # define __IEEE_BYTES_LITTLE_ENDIAN 68 72 # endif 69 73 #endif -
newlib/libc/include/machine/setjmp.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/machine/setjmp.h newlib-1.16.0/newlib/libc/include/machine/setjmp.h
old new 27 27 28 28 /* necv70 was 9 as well. */ 29 29 30 #if def __mc68000__30 #if defined(__m68k__) || defined(__mc68000__) 31 31 /* 32 32 * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, 33 33 * fp2-fp7 for 68881. … … 268 268 # define _CYGWIN_WORKING_SIGSETJMP 269 269 #endif 270 270 271 #ifdef _POSIX_THREADS 272 #define __SIGMASK_FUNC pthread_sigmask 273 #else 274 #define __SIGMASK_FUNC sigprocmask 275 #endif 276 271 277 #if defined(__GNUC__) 272 278 273 279 #define sigsetjmp(env, savemask) \ … … 275 281 ({ \ 276 282 sigjmp_buf *_sjbuf = &(env); \ 277 283 ((*_sjbuf)[_SAVEMASK] = savemask,\ 278 sigprocmask(SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\284 __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\ 279 285 setjmp (*_sjbuf)); \ 280 286 }) 281 287 … … 284 290 ({ \ 285 291 sigjmp_buf *_sjbuf = &(env); \ 286 292 ((((*_sjbuf)[_SAVEMASK]) ? \ 287 sigprocmask(SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\293 __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\ 288 294 : 0), \ 289 295 longjmp (*_sjbuf, val)); \ 290 296 }) … … 292 298 #else /* !__GNUC__ */ 293 299 294 300 #define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\ 295 sigprocmask(SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\301 __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\ 296 302 setjmp (env)) 297 303 298 304 #define siglongjmp(env, val) ((((env)[_SAVEMASK])?\ 299 sigprocmask(SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\305 __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\ 300 306 longjmp (env, val)) 301 307 302 308 #endif 303 309 310 /* POSIX _setjmp/_longjmp macros, maintained for XSI compatibility. These 311 are equivalent to sigsetjmp/siglongjmp when not saving the signal mask. 312 New applications should use sigsetjmp/siglongjmp instead. */ 313 #define _setjmp(env) sigsetjmp ((env), 0) 314 #define _longjmp(env, val) siglongjmp ((env), (val)) 315 304 316 #ifdef __cplusplus 305 317 } 306 318 #endif -
newlib/libc/include/pthread.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/pthread.h newlib-1.16.0/newlib/libc/include/pthread.h
old new 283 283 int _EXFUN(pthread_getcpuclockid, 284 284 (pthread_t __pthread_id, clockid_t *__clock_id)); 285 285 286 /* CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59 */287 288 int _EXFUN(pthread_attr_setcputime,289 (pthread_attr_t *__attr, int __clock_allowed));290 291 int _EXFUN(pthread_attr_getcputime,292 (pthread_attr_t *__attr, int *__clock_allowed));293 294 286 #endif /* defined(_POSIX_THREAD_CPUTIME) */ 295 287 296 288 -
newlib/libc/include/sched.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/sched.h newlib-1.16.0/newlib/libc/include/sched.h
old new 1 #ifndef _SCHED_H_2 #define _SCHED_H_3 4 #ifdef __cplusplus5 extern "C" {6 #endif7 8 #include <sys/sched.h>9 10 #ifdef __cplusplus11 }12 #endif13 14 #endif /* _SCHED_H_ */ -
newlib/libc/include/stdint.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/stdint.h newlib-1.16.0/newlib/libc/include/stdint.h
old new 348 348 #endif 349 349 350 350 /* This must match size_t in stddef.h, currently long unsigned int */ 351 #define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L) 352 #define SIZE_MAX __STDINT_EXP(LONG_MAX) 351 #define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1) 353 352 354 353 /* This must match sig_atomic_t in <signal.h> (currently int) */ 355 354 #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1) … … 393 392 #define UINTMAX_C(x) x##UL 394 393 #endif 395 394 395 #ifdef __rtems__ 396 #include <machine/stdint.h> 397 #endif 396 398 397 399 #ifdef __cplusplus 398 400 } -
newlib/libc/include/sys/features.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/sys/features.h newlib-1.16.0/newlib/libc/include/sys/features.h
old new 38 38 #define _POSIX_MEMLOCK_RANGE 1 39 39 #define _POSIX_MEMORY_PROTECTION 1 40 40 #define _POSIX_MESSAGE_PASSING 1 41 #define _POSIX_MONOTONIC_CLOCK 200112L 41 42 #define _POSIX_PRIORITIZED_IO 1 42 43 #define _POSIX_PRIORITY_SCHEDULING 1 43 44 #define _POSIX_REALTIME_SIGNALS 1 44 45 #define _POSIX_SEMAPHORES 1 45 #define _POSIX_SHARED_MEMORY_OBJECTS 1 46 /* #define _POSIX_SHARED_MEMORY_OBJECTS 1 */ 46 47 #define _POSIX_SYNCHRONIZED_IO 1 47 48 #define _POSIX_TIMERS 1 48 49 #define _POSIX_BARRIERS 200112L -
newlib/libc/include/sys/_types.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/sys/_types.h newlib-1.16.0/newlib/libc/include/sys/_types.h
old new 84 84 typedef void *_iconv_t; 85 85 #endif 86 86 87 typedef long * __intptr_t; 88 typedef unsigned long* __uintptr_t; 89 87 90 #endif /* _SYS__TYPES_H */ -
newlib/libc/include/sys/unistd.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/sys/unistd.h newlib-1.16.0/newlib/libc/include/sys/unistd.h
old new 157 157 pid_t _EXFUN(tcgetpgrp, (int __fildes )); 158 158 int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); 159 159 char _EXFUN(*ttyname, (int __fildes )); 160 #if defined(__CYGWIN__) 160 #if defined(__CYGWIN__) || defined(__rtems__) 161 161 int _EXFUN(ttyname_r, (int, char *, size_t)); 162 162 #endif 163 163 int _EXFUN(unlink, (const char *__path )); … … 219 219 char * _EXFUN(mktemp, (char *)); 220 220 #endif 221 221 222 #if defined(__CYGWIN__) || defined(__SPU__) 222 #if defined(__CYGWIN__) || defined(__SPU__) || defined(__rtems__) 223 223 void _EXFUN(sync, (void)); 224 #elif defined(__rtems__)225 int _EXFUN(sync, (void));226 224 #endif 227 225 228 int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));226 ssize_t _EXFUN(readlink, (const char *__path, char *__buf, size_t __buflen)); 229 227 int _EXFUN(symlink, (const char *__name1, const char *__name2)); 230 228 231 229 #define F_OK 0 -
newlib/libc/include/_syslist.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/_syslist.h newlib-1.16.0/newlib/libc/include/_syslist.h
old new 11 11 #define _fstat fstat 12 12 #define _getpid getpid 13 13 #define _gettimeofday gettimeofday 14 #define _isatty isatty 14 15 #define _kill kill 15 16 #define _link link 16 17 #define _lseek lseek -
newlib/libc/include/time.h
diff -Naur newlib-1.16.0.orig/newlib/libc/include/time.h newlib-1.16.0/newlib/libc/include/time.h
old new 226 226 227 227 #endif 228 228 229 #if defined(_POSIX_MONOTONIC_CLOCK) 230 231 /* The identifier for the system-wide monotonic clock, which is defined 232 as a clock whose value cannot be set via clock_settime() and which 233 cannot have backward clock jumps. */ 234 235 #define CLOCK_MONOTONIC (clockid_t)4 236 237 #endif 238 229 239 #if defined(_POSIX_CPUTIME) 230 240 231 241 /* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */ -
newlib/libc/machine/arm/machine/endian.h
diff -Naur newlib-1.16.0.orig/newlib/libc/machine/arm/machine/endian.h newlib-1.16.0/newlib/libc/machine/arm/machine/endian.h
old new 1 /* ARM configuration file */2 3 #ifndef _MACHINE_ENDIAN_H4 # define _MACHINE_ENDIAN_H5 6 #ifdef __ARMEB__7 #define BYTE_ORDER BIG_ENDIAN8 #else9 #define BYTE_ORDER LITTLE_ENDIAN10 #endif11 12 #endif -
newlib/libc/stdlib/getopt.c
diff -Naur newlib-1.16.0.orig/newlib/libc/stdlib/getopt.c newlib-1.16.0/newlib/libc/stdlib/getopt.c
old new 90 90 #include <getopt.h> 91 91 92 92 /* macros */ 93 #define NO_ARG 0 94 #define REQUIRED_ARG 1 95 #define OPTIONAL_ARG 2 93 96 94 97 /* types */ 95 98 typedef enum GETOPT_ORDERING_T … … 100 103 } GETOPT_ORDERING_T; 101 104 102 105 /* globally-defined variables */ 103 char *optarg = NULL;106 char *optarg = 0; 104 107 int optind = 0; 105 108 int opterr = 1; 106 109 int optopt = '?'; 107 110 111 /* static variables */ 112 static int optwhere = 0; 113 108 114 /* functions */ 109 115 110 116 /* reverse_argv_elements: reverses num elements starting at argv */ 111 117 static void 112 reverse_argv_elements (char ** 118 reverse_argv_elements (char **argv, int num) 113 119 { 114 120 int i; 115 121 char *tmp; … … 126 132 static void 127 133 permute (char *const argv[], int len1, int len2) 128 134 { 129 reverse_argv_elements ((char **) argv, len1);130 reverse_argv_elements ((char **) argv, len1 + len2);131 reverse_argv_elements ((char **) argv, len2);135 reverse_argv_elements ((char **) argv, len1); 136 reverse_argv_elements ((char **) argv, len1 + len2); 137 reverse_argv_elements ((char **) argv, len2); 132 138 } 133 139 134 140 /* is_option: is this argv-element an option or the end of the option list? */ 135 141 static int 136 142 is_option (char *argv_element, int only) 137 143 { 138 return ((argv_element == NULL) 139 || (argv_element[0] == '-') || (only && argv_element[0] == '+')); 144 return ((argv_element == 0) 145 || (argv_element[0] == '-') || (only && argv_element[0] == '+')); 146 } 147 148 /* read_globals: read the values from the globals into a getopt_data 149 structure */ 150 static void 151 read_globals (struct getopt_data *data) 152 { 153 data->optarg = optarg; 154 data->optind = optind; 155 data->opterr = opterr; 156 data->optopt = optopt; 157 data->optwhere = optwhere; 158 } 159 160 /* write_globals: write the values into the globals from a getopt_data 161 structure */ 162 static void 163 write_globals (struct getopt_data *data) 164 { 165 optarg = data->optarg; 166 optind = data->optind; 167 opterr = data->opterr; 168 optopt = data->optopt; 169 optwhere = data->optwhere; 140 170 } 141 171 142 172 /* getopt_internal: the function that does all the dirty work */ 143 173 static int 144 174 getopt_internal (int argc, char *const argv[], const char *shortopts, 145 const struct option *longopts, int *longind, int only) 175 const struct option *longopts, int *longind, int only, 176 struct getopt_data *data) 146 177 { 147 178 GETOPT_ORDERING_T ordering = PERMUTE; 148 static size_t optwhere = 0;149 179 size_t permute_from = 0; 150 180 int num_nonopts = 0; 151 181 int optindex = 0; 152 182 size_t match_chars = 0; 153 char *possible_arg = NULL;183 char *possible_arg = 0; 154 184 int longopt_match = -1; 155 185 int has_arg = -1; 156 char *cp = NULL;186 char *cp = 0; 157 187 int arg_next = 0; 158 188 159 189 /* first, deal with silly parameters and easy stuff */ 160 if (argc == 0 || argv == NULL || (shortopts == NULL && longopts == NULL)) 161 return EOF; 162 if (optind >= argc || argv[optind] == NULL) 190 if (argc == 0 || argv == 0 || (shortopts == 0 && longopts == 0) 191 || data->optind >= argc || argv[data->optind] == 0) 163 192 return EOF; 164 if (strcmp (argv[ optind], "--") == 0)193 if (strcmp (argv[data->optind], "--") == 0) 165 194 { 166 optind++;195 data->optind++; 167 196 return EOF; 168 197 } 198 169 199 /* if this is our first time through */ 170 if ( optind == 0)171 optind =optwhere = 1;200 if (data->optind == 0) 201 data->optind = data->optwhere = 1; 172 202 173 203 /* define ordering */ 174 if (shortopts != NULL&& (*shortopts == '-' || *shortopts == '+'))204 if (shortopts != 0 && (*shortopts == '-' || *shortopts == '+')) 175 205 { 176 206 ordering = (*shortopts == '-') ? RETURN_IN_ORDER : REQUIRE_ORDER; 177 207 shortopts++; 178 208 } 179 209 else 180 ordering = (getenv ("POSIXLY_CORRECT") != NULL) ? REQUIRE_ORDER : PERMUTE;210 ordering = (getenv ("POSIXLY_CORRECT") != 0) ? REQUIRE_ORDER : PERMUTE; 181 211 182 212 /* 183 213 * based on ordering, find our next option, if we're at the beginning of 184 214 * one 185 215 */ 186 if ( optwhere == 1)216 if (data->optwhere == 1) 187 217 { 188 218 switch (ordering) 189 { 190 case PERMUTE: 191 permute_from = optind; 192 num_nonopts = 0; 193 while (!is_option (argv[optind], only)) 194 { 195 optind++; 196 num_nonopts++; 197 } 198 if (argv[optind] == NULL) 199 { 200 /* no more options */ 201 optind = permute_from; 202 return EOF; 203 } 204 else if (strcmp (argv[optind], "--") == 0) 205 { 206 /* no more options, but have to get `--' out of the way */ 207 permute (argv + permute_from, num_nonopts, 1); 208 optind = permute_from + 1; 209 return EOF; 210 } 211 break; 212 case RETURN_IN_ORDER: 213 if (!is_option (argv[optind], only)) 214 { 215 optarg = argv[optind++]; 216 return (optopt = 1); 217 } 218 break; 219 case REQUIRE_ORDER: 220 if (!is_option (argv[optind], only)) 221 return EOF; 222 break; 223 } 219 { 220 default: /* shouldn't happen */ 221 case PERMUTE: 222 permute_from = data->optind; 223 num_nonopts = 0; 224 while (!is_option (argv[data->optind], only)) 225 { 226 data->optind++; 227 num_nonopts++; 228 } 229 if (argv[data->optind] == 0) 230 { 231 /* no more options */ 232 data->optind = permute_from; 233 return EOF; 234 } 235 else if (strcmp (argv[data->optind], "--") == 0) 236 { 237 /* no more options, but have to get `--' out of the way */ 238 permute (argv + permute_from, num_nonopts, 1); 239 data->optind = permute_from + 1; 240 return EOF; 241 } 242 break; 243 case RETURN_IN_ORDER: 244 if (!is_option (argv[data->optind], only)) 245 { 246 data->optarg = argv[data->optind++]; 247 return (data->optopt = 1); 248 } 249 break; 250 case REQUIRE_ORDER: 251 if (!is_option (argv[data->optind], only)) 252 return EOF; 253 break; 254 } 224 255 } 225 256 /* we've got an option, so parse it */ 226 257 227 258 /* first, is it a long option? */ 228 if (longopts != NULL229 && (memcmp (argv[ optind], "--", 2) == 0230 || (only && argv[optind][0] == '+')) &&optwhere == 1)259 if (longopts != 0 260 && (memcmp (argv[data->optind], "--", 2) == 0 261 || (only && argv[data->optind][0] == '+')) && data->optwhere == 1) 231 262 { 232 263 /* handle long options */ 233 if (memcmp (argv[ optind], "--", 2) == 0)234 264 if (memcmp (argv[data->optind], "--", 2) == 0) 265 data->optwhere = 2; 235 266 longopt_match = -1; 236 possible_arg = strchr (argv[ optind] +optwhere, '=');237 if (possible_arg == NULL)238 239 240 match_chars = strlen (argv[optind]);241 possible_arg = argv[optind] + match_chars;242 match_chars = match_chars -optwhere;243 267 possible_arg = strchr (argv[data->optind] + data->optwhere, '='); 268 if (possible_arg == 0) 269 { 270 /* no =, so next argv might be arg */ 271 match_chars = strlen (argv[data->optind]); 272 possible_arg = argv[data->optind] + match_chars; 273 match_chars = match_chars - data->optwhere; 274 } 244 275 else 245 match_chars = (possible_arg - argv[optind]) - optwhere; 246 for (optindex = 0; longopts[optindex].name != NULL; optindex++) 247 { 248 if (memcmp (argv[optind] + optwhere, 249 longopts[optindex].name, match_chars) == 0) 250 { 251 /* do we have an exact match? */ 252 if (match_chars == (int) (strlen (longopts[optindex].name))) 253 { 254 longopt_match = optindex; 255 break; 256 } 257 /* do any characters match? */ 258 else 259 { 260 if (longopt_match < 0) 261 longopt_match = optindex; 262 else 263 { 264 /* we have ambiguous options */ 265 if (opterr) 266 fprintf (stderr, "%s: option `%s' is ambiguous " 267 "(could be `--%s' or `--%s')\n", 268 argv[0], 269 argv[optind], 270 longopts[longopt_match].name, 271 longopts[optindex].name); 272 return (optopt = '?'); 273 } 274 } 275 } 276 } 276 match_chars = (possible_arg - argv[data->optind]) - data->optwhere; 277 for (optindex = 0; longopts[optindex].name != 0; ++optindex) 278 { 279 if (memcmp 280 (argv[data->optind] + data->optwhere, longopts[optindex].name, 281 match_chars) == 0) 282 { 283 /* do we have an exact match? */ 284 if (match_chars == (int) (strlen (longopts[optindex].name))) 285 { 286 longopt_match = optindex; 287 break; 288 } 289 /* do any characters match? */ 290 else 291 { 292 if (longopt_match < 0) 293 longopt_match = optindex; 294 else 295 { 296 /* we have ambiguous options */ 297 if (data->opterr) 298 fprintf (stderr, "%s: option `%s' is ambiguous " 299 "(could be `--%s' or `--%s')\n", 300 argv[0], 301 argv[data->optind], 302 longopts[longopt_match].name, 303 longopts[optindex].name); 304 return (data->optopt = '?'); 305 } 306 } 307 } 308 } 277 309 if (longopt_match >= 0) 278 310 has_arg = longopts[longopt_match].has_arg; 279 311 } 312 280 313 /* if we didn't find a long option, is it a short option? */ 281 if (longopt_match < 0 && shortopts != NULL)314 if (longopt_match < 0 && shortopts != 0) 282 315 { 283 cp = strchr (shortopts, argv[ optind][optwhere]);284 if (cp == NULL)285 286 287 if (opterr)288 289 290 argv[0], argv[optind][optwhere]);291 292 if (argv[optind][optwhere] == '\0')293 294 295 296 297 return (optopt = '?');298 316 cp = strchr (shortopts, argv[data->optind][data->optwhere]); 317 if (cp == 0) 318 { 319 /* couldn't find option in shortopts */ 320 if (data->opterr) 321 fprintf (stderr, 322 "%s: invalid option -- `-%c'\n", 323 argv[0], argv[data->optind][data->optwhere]); 324 data->optwhere++; 325 if (argv[data->optind][data->optwhere] == '\0') 326 { 327 data->optind++; 328 data->optwhere = 1; 329 } 330 return (data->optopt = '?'); 331 } 299 332 has_arg = ((cp[1] == ':') 300 301 possible_arg = argv[ optind] +optwhere + 1;302 optopt = *cp;333 ? ((cp[2] == ':') ? OPTIONAL_ARG : REQUIRED_ARG) : NO_ARG); 334 possible_arg = argv[data->optind] + data->optwhere + 1; 335 data->optopt = *cp; 303 336 } 304 /* get argument and reset optwhere */ 337 338 /* get argument and reset data->optwhere */ 305 339 arg_next = 0; 306 340 switch (has_arg) 307 341 { 308 342 case OPTIONAL_ARG: 309 343 if (*possible_arg == '=') 310 possible_arg++; 311 if (*possible_arg != '\0') 312 { 313 optarg = possible_arg; 314 optwhere = 1; 315 } 316 else 317 optarg = NULL; 344 possible_arg++; 345 data->optarg = (*possible_arg != '\0') ? possible_arg : 0; 346 data->optwhere = 1; 318 347 break; 319 348 case REQUIRED_ARG: 320 349 if (*possible_arg == '=') 321 350 possible_arg++; 322 351 if (*possible_arg != '\0') 323 324 325 326 327 else if ( optind + 1 >= argc)328 329 if (opterr)330 331 332 333 334 335 336 337 338 return (optopt = ':');339 352 { 353 data->optarg = possible_arg; 354 data->optwhere = 1; 355 } 356 else if (data->optind + 1 >= argc) 357 { 358 if (data->opterr) 359 { 360 fprintf (stderr, "%s: argument required for option `", argv[0]); 361 if (longopt_match >= 0) 362 fprintf (stderr, "--%s'\n", longopts[longopt_match].name); 363 else 364 fprintf (stderr, "-%c'\n", *cp); 365 } 366 data->optind++; 367 return (data->optopt = ':'); 368 } 340 369 else 341 342 optarg = argv[optind + 1];343 344 345 370 { 371 data->optarg = argv[data->optind + 1]; 372 arg_next = 1; 373 data->optwhere = 1; 374 } 346 375 break; 376 default: /* shouldn't happen */ 347 377 case NO_ARG: 348 378 if (longopt_match < 0) 349 350 351 if (argv[optind][optwhere] == '\0')352 353 379 { 380 data->optwhere++; 381 if (argv[data->optind][data->optwhere] == '\0') 382 data->optwhere = 1; 383 } 354 384 else 355 356 optarg = NULL;385 data->optwhere = 1; 386 data->optarg = 0; 357 387 break; 358 388 } 359 389 360 /* do we have to permute or otherwise modify optind? */361 if (ordering == PERMUTE && optwhere == 1 && num_nonopts != 0)390 /* do we have to permute or otherwise modify data->optind? */ 391 if (ordering == PERMUTE && data->optwhere == 1 && num_nonopts != 0) 362 392 { 363 393 permute (argv + permute_from, num_nonopts, 1 + arg_next); 364 optind = permute_from + 1 + arg_next;394 data->optind = permute_from + 1 + arg_next; 365 395 } 366 else if ( optwhere == 1)367 optind =optind + 1 + arg_next;396 else if (data->optwhere == 1) 397 data->optind = data->optind + 1 + arg_next; 368 398 369 399 /* finally return */ 370 400 if (longopt_match >= 0) 371 401 { 372 if (longind != NULL)373 374 if (longopts[longopt_match].flag != NULL)375 376 377 378 402 if (longind != 0) 403 *longind = longopt_match; 404 if (longopts[longopt_match].flag != 0) 405 { 406 *(longopts[longopt_match].flag) = longopts[longopt_match].val; 407 return 0; 408 } 379 409 else 380 410 return longopts[longopt_match].val; 381 411 } 382 412 else 383 return optopt;413 return data->optopt; 384 414 } 385 415 386 416 int 387 417 getopt (int argc, char *const argv[], const char *optstring) 388 418 { 389 return getopt_internal (argc, argv, optstring, NULL, NULL, 0); 419 struct getopt_data data; 420 int r; 421 422 read_globals (&data); 423 r = getopt_internal (argc, argv, optstring, 0, 0, 0, &data); 424 write_globals (&data); 425 return r; 390 426 } 391 427 392 428 int 393 429 getopt_long (int argc, char *const argv[], const char *shortopts, 394 430 const struct option *longopts, int *longind) 395 431 { 396 return getopt_internal (argc, argv, shortopts, longopts, longind, 0); 432 struct getopt_data data; 433 int r; 434 435 read_globals (&data); 436 r = getopt_internal (argc, argv, shortopts, longopts, longind, 0, &data); 437 write_globals (&data); 438 return r; 397 439 } 398 440 399 441 int 400 442 getopt_long_only (int argc, char *const argv[], const char *shortopts, 401 const struct option *longopts, int *longind) 443 const struct option *longopts, int *longind) 444 { 445 struct getopt_data data; 446 int r; 447 448 read_globals (&data); 449 r = getopt_internal (argc, argv, shortopts, longopts, longind, 1, &data); 450 write_globals (&data); 451 return r; 452 } 453 454 int 455 __getopt_r (int argc, char *const argv[], const char *optstring, 456 struct getopt_data *data) 457 { 458 return getopt_internal (argc, argv, optstring, 0, 0, 0, data); 459 } 460 461 int 462 __getopt_long_r (int argc, char *const argv[], const char *shortopts, 463 const struct option *longopts, int *longind, 464 struct getopt_data *data) 465 { 466 return getopt_internal (argc, argv, shortopts, longopts, longind, 0, data); 467 } 468 469 int 470 __getopt_long_only_r (int argc, char *const argv[], const char *shortopts, 471 const struct option *longopts, int *longind, 472 struct getopt_data *data) 402 473 { 403 return getopt_internal (argc, argv, shortopts, longopts, longind, 1 );474 return getopt_internal (argc, argv, shortopts, longopts, longind, 1, data); 404 475 } 405 476 406 477 /* end of file GETOPT.C */ -
newlib/libc/sys/rtems/machine/stdint.h
diff -Naur newlib-1.16.0.orig/newlib/libc/sys/rtems/machine/stdint.h newlib-1.16.0/newlib/libc/sys/rtems/machine/stdint.h
old new 1 /* 2 * 3 */ 4 #ifndef _MACHINE_STDINT_H 5 #define _MACHINE_STDINT_H 6 7 #ifndef _STDINT_H 8 #error machine/stdint.h is an internal file and must not be directly included 9 #endif 10 11 #ifndef __rtems__ 12 #error machine/stdint.h is an RTEMS specific internal file and must not be used otherwise 13 #endif 14 15 #if defined(__sparc__) \ 16 || defined(__powerpc__) || defined(__PPC__) \ 17 || defined(__mips__) \ 18 || defined(__sh__) \ 19 || defined(__AVR__) \ 20 || defined(_C4x) || defined(_C3x) \ 21 || defined(__H8300__) 22 /* PTRDIFF_TYPE = int */ 23 #define __ptrint_t_int_defined 1 24 #endif 25 26 #if defined(__i386__) \ 27 || defined(__m68k__) \ 28 || defined(__bfin__) \ 29 || defined(__arm__) \ 30 || defined(__H8300S__) || defined(__H8300H__) 31 /* PTRDIFF_TYPE = long */ 32 #define __ptrint_t_long_defined 1 33 #endif 34 35 #endif -
newlib/libc/sys/rtems/sys/param.h
diff -Naur newlib-1.16.0.orig/newlib/libc/sys/rtems/sys/param.h newlib-1.16.0/newlib/libc/sys/rtems/sys/param.h
old new 93 93 #include <sys/resource.h> 94 94 #include <sys/ucred.h> 95 95 #include <sys/uio.h> 96 #include <sys/rtprio.h>97 96 98 97 #ifndef FALSE 99 98 #define FALSE 0 -
newlib/Makefile.am
diff -Naur newlib-1.16.0.orig/newlib/Makefile.am newlib-1.16.0/newlib/Makefile.am
old new 81 81 libc.a 82 82 endif 83 83 84 noinst_DATA= stmp-targ-include84 BUILT_SOURCES = stmp-targ-include 85 85 86 86 toollib_DATA = $(CRT0) $(CRT1) 87 87 … … 186 186 187 187 $(CRT1_DIR)$(CRT1): ; @true 188 188 189 190 all-recursive: stmp-targ-include191 192 189 # The targ-include directory just holds the includes files for the 193 190 # particular system and machine we have been configured for. It is 194 191 # used while building. -
newlib/Makefile.in
diff -Naur newlib-1.16.0.orig/newlib/Makefile.in newlib-1.16.0/newlib/Makefile.in
old new 105 105 pdf-recursive ps-recursive uninstall-info-recursive \ 106 106 uninstall-recursive 107 107 toollibDATA_INSTALL = $(INSTALL_DATA) 108 DATA = $( noinst_DATA) $(toollib_DATA)108 DATA = $(toollib_DATA) 109 109 ETAGS = etags 110 110 CTAGS = ctags 111 111 DEJATOOL = $(PACKAGE) … … 339 339 @USE_LIBTOOL_FALSE@toollib_LIBRARIES = libm.a \ 340 340 @USE_LIBTOOL_FALSE@ libc.a 341 341 342 noinst_DATA= stmp-targ-include342 BUILT_SOURCES = stmp-targ-include 343 343 toollib_DATA = $(CRT0) $(CRT1) 344 344 345 345 # The functions ldexp, frexp and modf are traditionally supplied in … … 398 398 399 399 # dejagnu support 400 400 RUNTESTFLAGS = 401 all: newlib.h401 all: $(BUILT_SOURCES) newlib.h 402 402 $(MAKE) $(AM_MAKEFLAGS) all-recursive 403 403 404 404 .SUFFIXES: … … 703 703 done 704 704 check-am: 705 705 $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU 706 check: check-recursive 706 check: $(BUILT_SOURCES) 707 $(MAKE) $(AM_MAKEFLAGS) check-recursive 707 708 all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) newlib.h 708 709 installdirs: installdirs-recursive 709 710 installdirs-am: 710 711 for dir in "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)"; do \ 711 712 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 712 713 done 713 install: install-recursive 714 install: $(BUILT_SOURCES) 715 $(MAKE) $(AM_MAKEFLAGS) install-recursive 714 716 install-exec: install-exec-recursive 715 717 install-data: install-data-recursive 716 718 uninstall: uninstall-recursive … … 735 737 maintainer-clean-generic: 736 738 @echo "This command is intended for maintainers to use" 737 739 @echo "it deletes files that may require special tools to rebuild." 740 -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) 738 741 clean: clean-recursive 739 742 740 743 clean-am: clean-generic clean-libtool clean-toollibLIBRARIES \ … … 853 856 854 857 $(CRT1_DIR)$(CRT1): ; @true 855 858 856 all-recursive: stmp-targ-include857 858 859 # The targ-include directory just holds the includes files for the 859 860 # particular system and machine we have been configured for. It is 860 861 # used while building.
Note: See TracBrowser
for help on using the repository browser.