Skip to content
This repository has been archived by the owner on Jun 4, 2018. It is now read-only.

FabianFrank/node-exec-socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

node-exec-socket

#include <stdio.h>
#include <sys/stat.h>

int main() {

    struct stat fdstat;
    fstat(fileno(stdin), &fdstat);

    switch (fdstat.st_mode & S_IFMT) {
        case S_IFBLK:  printf("block device\n");            break;
        case S_IFCHR:  printf("character device\n");        break;
        case S_IFDIR:  printf("directory\n");               break;
        case S_IFIFO:  printf("FIFO/pipe\n");             break;
        case S_IFLNK:  printf("symlink\n");               break;
        case S_IFREG:  printf("regular file\n");          break;
        case S_IFSOCK: printf("socket\n");                break;
        default:       printf("unknown?\n");              break;
    }

}
$ make
clang stdout_type.c -o stdout_type
ruby -e 'exec "./stdout_type"'
character device
perl -e 'exec("./stdout_type")'
character device
node exec.js
socket

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published