Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/runtime/c-libs/smlnj-sockets/to-unixaddr.c
ViewVC logotype

View of /sml/trunk/src/runtime/c-libs/smlnj-sockets/to-unixaddr.c

Parent Directory Parent Directory | Revision Log Revision Log

Revision 728 - (download) (as text) (annotate)
Mon Nov 6 21:54:13 2000 UTC (20 years ago) by jhr
File size: 1029 byte(s)
  Complete fix for bug 1514.
/* to-unixaddr.c
 * COPYRIGHT (c) 1995 AT&T Bell Laboratories.

#include "ml-unixdep.h"
#include "sockets-osdep.h"
#include INCLUDE_UN_H
#include "ml-base.h"
#include "ml-values.h"
#include "ml-objects.h"
#include "ml-c.h"
#include "cfun-proto-list.h"

/* _ml_Sock_tounixaddr : string -> addr
 * Given a path, allocate a UNIX-domain socket address.
ml_val_t _ml_Sock_tounixaddr (ml_state_t *msp, ml_val_t arg)
    char		*path = STR_MLtoC(arg);
    struct sockaddr_un	addr;
    int			len;
    ml_val_t		data, res;

    memset(&addr, 0, sizeof(struct sockaddr_un));

    addr.sun_family = AF_UNIX;
    strcpy (addr.sun_path, path);
    len = strlen(path)+sizeof(addr.sun_len)+sizeof(addr.sun_family)+1;
    addr.sun_len = len;
    len = strlen(path)+sizeof(addr.sun_family)+1;

    data = ML_CData (msp, &addr, len);
    SEQHDR_ALLOC (msp, res, DESC_word8vec, data, len);

    return res;

} /* end of _ml_Sock_tounixaddr */

ViewVC Help
Powered by ViewVC 1.0.0