"Fossies" - the Fresh Open Source Software Archive

Member "xxgdb-1.12/xxgdbiowin.c" (29 Aug 1994, 1236 Bytes) of package /linux/misc/old/xxgdb-1.12.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * iand 94/02/10 SVR4 port
    3  *
    4  */
    5 #include <signal.h>
    6 #include <sys/types.h>
    7 #include <sys/socket.h>
    8 #include <sys/un.h>
    9 #include <stdio.h>
   10 #include <stdlib.h>
   11 
   12 #if ( defined(SYSV) || defined(SVR4) ) && !defined(HPUX)
   13 #define signal sigset
   14 #endif
   15 
   16 static void 
   17 handler (sig)
   18     int sig;
   19 {
   20 }
   21 
   22 main ()
   23 {
   24     int sock;
   25     struct sockaddr_un name;
   26     char ttypid[40];
   27 #if 0 /* for debug only */
   28 {
   29     char *myname;
   30     char buf[10000];
   31     fprintf(stderr, "\n\nHello ! !\n\n");
   32     fprintf(stderr, "\n\nisatty == %d\n\n", isatty(0));
   33     myname = ttyname(0);
   34     if (myname == 0) {
   35         fprintf (stderr, "\n\n ERROR ttyname == 0 \n\n\n");
   36     } else {
   37         fprintf (stderr, "\n\n ttyname == %s\n\n\n", myname);
   38     }
   39     sprintf(ttypid, "%s,%d", myname, getpid());
   40 }
   41 #else
   42     sprintf(ttypid, "%s,%d", ttyname(0), getpid());
   43 #endif
   44     sock = socket(AF_UNIX, SOCK_DGRAM, 0);
   45     name.sun_family = AF_UNIX;
   46     strcpy(name.sun_path, "/tmp/iowindowtty");
   47     sendto(sock, ttypid, 40, 0, 
   48        (struct sockaddr*)&name, sizeof(struct sockaddr_un));
   49     close(sock);
   50 
   51     signal(SIGINT,  handler);
   52     signal(SIGQUIT, handler);
   53     signal(SIGTSTP, handler);
   54 #ifdef SVR4
   55     setpgid(0,0);
   56 #else
   57     setpgrp(0,0);
   58 #endif
   59     close(0);
   60     close(1);
   61     while (1) pause();
   62 }
   63