VirtualBox

Changeset 1227 in kBuild for trunk/src/kash


Ignore:
Timestamp:
Oct 8, 2007 2:34:49 AM (17 years ago)
Author:
bird
Message:

file mockup.

Location:
trunk/src/kash
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/Makefile.kmk

    r1222 r1227  
    1515kmk_ash_TEMPLATE = BIN
    1616kmk_ash_DEFS = lint SHELL SMALL
     17kmk_ash_DEFS += SH_STUB_MODE # for the time being.
    1718kmk_ash_DEFS.debug = DEBUG
    1819kmk_ash_DEFS.linux = BSD
  • trunk/src/kash/shfile.c

    r1225 r1227  
    2929
    3030#ifdef KBUILD_OS_WINDOWS
    31 //# include <io.h>
     31# include <limits.h>
     32# ifndef PIPE_BUF
     33#  define PIPE_BUF 512
     34# endif
    3235#else
    3336# include <unistd.h>
    3437# include <fcntl.h>
     38# include <dirent.h>
    3539#endif
    3640
     
    3842int shfile_open(shfdtab *pfdtab, const char *name, unsigned flags, mode_t mode)
    3943{
    40 //    return open(name, flags);
    41     return -1;
     44#ifdef SH_PURE_STUB_MODE
     45    return -1;
     46#elif defined(SH_STUB_MODE)
     47    return open(name, flags, mode);
     48#else
     49#endif
    4250}
    4351
    4452int shfile_pipe(shfdtab *pfdtab, int fds[2])
    4553{
    46     return -1;
     54#ifdef SH_PURE_STUB_MODE
     55    return -1;
     56#elif defined(SH_STUB_MODE)
     57# ifdef _MSC_VER
     58    return _pipe(fds, PIPE_BUF, O_BINARY);
     59# else
     60    return pipe(fds);
     61# endif
     62#else
     63#endif
    4764}
    4865
    4966int shfile_dup(shfdtab *pfdtab, int fd)
    5067{
    51     return -1;
     68#ifdef SH_PURE_STUB_MODE
     69    return -1;
     70#elif defined(SH_STUB_MODE)
     71    return dup(fd);
     72#else
     73#endif
    5274}
    5375
    5476int shfile_close(shfdtab *pfdtab, unsigned fd)
    5577{
    56     return -1;
     78#ifdef SH_PURE_STUB_MODE
     79    return -1;
     80#elif defined(SH_STUB_MODE)
     81    return close(fd);
     82#else
     83#endif
    5784}
    5885
    5986long shfile_read(shfdtab *pfdtab, int fd, void *buf, size_t len)
    6087{
    61     return -1;
     88#ifdef SH_PURE_STUB_MODE
     89    return -1;
     90#elif defined(SH_STUB_MODE)
     91# ifdef _MSC_VER
     92    return read(fd, buf, (unsigned)len);
     93# else
     94    return read(fd, buf, len);
     95# endif
     96#else
     97#endif
    6298}
    6399
    64100long shfile_write(shfdtab *pfdtab, int fd, const void *buf, size_t len)
    65101{
    66     return -1;
     102#ifdef SH_PURE_STUB_MODE
     103    return -1;
     104#elif defined(SH_STUB_MODE)
     105# ifdef _MSC_VER
     106    return write(fd, buf, (unsigned)len);
     107# else
     108    return write(fd, buf, len);
     109# endif
     110#else
     111#endif
    67112}
    68113
    69114long shfile_lseek(shfdtab *pfdtab, int fd, long off, int whench)
    70115{
    71     return -1;
     116#ifdef SH_PURE_STUB_MODE
     117    return -1;
     118#elif defined(SH_STUB_MODE)
     119    return lseek(fd, off, whench);
     120#else
     121#endif
    72122}
    73123
    74124int shfile_fcntl(shfdtab *pfdtab, int fd, int cmd, int arg)
    75125{
    76     return -1;
     126#ifdef SH_PURE_STUB_MODE
     127    return -1;
     128#elif defined(SH_STUB_MODE)
     129# ifdef _MSC_VER
     130    return -1;
     131# else
     132    return fcntl(fd, cmd, arg);
     133# endif
     134#else
     135#endif
    77136}
    78137
    79138int shfile_stat(shfdtab *pfdtab, const char *path, struct stat *pst)
    80139{
    81     return -1;
     140#ifdef SH_PURE_STUB_MODE
     141    return -1;
     142#elif defined(SH_STUB_MODE)
     143    return stat(path, pst);
     144#else
     145#endif
    82146}
    83147
    84148int shfile_lstat(shfdtab *pfdtab, const char *link, struct stat *pst)
    85149{
    86     return -1;
     150#ifdef SH_PURE_STUB_MODE
     151    return -1;
     152#elif defined(SH_STUB_MODE)
     153# ifdef _MSC_VER
     154    return stat(link, pst);
     155# else
     156    return lstat(link, pst);
     157# endif
     158#else
     159#endif
    87160}
    88161
    89162int shfile_chdir(shfdtab *pfdtab, const char *path)
    90163{
    91     return -1;
     164#ifdef SH_PURE_STUB_MODE
     165    return -1;
     166#elif defined(SH_STUB_MODE)
     167# ifdef _MSC_VER //???
     168    return chdir(path);
     169# else
     170    return chdir(path);
     171# endif
     172#else
     173#endif
    92174}
    93175
    94176char *shfile_getcwd(shfdtab *pfdtab, char *buf, int len)
    95177{
    96     return NULL;
     178#ifdef SH_PURE_STUB_MODE
     179    return NULL;
     180#elif defined(SH_STUB_MODE)
     181    return getcwd(buf, len);
     182#else
     183#endif
    97184}
    98185
    99186int shfile_access(shfdtab *pfdtab, const char *path, int type)
    100187{
    101     return -1;
     188#ifdef SH_PURE_STUB_MODE
     189    return -1;
     190#elif defined(SH_STUB_MODE)
     191# ifdef _MSC_VER
     192    type &= ~X_OK;
     193    return access(path, type);
     194# else
     195    return access(path, type);
     196# endif
     197#else
     198#endif
    102199}
    103200
    104201int shfile_isatty(shfdtab *pfdtab, int fd)
    105202{
     203#ifdef SH_PURE_STUB_MODE
    106204    return 0;
     205#elif defined(SH_STUB_MODE)
     206    return isatty(fd);
     207#else
     208#endif
    107209}
    108210
     
    110212int shfile_ioctl(shfdtab *pfdtab, int fd, unsigned long request, void *buf)
    111213{
    112     return -1;
     214#ifdef SH_PURE_STUB_MODE
     215    return -1;
     216#elif defined(SH_STUB_MODE)
     217# ifdef _MSC_VER
     218    return -1;
     219# else
     220    return ioctl(fd, request, buf);
     221# endif
     222#else
     223#endif
    113224}
    114225
    115226mode_t shfile_get_umask(shfdtab *pfdtab)
    116227{
     228#ifdef SH_PURE_STUB_MODE
    117229    return 022;
     230#elif defined(SH_STUB_MODE)
     231    return 022;
     232#else
     233#endif
    118234}
    119235
     
    121237shdir *shfile_opendir(shfdtab *pfdtab, const char *dir)
    122238{
    123     return NULL;
     239#ifdef SH_PURE_STUB_MODE
     240    return NULL;
     241#elif defined(SH_STUB_MODE)
     242# ifdef _MSC_VER
     243    return NULL;
     244# else
     245    return (shdir *)opendir(dir);
     246# endif
     247#else
     248#endif
    124249}
    125250
    126251shdirent *shfile_readdir(struct shdir *pdir)
    127252{
    128     return NULL;
     253#ifdef SH_PURE_STUB_MODE
     254    return NULL;
     255#elif defined(SH_STUB_MODE)
     256# ifdef _MSC_VER
     257    return NULL;
     258# else
     259    struct dirent *pde = readdir((DIR *)pdir);
     260    return pde ? (shdirent *)&pde->d_name[0] : NULL;
     261# endif
     262#else
     263#endif
    129264}
    130265
    131266void shfile_closedir(struct shdir *pdir)
    132267{
    133 
    134 }
     268#ifdef SH_PURE_STUB_MODE
     269    return NULL;
     270#elif defined(SH_STUB_MODE)
     271# ifndef _MSC_VER
     272    closedir((DIR *)pdir);
     273# endif
     274#else
     275#endif
     276}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette