Ignore:
Timestamp:
Jun 25, 2008 12:33:40 AM (6 years ago)
Author:
pterjan
Message:
  • Have -r/-R/-S like screen
File:
1 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/attach.c

    r2483 r2488  
    1414#include "neercs.h"
    1515
    16 static char * build_socket_path(char *socket_dir)
     16static char * build_socket_path(char *socket_dir, char *session_name)
    1717{
    1818    char *path, *dir;
     
    2626        dir = "/tmp";
    2727    if(path)
    28         snprintf(path, PATH_MAX+1, "%s/neercs.%d.sock", dir, getpid());
     28        snprintf(path, PATH_MAX+1, "%s/neercs.%s.sock", dir, session_name);
    2929    return path;
    3030}
     
    4646
    4747    myaddr.sun_family = AF_UNIX;
    48     screen_list->socket_path = build_socket_path(screen_list->socket_path);
     48    screen_list->socket_path = build_socket_path(screen_list->socket_path, screen_list->session_name);
    4949    strncpy(myaddr.sun_path, screen_list->socket_path, sizeof(myaddr.sun_path) - 1);
    5050    unlink(myaddr.sun_path);
     
    159159}
    160160
    161 char ** list_sockets(char *socket_dir)
     161char ** list_sockets(char *socket_dir, char *session_name)
    162162{
    163163    char *pattern, *dir;
     
    179179        return globbuf.gl_pathv;
    180180
    181     snprintf(pattern, PATH_MAX, "%s/neercs.*.sock", dir);
     181    if(session_name && strlen(session_name)+strlen(dir)+13<PATH_MAX)
     182        sprintf(pattern, "%s/neercs.%s.sock", dir, session_name);
     183    else
     184        snprintf(pattern, PATH_MAX, "%s/neercs.*.sock", dir);
    182185    pattern[PATH_MAX] = '\0';
    183186
Note: See TracChangeset for help on using the changeset viewer.