Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

local_shell.c File Reference


Detailed Description

Local shell.

This implements an alterego of gtk-gnutella to access the local socket of gtk-gnutella.

Author:
Christian Biere
Date:
2006

#include "common.h"
#include "lib/misc.h"
#include "lib/socket.h"
#include "lib/override.h"

Data Structures

struct  shell_buf
struct  line_buf

Functions

 RCSID ("$Id: local_shell.c 13738 2007-05-25 12:38:56Z rmanfredi $")
int read_data (int fd, struct shell_buf *sb)
 Attempts to fill the shell buffer from the given file descriptor, however, the buffer is not further filled before it is completely empty.
int read_data_with_readline (struct line_buf *line, struct shell_buf *sb)
 Attempts to fill the shell buffer using readline(), however, the buffer is not further filled before it is completely empty.
int write_data (int fd, struct shell_buf *sb)
 Attempts to flush the shell buffer to the given file descriptor.
int compat_poll (struct pollfd *fds, size_t n, int timeout)
int wait_for_io (struct pollfd *fds, size_t n, int timeout)
 Sleeps until any I/O event happens or the timeout expires.
int local_shell_mainloop (int fd)
void local_shell (const char *socket_path)
 A simple shell to speak to the local socket of gtk-gnutella.


Function Documentation

int compat_poll struct pollfd *  fds,
size_t  n,
int  timeout
[static]
 

void local_shell const char *  socket_path  ) 
 

A simple shell to speak to the local socket of gtk-gnutella.

This is provided because there is not standard tool that could be used like telnet for TCP. This is meant as a stand-alone program and therefore does not return calls exit().

int local_shell_mainloop int  fd  )  [static]
 

RCSID "$Id: local_shell.c 13738 2007-05-25 12:38:56Z rmanfredi $"   ) 
 

Note:
This file can also be compiled as a tiny standalone tool with no external dependencies (not even GLib):
cc -o gtkg-shell -DLOCAL_SHELL_STANDALONE local_shell.c

int read_data int  fd,
struct shell_buf sb
[static]
 

Attempts to fill the shell buffer from the given file descriptor, however, the buffer is not further filled before it is completely empty.

int read_data_with_readline struct line_buf line,
struct shell_buf sb
[static]
 

Attempts to fill the shell buffer using readline(), however, the buffer is not further filled before it is completely empty.

int wait_for_io struct pollfd *  fds,
size_t  n,
int  timeout
[static]
 

Sleeps until any I/O event happens or the timeout expires.

Returns:
-1 On error; 0 If the timeout expired; otherwise the amount of ready pollsets is returned.

int write_data int  fd,
struct shell_buf sb
[static]
 

Attempts to flush the shell buffer to the given file descriptor.


Generated on Sat Jun 30 17:53:28 2007 for gtk-gnutella by  doxygen 1.3.9.1