Ignore:
Timestamp:
Jan 29, 2007, 6:54:36 AM (18 years ago)
Author:
bird
Message:

Solaris + cleanup.

Location:
trunk/src/gmake/kmkbuiltin
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/kmkbuiltin/cat.c

    r611 r809  
    4949#else
    5050#define NO_UDOM_SUPPORT /* kmk */
    51 #endif 
     51#endif
    5252
    5353#ifndef _MSC_VER
    54 #include <sys/param.h>
     54# include <sys/param.h>
    5555#endif
    5656#include <sys/stat.h>
    5757#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>
    6161#endif
    6262
     
    6868#include <stdlib.h>
    6969#include <string.h>
    70 #ifndef _MSC_VER
    7170#include <unistd.h>
    72 #else
    73 #include "mscfakes.h"
    74 #endif
    7571#include <stddef.h>
     72
     73#ifdef __sun__
     74# include "solfakes.h"
     75#endif
     76#ifdef _MSC_VER
     77# include "mscfakes.h"
     78#endif
    7679
    7780int bflag, eflag, nflag, sflag, tflag, vflag;
     
    111114#ifdef kmk_builtin_cat /* kmk did this already. */
    112115        setlocale(LC_CTYPE, "");
    113 #endif 
     116#endif
    114117
    115118        while ((ch = getopt(argc, argv, "benstuv")) != -1)
     
    285288#else
    286289                bsize = MAX(sbuf.st_blksize, 1024);
    287 #endif 
     290#endif
    288291                if ((buf = malloc(bsize)) == NULL)
    289292                        return err(1, "buffer");
  • trunk/src/gmake/kmkbuiltin/cp.c

    r557 r809  
    6565#include "err.h"
    6666#include <errno.h>
    67 #ifndef _MSC_VER
    6867#include <fts.h>
    69 #endif
    7068#include <limits.h>
    7169#include <signal.h>
     
    7371#include <stdlib.h>
    7472#include <string.h>
    75 #ifndef _MSC_VER
    7673#include <unistd.h>
    77 #else
    78 #include "mscfakes.h"
    79 #include "ftsfake.h"
     74
     75#ifdef _MSC_VER
     76# include "mscfakes.h"
    8077#endif
    8178
     
    471468                                if (copy_file(curr, dne))
    472469                                        badcp = rval = 1;
    473                         } else {       
     470                        } else {
    474471                                if (copy_link(curr, !dne))
    475472                                        badcp = rval = 1;
  • trunk/src/gmake/kmkbuiltin/cp_utils.c

    r370 r809  
    3737
    3838#ifndef _MSC_VER
    39 #include <sys/param.h>
    40 #endif 
     39# include <sys/param.h>
     40#endif
    4141#include <sys/stat.h>
    4242#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
    43 #include <sys/mman.h>
     43# include <sys/mman.h>
    4444#endif
    4545
     
    4747#include <errno.h>
    4848#include <fcntl.h>
    49 #ifndef _MSC_VER
    5049#include <fts.h>
    51 #endif
    5250#include <limits.h>
    5351#include <stdio.h>
    5452#include <stdlib.h>
    5553#include <signal.h>
    56 #ifndef _MSC_VER
    5754#include <sysexits.h>
    5855#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
    6363
    6464#include "cp_extern.h"
     
    7474#ifndef S_ISVTX
    7575# define S_ISVTX 0
    76 #endif 
     76#endif
    7777
    7878int
     
    123123                        }
    124124                }
    125                
     125
    126126                if (fflag) {
    127127                    /* remove existing destination file name,
     
    169169                                                entp->fts_path, to.p_path,
    170170                                                cp_pct(wtotal, fs->st_size));
    171                                                
     171
    172172                                }
    173173                                if (wcount >= (ssize_t)wresid || wcount <= 0)
     
    199199                                                entp->fts_path, to.p_path,
    200200                                                cp_pct(wtotal, fs->st_size));
    201                                                
     201
    202202                                }
    203203                                if (wcount >= (ssize_t)wresid || wcount <= 0)
  • trunk/src/gmake/kmkbuiltin/fts.c

    r621 r809  
    5656#include <stdlib.h>
    5757#include <string.h>
    58 #ifndef _MSC_VER
    5958#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
    6568
    6669#if ! HAVE_NBTOOL_CONFIG_H
     70#ifndef __sun__
    6771#define HAVE_STRUCT_DIRENT_D_NAMLEN 1
     72#endif
    6873#endif
    6974
     
    7883#endif /* __LIBC12_SOURCE__ */
    7984#endif /* __weak_alias */
    80 #endif 
     85#endif
    8186
    8287#ifdef __LIBC12_SOURCE__
     
    120125#undef HAVE_STRUCT_DIRENT_D_NAMLEN
    121126#undef HAVE_FCHDIR
    122 #endif 
     127#endif
    123128
    124129#if defined(__EMX__) || defined(_MSC_VER)
     
    268273                if ((sp->fts_rdir = getcwd(NULL, 0)) != NULL)
    269274                        SET(FTS_NOCHDIR);
    270 #endif 
     275#endif
    271276        }
    272277
     
    374379                if (chdir(sp->fts_rdir))
    375380                        saved_errno =  errno;
    376         free(sp->fts_rdir); 
     381        free(sp->fts_rdir);
    377382                sp->fts_rdir = NULL;
    378 #endif 
     383#endif
    379384        }
    380385
     
    467472                        p->fts_info = FTS_DP;
    468473                        return (p);
    469                 } 
     474                }
    470475
    471476                /* Rebuild if only read the names and now traversing. */
     
    520525#else
    521526                        if (CHDIR(sp, sp->fts_rdir)) {
    522 #endif 
     527#endif
    523528                                SET(FTS_STOP);
    524529                                return (NULL);
     
    587592#else
    588593                if (CHDIR(sp, sp->fts_rdir)) {
    589 #endif 
     594#endif
    590595                        SET(FTS_STOP);
    591596                        return (NULL);
     
    691696                SET(FTS_NAMEONLY);
    692697                instr = BNAMES;
    693         } else 
     698        } else
    694699                instr = BCHILD;
    695700
     
    913918                } else if (nlinks == 0
    914919#ifdef DT_DIR
    915                     || (nostat && 
     920                    || (nostat &&
    916921                    dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
    917922#endif
     
    979984#else
    980985            CHDIR(sp, sp->fts_rdir) :
    981 #endif 
     986#endif
    982987            fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
    983988                cur->fts_info = FTS_ERR;
     
    10391044                                errno = 0;
    10401045                                return (FTS_SLNONE);
    1041                         } 
     1046                        }
    10421047                        p->fts_errno = saved_errno;
    10431048                        goto err;
     
    11141119        for (ap = sp->fts_array, p = head; p; p = p->fts_link)
    11151120                *ap++ = p;
    1116         qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), 
     1121        qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *),
    11171122                (int (*)(const void *, const void *))sp->fts_compar);
    11181123        for (head = *(ap = sp->fts_array); --nitems; ++ap)
     
    12221227 * Most systems will allow creation of paths much longer than MAXPATHLEN, even
    12231228 * 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.
    12251230 */
    12261231static int
  • trunk/src/gmake/kmkbuiltin/ftsfake.h

    r621 r809  
    3535#define _FTS_H_
    3636
     37#ifdef _MSC_VER
     38# include "kmkbuiltin/mscfakes.h"
     39#endif
     40
    3741typedef struct {
    3842        struct _ftsent *fts_cur;        /* current node */
     
    6064#ifndef _MSC_VER
    6165#define FTS_WHITEOUT    0x080           /* return whiteout information */
    62 #endif 
     66#endif
    6367#define FTS_OPTIONMASK  0x0ff           /* valid user option mask */
    6468
     
    7983#ifndef _MSC_VER
    8084        int fts_symfd;                  /* fd for symlink */
    81 #endif 
     85#endif
    8286        u_short fts_pathlen;            /* strlen(fts_path) */
    8387        u_short fts_namelen;            /* strlen(fts_name) */
     
    9296#else
    9397        int fts_nlink;          /* link count */
    94 #endif 
     98#endif
    9599#endif
    96100
     
    121125#ifndef _MSC_VER
    122126#define FTS_ISW          0x04           /* this is a whiteout object */
    123 #endif 
     127#endif
    124128        u_short fts_flags;              /* private flags for FTSENT structure */
    125129
     
    138142} FTSENT;
    139143
     144#ifndef __sun__
    140145#ifndef _MSC_VER
    141146#include <sys/cdefs.h>
    142147__BEGIN_DECLS
    143148#else
    144 #define __RENAME(a)
    145 #endif
     149#define __RENAME(a)
     150#endif
     151#endif
    146152
    147 #ifdef __LIBC12_SOURCE__
     153#if defined(__LIBC12_SOURCE__) || defined(__sun__)
    148154FTSENT  *fts_children(FTS *, int);
    149155int      fts_close(FTS *);
     
    162168#endif
    163169
     170#ifndef __sun__
    164171#ifndef _MSC_VER
    165172__END_DECLS
    166173#endif
     174#endif
    167175
    168176#endif /* !_FTS_H_ */
  • trunk/src/gmake/kmkbuiltin/install.c

    r758 r809  
    4848
    4949#ifndef _MSC_VER
    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
     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 */
    5858#include <sys/stat.h>
    5959
     
    6262#include <errno.h>
    6363#include <fcntl.h>
    64 #ifndef _MSC_VER
    6564#include <grp.h>
    6665#include <paths.h>
    6766#include <pwd.h>
    68 #endif
    6967#include <stdio.h>
    7068#include <stdlib.h>
    7169#include <string.h>
    72 #ifndef _MSC_VER
    7370#include <sysexits.h>
    7471#include <unistd.h>
    75 #else
    76 #include "mscfakes.h"
    77 #endif
    7872#if defined(__EMX__) || defined(_MSC_VER)
    7973# include <process.h>
     74#endif
     75
     76#ifdef __sun__
     77# include "solfakes.h"
     78#endif
     79#ifdef _MSC_VER
     80# include "mscfakes.h"
    8081#endif
    8182
  • trunk/src/gmake/kmkbuiltin/ln.c

    r557 r809  
    4343
    4444#ifndef _MSC_VER
    45 #include <sys/param.h>
     45# include <sys/param.h>
    4646#endif
    4747#include <sys/stat.h>
     
    5353#include <stdlib.h>
    5454#include <string.h>
    55 #ifndef _MSC_VER
    5655#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"
    5962#endif
    6063
  • trunk/src/gmake/kmkbuiltin/mkdir.c

    r611 r809  
    4848#include <errno.h>
    4949#ifndef _MSC_VER
    50 #include <libgen.h>
     50# include <libgen.h>
    5151#endif
    5252#include <stdio.h>
    5353#include <stdlib.h>
    5454#include <string.h>
    55 #ifndef _MSC_VER
    5655#include <sysexits.h>
    5756#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"
    6164#endif
    6265
     
    8184    /* reinitialize globals */
    8285    vflag = 0;
    83    
     86
    8487    /* kmk: reset getopt and set progname */
    8588    g_progname = argv[0];
     
    136139                } else if (vflag)
    137140                        (void)printf("%s\n", *argv);
    138                
     141
    139142                if (!success)
    140143                        exitval = 1;
     
    172175                p = strchr(p, '\\');
    173176        }
    174 #endif 
     177#endif
    175178
    176179        p = path;
  • trunk/src/gmake/kmkbuiltin/mscfakes.h

    r805 r809  
    3232#include <time.h>
    3333#include <stdarg.h>
     34#include <malloc.h>
    3435#undef setmode
    3536#include "getopt.h"
  • trunk/src/gmake/kmkbuiltin/mv.c

    r714 r809  
    4949#include <sys/types.h>
    5050#ifndef _MSC_VER
    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>
     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>
    5858#endif
    5959#include <sys/stat.h>
     
    6262#include <errno.h>
    6363#include <fcntl.h>
    64 #ifndef _MSC_VER
    6564#include <grp.h>
    66 #endif
    6765#include <limits.h>
    68 #ifndef _MSC_VER
    6966#include <paths.h>
    7067#include <pwd.h>
    71 #endif
    7268#include <stdio.h>
    7369#include <stdlib.h>
    7470#include <string.h>
    75 #ifndef _MSC_VER
    7671#include <sysexits.h>
    7772#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"
    8079#endif
    8180
  • trunk/src/gmake/kmkbuiltin/printf.c

    r775 r809  
    5151#include "err.h"
    5252#include <errno.h>
    53 #ifndef _MSC_VER
    5453#include <inttypes.h>
    55 #endif
    5654#include <limits.h>
    5755#include <locale.h>
     
    6058#include <stdlib.h>
    6159#include <string.h>
    62 #ifndef _MSC_VER
    6360#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"
    6667#endif
    6768
  • trunk/src/gmake/kmkbuiltin/rm.c

    r557 r809  
    4747#include <sys/stat.h>
    4848#ifndef _MSC_VER
    49 #include <sys/param.h>
    50 #include <sys/mount.h>
     49# include <sys/param.h>
     50# include <sys/mount.h>
    5151#endif
    5252
     
    5555#include <fcntl.h>
    5656#ifdef DO_RMTREE
    57 #include <fts.h>
    58 #endif
    59 #ifndef _MSC_VER
     57# include <fts.h>
     58#endif
    6059#include <grp.h>
    6160#include <pwd.h>
    62 #endif
    6361#include <stdio.h>
    6462#include <stdlib.h>
    6563#include <string.h>
    66 #ifndef _MSC_VER
    6764#include <sysexits.h>
    6865#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"
    7172#endif
    7273
  • trunk/src/gmake/kmkbuiltin/rmdir.c

    r695 r809  
    4949#include <string.h>
    5050#include <errno.h>
    51 #ifndef _MSC_VER
    5251#include <unistd.h>
    53 #else
    54 #include <malloc.h>
    55 #include "mscfakes.h"
    56 #endif
    57 #include <getopt.h>
     52#include "getopt.h"
     53
     54#ifdef _MSC_VER
     55# include "mscfakes.h"
     56#endif
    5857
    5958static int rm_path(char *);
     
    8281        /* reinitialize globals */
    8382        ignore_fail_on_not_exist = ignore_fail_on_non_empty = vflag = pflag = 0;
    84        
     83
    8584        /* kmk: reset getopt and set progname */
    8685        g_progname = argv[0];
     
    150149                p = strchr(p, '\\');
    151150        }
    152 #endif 
     151#endif
    153152
    154153        p = path + len;
     
    166165                if (p[-1] == ':' && p - 2 == path)
    167166                        break;
    168 #endif 
     167#endif
    169168
    170169                if (rmdir(path) < 0) {
Note: See TracChangeset for help on using the changeset viewer.