Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
io.cpp File Reference
#include "mozce_internal.h"

Go to the source code of this file.

Defines

#define MAX_PROTOS   (sizeof(sProtos) / sizeof(struct protoent))

Functions

MOZCE_SHUNT_API int mozce_chmod (const char *inFilename, int inMode)
MOZCE_SHUNT_API int mozce_isatty (int inHandle)
MOZCE_SHUNT_API struct protoentmozce_getprotobyname (const char *inName)
MOZCE_SHUNT_API struct protoentmozce_getprotobynumber (int inNumber)

Variables

static struct protoent []

Define Documentation

#define MAX_PROTOS   (sizeof(sProtos) / sizeof(struct protoent))

Definition at line 123 of file io.cpp.


Function Documentation

MOZCE_SHUNT_API int mozce_chmod ( const char *  inFilename,
int  inMode 
)

Definition at line 49 of file io.cpp.

{
    MOZCE_PRECHECK

#ifdef DEBUG
    mozce_printf("mozce_chmod called\n");
#endif
    
    int retval = -1;
    
    if(NULL != inFilename)
    {
        unsigned short buffer[MAX_PATH];
        
        int convRes = a2w_buffer(inFilename, -1, buffer, sizeof(buffer) / sizeof(unsigned short));
        if(0 != convRes)
        {
            DWORD attribs = 0;
            
            attribs = GetFileAttributesW(buffer);
            if(0 != attribs)
            {
                if(0 != (_S_IWRITE & inMode))
                {
                    attribs |= FILE_ATTRIBUTE_READONLY;
                }
                else
                {
                    attribs &= ~FILE_ATTRIBUTE_READONLY;
                }
                
                BOOL setRes = SetFileAttributesW(buffer, attribs);
                if(FALSE != setRes)
                {
                    retval = 0;
                }
            }
        }
    }
    
    return retval;
}

Here is the call graph for this function:

MOZCE_SHUNT_API struct protoent* mozce_getprotobyname ( const char *  inName) [read]

Definition at line 130 of file io.cpp.

{
    struct protoent* retval = NULL;

    if(NULL != inName)
    {
        unsigned uLoop;

        for(uLoop = 0; uLoop < MAX_PROTOS; uLoop++)
        {
            if(0 == _stricmp(inName, sProtos[uLoop].p_name))
            {
                retval = &sProtos[uLoop];
                break;
            }
        }
    }

    return retval;
}
MOZCE_SHUNT_API struct protoent* mozce_getprotobynumber ( int  inNumber) [read]

Definition at line 156 of file io.cpp.

{
    struct protoent* retval = NULL;
    unsigned uLoop;
    
    for(uLoop = 0; uLoop < MAX_PROTOS; uLoop++)
    {
        if(inNumber == sProtos[uLoop].p_proto)
        {
            retval = &sProtos[uLoop];
            break;
        }
    }

    return retval;

}

Definition at line 93 of file io.cpp.

{
    MOZCE_PRECHECK

#ifdef DEBUG
    mozce_printf("-- mozce_isatty called\n");
#endif
    
    int retval = 0;
    
    return retval;
}

Here is the call graph for this function:


Variable Documentation

struct protoent[] [static]
Initial value:
 {
    { "tcp",    NULL,   IPPROTO_TCP },
    { "udp",    NULL,   IPPROTO_UDP },
    { "ip",     NULL,   IPPROTO_IP },
    { "icmp",   NULL,   IPPROTO_ICMP },
    { "ggp",    NULL,   IPPROTO_GGP },
    { "pup",    NULL,   IPPROTO_PUP },
    { "idp",    NULL,   IPPROTO_IDP },
    { "nd",     NULL,   IPPROTO_ND },
    { "raw",    NULL,   IPPROTO_RAW }
}

Definition at line 111 of file io.cpp.