Changeset 809 for trunk/src/gmake/kmkbuiltin
- Timestamp:
- Jan 29, 2007, 6:54:36 AM (18 years ago)
- Location:
- trunk/src/gmake/kmkbuiltin
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/kmkbuiltin/cat.c
r611 r809 49 49 #else 50 50 #define NO_UDOM_SUPPORT /* kmk */ 51 #endif 51 #endif 52 52 53 53 #ifndef _MSC_VER 54 # include <sys/param.h>54 # include <sys/param.h> 55 55 #endif 56 56 #include <sys/stat.h> 57 57 #ifndef NO_UDOM_SUPPORT 58 # include <sys/socket.h>59 # include <sys/un.h>60 # include <errno.h>58 # include <sys/socket.h> 59 # include <sys/un.h> 60 # include <errno.h> 61 61 #endif 62 62 … … 68 68 #include <stdlib.h> 69 69 #include <string.h> 70 #ifndef _MSC_VER71 70 #include <unistd.h> 72 #else73 #include "mscfakes.h"74 #endif75 71 #include <stddef.h> 72 73 #ifdef __sun__ 74 # include "solfakes.h" 75 #endif 76 #ifdef _MSC_VER 77 # include "mscfakes.h" 78 #endif 76 79 77 80 int bflag, eflag, nflag, sflag, tflag, vflag; … … 111 114 #ifdef kmk_builtin_cat /* kmk did this already. */ 112 115 setlocale(LC_CTYPE, ""); 113 #endif 116 #endif 114 117 115 118 while ((ch = getopt(argc, argv, "benstuv")) != -1) … … 285 288 #else 286 289 bsize = MAX(sbuf.st_blksize, 1024); 287 #endif 290 #endif 288 291 if ((buf = malloc(bsize)) == NULL) 289 292 return err(1, "buffer"); -
trunk/src/gmake/kmkbuiltin/cp.c
r557 r809 65 65 #include "err.h" 66 66 #include <errno.h> 67 #ifndef _MSC_VER68 67 #include <fts.h> 69 #endif70 68 #include <limits.h> 71 69 #include <signal.h> … … 73 71 #include <stdlib.h> 74 72 #include <string.h> 75 #ifndef _MSC_VER76 73 #include <unistd.h> 77 #else 78 #i nclude "mscfakes.h"79 # include "ftsfake.h"74 75 #ifdef _MSC_VER 76 # include "mscfakes.h" 80 77 #endif 81 78 … … 471 468 if (copy_file(curr, dne)) 472 469 badcp = rval = 1; 473 } else { 470 } else { 474 471 if (copy_link(curr, !dne)) 475 472 badcp = rval = 1; -
trunk/src/gmake/kmkbuiltin/cp_utils.c
r370 r809 37 37 38 38 #ifndef _MSC_VER 39 # include <sys/param.h>40 #endif 39 # include <sys/param.h> 40 #endif 41 41 #include <sys/stat.h> 42 42 #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED 43 # include <sys/mman.h>43 # include <sys/mman.h> 44 44 #endif 45 45 … … 47 47 #include <errno.h> 48 48 #include <fcntl.h> 49 #ifndef _MSC_VER50 49 #include <fts.h> 51 #endif52 50 #include <limits.h> 53 51 #include <stdio.h> 54 52 #include <stdlib.h> 55 53 #include <signal.h> 56 #ifndef _MSC_VER57 54 #include <sysexits.h> 58 55 #include <unistd.h> 59 #else 60 #include "mscfakes.h" 61 #include "ftsfake.h" 62 #endif 56 57 #ifdef __sun__ 58 # include "solfakes.h" 59 #endif 60 #ifdef _MSC_VER 61 # include "mscfakes.h" 62 #endif 63 63 64 64 #include "cp_extern.h" … … 74 74 #ifndef S_ISVTX 75 75 # define S_ISVTX 0 76 #endif 76 #endif 77 77 78 78 int … … 123 123 } 124 124 } 125 125 126 126 if (fflag) { 127 127 /* remove existing destination file name, … … 169 169 entp->fts_path, to.p_path, 170 170 cp_pct(wtotal, fs->st_size)); 171 171 172 172 } 173 173 if (wcount >= (ssize_t)wresid || wcount <= 0) … … 199 199 entp->fts_path, to.p_path, 200 200 cp_pct(wtotal, fs->st_size)); 201 201 202 202 } 203 203 if (wcount >= (ssize_t)wresid || wcount <= 0) -
trunk/src/gmake/kmkbuiltin/fts.c
r621 r809 56 56 #include <stdlib.h> 57 57 #include <string.h> 58 #ifndef _MSC_VER59 58 #include <unistd.h> 60 #else 61 #include "mscfakes.h" 62 #define dirfd(dir) -1 63 #endif 64 #include "ftsfake.h" 59 60 #ifdef __sun__ 61 # include "solfakes.h" 62 # define dirfd(dir) -1 63 #endif 64 #ifdef _MSC_VER 65 # include "mscfakes.h" 66 # define dirfd(dir) -1 67 #endif 65 68 66 69 #if ! HAVE_NBTOOL_CONFIG_H 70 #ifndef __sun__ 67 71 #define HAVE_STRUCT_DIRENT_D_NAMLEN 1 72 #endif 68 73 #endif 69 74 … … 78 83 #endif /* __LIBC12_SOURCE__ */ 79 84 #endif /* __weak_alias */ 80 #endif 85 #endif 81 86 82 87 #ifdef __LIBC12_SOURCE__ … … 120 125 #undef HAVE_STRUCT_DIRENT_D_NAMLEN 121 126 #undef HAVE_FCHDIR 122 #endif 127 #endif 123 128 124 129 #if defined(__EMX__) || defined(_MSC_VER) … … 268 273 if ((sp->fts_rdir = getcwd(NULL, 0)) != NULL) 269 274 SET(FTS_NOCHDIR); 270 #endif 275 #endif 271 276 } 272 277 … … 374 379 if (chdir(sp->fts_rdir)) 375 380 saved_errno = errno; 376 free(sp->fts_rdir); 381 free(sp->fts_rdir); 377 382 sp->fts_rdir = NULL; 378 #endif 383 #endif 379 384 } 380 385 … … 467 472 p->fts_info = FTS_DP; 468 473 return (p); 469 } 474 } 470 475 471 476 /* Rebuild if only read the names and now traversing. */ … … 520 525 #else 521 526 if (CHDIR(sp, sp->fts_rdir)) { 522 #endif 527 #endif 523 528 SET(FTS_STOP); 524 529 return (NULL); … … 587 592 #else 588 593 if (CHDIR(sp, sp->fts_rdir)) { 589 #endif 594 #endif 590 595 SET(FTS_STOP); 591 596 return (NULL); … … 691 696 SET(FTS_NAMEONLY); 692 697 instr = BNAMES; 693 } else 698 } else 694 699 instr = BCHILD; 695 700 … … 913 918 } else if (nlinks == 0 914 919 #ifdef DT_DIR 915 || (nostat && 920 || (nostat && 916 921 dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) 917 922 #endif … … 979 984 #else 980 985 CHDIR(sp, sp->fts_rdir) : 981 #endif 986 #endif 982 987 fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) { 983 988 cur->fts_info = FTS_ERR; … … 1039 1044 errno = 0; 1040 1045 return (FTS_SLNONE); 1041 } 1046 } 1042 1047 p->fts_errno = saved_errno; 1043 1048 goto err; … … 1114 1119 for (ap = sp->fts_array, p = head; p; p = p->fts_link) 1115 1120 *ap++ = p; 1116 qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), 1121 qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), 1117 1122 (int (*)(const void *, const void *))sp->fts_compar); 1118 1123 for (head = *(ap = sp->fts_array); --nitems; ++ap) … … 1222 1227 * Most systems will allow creation of paths much longer than MAXPATHLEN, even 1223 1228 * though the kernel won't resolve them. Round up the new size to a power of 2, 1224 * so we don't realloc the path 2 bytes at a time. 1229 * so we don't realloc the path 2 bytes at a time. 1225 1230 */ 1226 1231 static int -
trunk/src/gmake/kmkbuiltin/ftsfake.h
r621 r809 35 35 #define _FTS_H_ 36 36 37 #ifdef _MSC_VER 38 # include "kmkbuiltin/mscfakes.h" 39 #endif 40 37 41 typedef struct { 38 42 struct _ftsent *fts_cur; /* current node */ … … 60 64 #ifndef _MSC_VER 61 65 #define FTS_WHITEOUT 0x080 /* return whiteout information */ 62 #endif 66 #endif 63 67 #define FTS_OPTIONMASK 0x0ff /* valid user option mask */ 64 68 … … 79 83 #ifndef _MSC_VER 80 84 int fts_symfd; /* fd for symlink */ 81 #endif 85 #endif 82 86 u_short fts_pathlen; /* strlen(fts_path) */ 83 87 u_short fts_namelen; /* strlen(fts_name) */ … … 92 96 #else 93 97 int fts_nlink; /* link count */ 94 #endif 98 #endif 95 99 #endif 96 100 … … 121 125 #ifndef _MSC_VER 122 126 #define FTS_ISW 0x04 /* this is a whiteout object */ 123 #endif 127 #endif 124 128 u_short fts_flags; /* private flags for FTSENT structure */ 125 129 … … 138 142 } FTSENT; 139 143 144 #ifndef __sun__ 140 145 #ifndef _MSC_VER 141 146 #include <sys/cdefs.h> 142 147 __BEGIN_DECLS 143 148 #else 144 #define __RENAME(a) 145 #endif 149 #define __RENAME(a) 150 #endif 151 #endif 146 152 147 #if def __LIBC12_SOURCE__153 #if defined(__LIBC12_SOURCE__) || defined(__sun__) 148 154 FTSENT *fts_children(FTS *, int); 149 155 int fts_close(FTS *); … … 162 168 #endif 163 169 170 #ifndef __sun__ 164 171 #ifndef _MSC_VER 165 172 __END_DECLS 166 173 #endif 174 #endif 167 175 168 176 #endif /* !_FTS_H_ */ -
trunk/src/gmake/kmkbuiltin/install.c
r758 r809 48 48 49 49 #ifndef _MSC_VER 50 # include <sys/param.h>51 # ifdef USE_MMAP52 # include <sys/mman.h>53 # endif54 # include <sys/mount.h>55 # include <sys/wait.h>56 # include <sys/time.h>57 #endif 50 # include <sys/param.h> 51 # ifdef USE_MMAP 52 # include <sys/mman.h> 53 # endif 54 # include <sys/mount.h> 55 # include <sys/wait.h> 56 # include <sys/time.h> 57 #endif /* !_MSC_VER */ 58 58 #include <sys/stat.h> 59 59 … … 62 62 #include <errno.h> 63 63 #include <fcntl.h> 64 #ifndef _MSC_VER65 64 #include <grp.h> 66 65 #include <paths.h> 67 66 #include <pwd.h> 68 #endif69 67 #include <stdio.h> 70 68 #include <stdlib.h> 71 69 #include <string.h> 72 #ifndef _MSC_VER73 70 #include <sysexits.h> 74 71 #include <unistd.h> 75 #else76 #include "mscfakes.h"77 #endif78 72 #if defined(__EMX__) || defined(_MSC_VER) 79 73 # include <process.h> 74 #endif 75 76 #ifdef __sun__ 77 # include "solfakes.h" 78 #endif 79 #ifdef _MSC_VER 80 # include "mscfakes.h" 80 81 #endif 81 82 -
trunk/src/gmake/kmkbuiltin/ln.c
r557 r809 43 43 44 44 #ifndef _MSC_VER 45 # include <sys/param.h>45 # include <sys/param.h> 46 46 #endif 47 47 #include <sys/stat.h> … … 53 53 #include <stdlib.h> 54 54 #include <string.h> 55 #ifndef _MSC_VER56 55 #include <unistd.h> 57 #else 58 #include "mscfakes.h" 56 57 #ifdef __sun__ 58 # include "getopt.h" 59 #endif 60 #ifdef _MSC_VER 61 # include "mscfakes.h" 59 62 #endif 60 63 -
trunk/src/gmake/kmkbuiltin/mkdir.c
r611 r809 48 48 #include <errno.h> 49 49 #ifndef _MSC_VER 50 # include <libgen.h>50 # include <libgen.h> 51 51 #endif 52 52 #include <stdio.h> 53 53 #include <stdlib.h> 54 54 #include <string.h> 55 #ifndef _MSC_VER56 55 #include <sysexits.h> 57 56 #include <unistd.h> 58 #else 59 #include "mscfakes.h" 60 #include <malloc.h> 57 58 #ifdef __sun__ 59 # include "getopt.h" 60 #endif 61 #ifdef _MSC_VER 62 # include <malloc.h> 63 # include "mscfakes.h" 61 64 #endif 62 65 … … 81 84 /* reinitialize globals */ 82 85 vflag = 0; 83 86 84 87 /* kmk: reset getopt and set progname */ 85 88 g_progname = argv[0]; … … 136 139 } else if (vflag) 137 140 (void)printf("%s\n", *argv); 138 141 139 142 if (!success) 140 143 exitval = 1; … … 172 175 p = strchr(p, '\\'); 173 176 } 174 #endif 177 #endif 175 178 176 179 p = path; -
trunk/src/gmake/kmkbuiltin/mscfakes.h
r805 r809 32 32 #include <time.h> 33 33 #include <stdarg.h> 34 #include <malloc.h> 34 35 #undef setmode 35 36 #include "getopt.h" -
trunk/src/gmake/kmkbuiltin/mv.c
r714 r809 49 49 #include <sys/types.h> 50 50 #ifndef _MSC_VER 51 # ifndef __OS2__52 # include <sys/acl.h>53 # endif54 # include <sys/param.h>55 # include <sys/time.h>56 # include <sys/wait.h>57 # include <sys/mount.h>51 # ifndef __OS2__ 52 # include <sys/acl.h> 53 # endif 54 # include <sys/param.h> 55 # include <sys/time.h> 56 # include <sys/wait.h> 57 # include <sys/mount.h> 58 58 #endif 59 59 #include <sys/stat.h> … … 62 62 #include <errno.h> 63 63 #include <fcntl.h> 64 #ifndef _MSC_VER65 64 #include <grp.h> 66 #endif67 65 #include <limits.h> 68 #ifndef _MSC_VER69 66 #include <paths.h> 70 67 #include <pwd.h> 71 #endif72 68 #include <stdio.h> 73 69 #include <stdlib.h> 74 70 #include <string.h> 75 #ifndef _MSC_VER76 71 #include <sysexits.h> 77 72 #include <unistd.h> 78 #else 79 #include "mscfakes.h" 73 74 #ifdef __sun__ 75 # include "solfakes.h" 76 #endif 77 #ifdef _MSC_VER 78 # include "mscfakes.h" 80 79 #endif 81 80 -
trunk/src/gmake/kmkbuiltin/printf.c
r775 r809 51 51 #include "err.h" 52 52 #include <errno.h> 53 #ifndef _MSC_VER54 53 #include <inttypes.h> 55 #endif56 54 #include <limits.h> 57 55 #include <locale.h> … … 60 58 #include <stdlib.h> 61 59 #include <string.h> 62 #ifndef _MSC_VER63 60 #include <unistd.h> 64 #else 65 #include "mscfakes.h" 61 62 #ifdef __sun__ 63 # include "solfakes.h" 64 #endif 65 #ifdef _MSC_VER 66 # include "mscfakes.h" 66 67 #endif 67 68 -
trunk/src/gmake/kmkbuiltin/rm.c
r557 r809 47 47 #include <sys/stat.h> 48 48 #ifndef _MSC_VER 49 # include <sys/param.h>50 # include <sys/mount.h>49 # include <sys/param.h> 50 # include <sys/mount.h> 51 51 #endif 52 52 … … 55 55 #include <fcntl.h> 56 56 #ifdef DO_RMTREE 57 #include <fts.h> 58 #endif 59 #ifndef _MSC_VER 57 # include <fts.h> 58 #endif 60 59 #include <grp.h> 61 60 #include <pwd.h> 62 #endif63 61 #include <stdio.h> 64 62 #include <stdlib.h> 65 63 #include <string.h> 66 #ifndef _MSC_VER67 64 #include <sysexits.h> 68 65 #include <unistd.h> 69 #else 70 #include "mscfakes.h" 66 67 #ifdef __sun__ 68 # include "getopt.h" 69 #endif 70 #ifdef _MSC_VER 71 # include "mscfakes.h" 71 72 #endif 72 73 -
trunk/src/gmake/kmkbuiltin/rmdir.c
r695 r809 49 49 #include <string.h> 50 50 #include <errno.h> 51 #ifndef _MSC_VER52 51 #include <unistd.h> 53 # else54 #include <malloc.h> 55 #i nclude "mscfakes.h"56 # endif57 # include <getopt.h>52 #include "getopt.h" 53 54 #ifdef _MSC_VER 55 # include "mscfakes.h" 56 #endif 58 57 59 58 static int rm_path(char *); … … 82 81 /* reinitialize globals */ 83 82 ignore_fail_on_not_exist = ignore_fail_on_non_empty = vflag = pflag = 0; 84 83 85 84 /* kmk: reset getopt and set progname */ 86 85 g_progname = argv[0]; … … 150 149 p = strchr(p, '\\'); 151 150 } 152 #endif 151 #endif 153 152 154 153 p = path + len; … … 166 165 if (p[-1] == ':' && p - 2 == path) 167 166 break; 168 #endif 167 #endif 169 168 170 169 if (rmdir(path) < 0) {
Note:
See TracChangeset
for help on using the changeset viewer.