-/**
- ** Buffer code
- **/
-typedef struct {
- char *data;
- int used,size;
-} buff_t;
-
-static void buff_empty(buff_t *b) {
- b->used=0;
- b->data[0]='\n';
- b->data[1]='\0';
-}
-static buff_t *buff_new(void) {
- buff_t *res=malloc(sizeof(buff_t));
- res->data=malloc(512);
- res->size=512;
- buff_empty(res);
- return res;
-}
-static void buff_free(buff_t *b) {
- if (b) {
- if (b->data)
- free(b->data);
- free(b);
- }
-}
-static void buff_append(buff_t *b, char *toadd) {
- int addlen=strlen(toadd);
- int needed_space=b->used+addlen+1;
-
- if (needed_space > b->size) {
- b->data = realloc(b->data, needed_space);
- b->size = needed_space;
- }
- strcpy(b->data+b->used, toadd);
- b->used += addlen;
-}
-static void buff_chomp(buff_t *b) {
- while (b->data[b->used] == '\n') {
- b->data[b->used] = '\0';
- if (b->used)
- b->used--;
- }
-}
-
-static void buff_trim(buff_t* b)
-{
- xbt_str_trim(b->data," ");
- b->used = strlen(b->data);
-}
-
-typedef struct s_signal_entry
-{
- const char* name;
- int number;
-}s_signal_entry_t,* signal_entry_t;
-
-static const s_signal_entry_t signals[] =
-{
- {"SIGHUP" ,1},
- {"SIGINT" ,2},
- {"SIGQUIT" ,3},
- {"SIGILL" ,4},
- {"SIGTRAP" ,5},
- {"SIGABRT" ,6},
- {"SIGEMT" ,7},
- {"SIGFPE" ,8},
- {"SIGKILL" ,9},
- {"SIGBUS" ,10},
- {"SIGSEGV" ,11},
- {"SIGSYS" ,12},
- {"SIGPIPE" ,13},
- {"SIGALRM" ,14},
- {"SIGTERM" ,15},
- {"SIGURG" ,16},
- {"SIGSTOP" ,17},
- {"SIGTSTP" ,18},
- {"SIGCONT" ,19},
- {"SIGCHLD" ,20},
- {"SIGTTIN" ,21},
- {"SIGTTOU" ,22},
- {"SIGIO" ,23},
- {"SIGXCPU" ,24},
- {"SIGXFSZ" ,25},
- {"SIGVTALRM",26},
- {"SIGPROF" ,27},
- {"SIGWINCH" ,28},
- {"SIGINFO" ,29},
- {"SIGUSR1" ,30},
- {"SIGUSR2" ,31}
-};
-
-#define SIGMAX 31
-#define SIGUNKNW SIGMAX + 1
-
-/* returns the name of the signal from it number */
-const char*
-signal_name(unsigned int number);
-