Enlightenment CVS committal

Author  : handyande
Project : e17
Module  : apps/examine

Dir     : e17/apps/examine/src


Modified Files:
        Makefile.am ecore_config_client.c ecore_config_client.h 
        examine.c exsh.c 
Added Files:
        .indent.pro examine_client.c examine_client.h 


Log Message:
Work on examine - now does more, almost useful
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/examine/src/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 5 Jan 2004 20:45:10 -0000       1.1
+++ Makefile.am 13 Jan 2004 19:51:50 -0000      1.2
@@ -28,6 +28,8 @@
 
 examine_SOURCES = \
 examine.c \
+examine_client.c \
+examine_client.h \
 ecore_config_client.c \
 ecore_config_client.h 
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/examine/src/ecore_config_client.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_config_client.c       5 Jan 2004 20:45:10 -0000       1.1
+++ ecore_config_client.c       13 Jan 2004 19:51:50 -0000      1.2
@@ -1,3 +1,4 @@
+
 /* by Azundris */
 
 //#include "config.h"
@@ -21,8 +22,10 @@
 
 
 
-const char *ecore_config_error(int no) {
-  static const char *ecore_config_errstr[]={
+const char     *
+ecore_config_error(int no)
+{
+  static const char *ecore_config_errstr[] = {
     "Success",
     "General failure",
     "No data",
@@ -39,159 +42,192 @@
     "File-I/O error in meta-data provider",
     "Could not activate meta-data provider",
     "Action requires a file",
-    "Action not supported" };
+    "Action not supported"
+  };
 
-  if(no<0)
-    no=-no;
-  if(no<=-ECORE_CONFIG_ERR_NOTSUPP)
+  if (no < 0)
+    no = -no;
+  if (no <= -ECORE_CONFIG_ERR_NOTSUPP)
     return ecore_config_errstr[no];
-  return "No such error"; }
+  return "No such error";
+}
 
 
 
-static int print_data(char *d,size_t l) {
-  char *e=d+l,*f;
-  while(d<e) {
-    l=(d[1]<<8)|d[2];
-    if(*d=='s') {
-      f=d+3;
-      printf("  STR-%ld: \"%s\"\n",l,f); }
-    else
-      printf("  skipping chunk type '%c' {%ld bytes}...\n",*d,l);
-    d+=3+l; }
-  return ECORE_CONFIG_ERR_SUCC; }
+static int
+print_data(char *d, size_t l)
+{
+  char           *e = d + l, *f;
+
+  while (d < e) {
+    l = (d[1] << 8) | d[2];
+    if (*d == 's') {
+      f = d + 3;
+      printf("  STR-%ld: \"%s\"\n", l, f);
+    } else
+      printf("  skipping chunk type '%c' {%ld bytes}...\n", *d, l);
+    d += 3 + l;
+  }
+  return ECORE_CONFIG_ERR_SUCC;
+}
 
 
 
 /*****************************************************************************/
 
-int is_dir(const char *dir) {
-  struct stat st;
+int
+is_dir(const char *dir)
+{
+  struct stat     st;
 
   if (stat(dir, &st))
     return 0;
 
   return (S_ISDIR(st.st_mode));
 }
-          
 
-int ex_ipc_init(ex_ipc_server_list **srv_list,char *pipe_name,connstate *cs) {
-  int global, port, connected;
-  struct stat st;
-  char *p;
-  char str[PATH_MAX], buf[PATH_MAX];
-  DIR *dir;
-  struct dirent *socket;
+
+int
+ex_ipc_init(ex_ipc_server_list ** srv_list, char *pipe_name, connstate * cs)
+{
+  int global     , port, connected;
+  struct stat     st;
+  char           *p;
+  char            str[PATH_MAX], buf[PATH_MAX];
+  DIR            *dir;
+  struct dirent  *socket;
   Ecore_Ipc_Server *tmp_sock;
   ex_ipc_server_list *tmp;
-    
-  global=FALSE;
-  port=0;
-  
-  if(ecore_ipc_init()<1)
+
+  global = FALSE;
+
+  port = 0;
+
+  if (ecore_ipc_init() < 1)
     return ECORE_CONFIG_ERR_FAIL;
-  if(!srv_list)
+  if (!srv_list)
     return ECORE_CONFIG_ERR_FAIL;
-  if(*srv_list)
+  if (*srv_list)
     return ECORE_CONFIG_ERR_IGNORED;
 
-  if((p=getenv("HOME"))) {  /* debug-only ### FIXME */
-    sprintf(str,"%s/.ecore/%s/.global",p,pipe_name);
+  if ((p = getenv("HOME"))) {   /* debug-only ### FIXME */
+    sprintf(str, "%s/.ecore/%s/.global", p, pipe_name);
     if (stat(str, &st))
-      global=FALSE;
+      global = FALSE;
+
     else
-      global=TRUE;
-    
-    sprintf(str,"%s/.ecore/%s/",p,pipe_name);
-    snprintf(buf,PATH_MAX,str);
-
-    if((dir=opendir(buf))) {
-      connected=0;
-      while ((socket=readdir(dir))) {
+      global = TRUE;
+
+    sprintf(str, "%s/.ecore/%s/", p, pipe_name);
+    snprintf(buf, PATH_MAX, str);
+
+    if ((dir = opendir(buf))) {
+      connected = 0;
+      while ((socket = readdir(dir))) {
         if (!strcmp(socket->d_name, ".") || !strcmp(socket->d_name, "..") ||
             !strcmp(socket->d_name, ".global"))
           continue;
         if (!is_dir(socket->d_name)) {
-          port=atoi(socket->d_name);
+          port = atoi(socket->d_name);
 
-          E(2,"Trying %s on port %d ", pipe_name, port);
+          E(2, "Trying %s on port %d ", pipe_name, port);
           //if (!connected) {
-          
if((tmp_sock=ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER,pipe_name,port,NULL))) {
+          if ((tmp_sock =
+               ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, pipe_name, port,
+                                        NULL))) {
             E(2, "- connected!\n");
-            if (!(tmp=malloc(sizeof(ex_ipc_server_list))))
+            if (!(tmp = malloc(sizeof(ex_ipc_server_list))))
               return ECORE_CONFIG_ERR_OOM;
-            memset(tmp,0,sizeof(ex_ipc_server_list));
-            tmp->srv=tmp_sock;
-    
+            memset(tmp, 0, sizeof(ex_ipc_server_list));
+            tmp->srv = tmp_sock;
+
             if (!*srv_list)
-              *srv_list=tmp;
+              *srv_list = tmp;
             else {
-              tmp->next=*srv_list;
-            *srv_list=tmp;}
+              tmp->next = *srv_list;
+              *srv_list = tmp;
+            }
+
 
-    
-          connected=1;
-          if (!global) 
-            break;
+            connected = 1;
+            if (!global)
+              break;
           } else {
             /* not connected */
-            E(2, "- failed :(\n"); }
-    
+            E(2, "- failed :(\n");
+          }
+
           //} else {
           //  E(3, "Should also try connecting to %d!!!\n", port);
           //}
 
-        } /* is not dir */
-      } /* while dir */
+        }                       /* is not dir */
+      }                         /* while dir */
 
       if (connected) {
 
-        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, ex_ipc_server_con,cs);
-        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, ex_ipc_server_dis,cs);
-        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,ex_ipc_server_sent,NULL);
+        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, ex_ipc_server_con,
+                                cs);
+        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, ex_ipc_server_dis,
+                                cs);
+        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, ex_ipc_server_sent,
+                                NULL);
 
         return ECORE_CONFIG_ERR_SUCC;
       }
-    } /* openfir */
-  } else { /* if we cannot access the home variable */
-    if((tmp_sock=ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER,pipe_name,0,NULL))) {
-E(2, "Connected to %s on default port (0)!\n", pipe_name);
-      ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, ex_ipc_server_con,cs);
-      ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, ex_ipc_server_dis,cs);
-      ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,ex_ipc_server_sent,NULL);
-    if (!(tmp=malloc(sizeof(ex_ipc_server_list))))
-      return ECORE_CONFIG_ERR_OOM;
-    memset(tmp,0,sizeof(ex_ipc_server_list));
-    tmp->srv=tmp_sock;
-
-    if (!*srv_list)
-     *srv_list=tmp;
-                                       
-      return ECORE_CONFIG_ERR_SUCC; }
+    }                           /* openfir */
+  } else {                      /* if we cannot access the home variable */
+    if ((tmp_sock =
+         ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, pipe_name, 0, NULL))) {
+      E(2, "Connected to %s on default port (0)!\n", pipe_name);
+      ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, ex_ipc_server_con,
+                              cs);
+      ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, ex_ipc_server_dis,
+                              cs);
+      ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, ex_ipc_server_sent,
+                              NULL);
+      if (!(tmp = malloc(sizeof(ex_ipc_server_list))))
+        return ECORE_CONFIG_ERR_OOM;
+      memset(tmp, 0, sizeof(ex_ipc_server_list));
+      tmp->srv = tmp_sock;
+
+      if (!*srv_list)
+        *srv_list = tmp;
+
+      return ECORE_CONFIG_ERR_SUCC;
+    }
   }
 
-  *srv_list=NULL;
-  return ECORE_CONFIG_ERR_NOTFOUND; }
+  *srv_list = NULL;
+  return ECORE_CONFIG_ERR_NOTFOUND;
+}
 
 
 
-int ex_ipc_exit(ex_ipc_server_list **srv_list) {
+int
+ex_ipc_exit(ex_ipc_server_list ** srv_list)
+{
   ex_ipc_server_list *tmp = *srv_list;
-  if(!srv_list)
+
+  if (!srv_list)
     return ECORE_CONFIG_ERR_FAIL;
-  if(*srv_list)
+  if (*srv_list)
     while (tmp) {
       ecore_ipc_server_del(tmp->srv);
       tmp = tmp->next;
     }
-  *srv_list=NULL;
+  *srv_list = NULL;
   ecore_ipc_shutdown();
-  return ECORE_CONFIG_ERR_SUCC; }
+  return ECORE_CONFIG_ERR_SUCC;
+}
 
 
 
-int ex_ipc_sigexit(void *data, int type, void *event) {
-  return 0; }
+int
+ex_ipc_sigexit(void *data, int type, void *event)
+{
+  return 0;
+}
 
 
 
@@ -199,33 +235,38 @@
 
 
 
-int ex_ipc_send(ex_ipc_server_list **srv_list,int major,int minor,void *data,int 
size) {
+int
+ex_ipc_send(ex_ipc_server_list ** srv_list, int major, int minor, void *data,
+            int size)
+{
   ex_ipc_server_list *tmp = *srv_list;
-  static int ref=0;
-  int        ret;
+  static int      ref = 0;
+  int             ret;
 
-  if(!srv_list)
+  if (!srv_list)
     return ECORE_CONFIG_ERR_FAIL;
-  if(!*srv_list)
+  if (!*srv_list)
     return ECORE_CONFIG_ERR_NODATA;
   ret = ECORE_CONFIG_ERR_NODATA;
 
-  if(size<0)
-    size=data?strlen(data)+1:0;
+  if (size < 0)
+    size = data ? strlen(data) + 1 : 0;
 
   while (tmp) {
-    ret=ecore_ipc_server_send(tmp->srv,major,minor,++ref,0,0,data,size);
+    ret =
+      ecore_ipc_server_send(tmp->srv, major, minor, ++ref, 0, 0, data, size);
     tmp = tmp->next;
   }
-  E(2,"exsh: we sent: %2d.%02d  #%03d  \"%s\".%d  =>  %d\n",
-    major,minor,ref,(char *)data,size,ret);
+  E(2, "exsh: we sent: %2d.%02d  #%03d  \"%s\".%d  =>  %d\n",
+    major, minor, ref, (char *) data, size, ret);
 
-  if((debug>=2)&&(size>0))
-    print_data(data,size);
+  if ((debug >= 2) && (size > 0))
+    print_data(data, size);
 
   ecore_main_loop_begin();
 
-  return ECORE_CONFIG_ERR_SUCC; }
+  return ECORE_CONFIG_ERR_SUCC;
+}
 
 
 
@@ -233,25 +274,28 @@
 
 
 
-int send_append(char **mp,int *lp,char *dp) {
-  size_t l=strlen(dp)+1+1+2+*lp,l2;
-  char *m;
+int
+send_append(char **mp, int *lp, char *dp)
+{
+  size_t          l = strlen(dp) + 1 + 1 + 2 + *lp, l2;
+  char           *m;
 
-  if(!(m=realloc(*mp,l)))
+  if (!(m = realloc(*mp, l)))
     return ECORE_CONFIG_ERR_OOM;
 
-  l2=*lp;
-  *mp=m;
-  *lp=l;
-  m+=l2;
-  l2=strlen(dp)+1;
-
-  *(m++)='s';
-  *(m++)=l2<<8;
-  *(m++)=l2%256;
-  strcpy(m,dp);
+  l2 = *lp;
+  *mp = m;
+  *lp = l;
+  m += l2;
+  l2 = strlen(dp) + 1;
+
+  *(m++) = 's';
+  *(m++) = l2 << 8;
+  *(m++) = l2 % 256;
+  strcpy(m, dp);
 
-  return ECORE_CONFIG_ERR_SUCC; }
+  return ECORE_CONFIG_ERR_SUCC;
+}
 
 
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/examine/src/ecore_config_client.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_config_client.h       5 Jan 2004 20:45:10 -0000       1.1
+++ ecore_config_client.h       13 Jan 2004 19:51:50 -0000      1.2
@@ -1,24 +1,27 @@
-typedef enum { OFFLINE,ONLINE } connstate;
+typedef enum { OFFLINE, ONLINE } connstate;
 
 typedef struct ex_ipc_server_list {
-  Ecore_Ipc_Server          *srv;
-  connstate                  state;
-  struct ex_ipc_server_list *next; } ex_ipc_server_list;
+  Ecore_Ipc_Server *srv;
+  connstate       state;
+  struct ex_ipc_server_list *next;
+} ex_ipc_server_list;
 
 /* in client */
-int ex_ipc_server_con(void *data,int type,void *event);
-int ex_ipc_server_dis(void *data,int type,void *event);
-int ex_ipc_server_sent(void *data,int type,void *event);
+int             ex_ipc_server_con(void *data, int type, void *event);
+int             ex_ipc_server_dis(void *data, int type, void *event);
+int             ex_ipc_server_sent(void *data, int type, void *event);
 
 /* in client lib */
-const char *ecore_config_error(int no);
-int ex_ipc_init(ex_ipc_server_list **srv_list,char *pipe_name,connstate *cs);
-int ex_ipc_exit(ex_ipc_server_list **srv_list);
-int ex_ipc_sigexit(void *data, int type, void *event);
-int ex_ipc_send(ex_ipc_server_list **srv_list,int major,int minor,void *data,int 
size);
-int send_append(char **mp,int *lp,char *dp);
+const char     *ecore_config_error(int no);
+int             ex_ipc_init(ex_ipc_server_list ** srv_list, char *pipe_name,
+                            connstate * cs);
+int             ex_ipc_exit(ex_ipc_server_list ** srv_list);
+int             ex_ipc_sigexit(void *data, int type, void *event);
+int             ex_ipc_send(ex_ipc_server_list ** srv_list, int major,
+                            int minor, void *data, int size);
+int             send_append(char **mp, int *lp, char *dp);
 
-extern int debug;
+extern int      debug;
 
 #ifndef E
 #  define E(lvl,fmt,args...) do { if(debug>=(lvl)) fprintf(stderr,fmt,## args); } 
while(0)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/examine/src/examine.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- examine.c   5 Jan 2004 20:45:10 -0000       1.1
+++ examine.c   13 Jan 2004 19:51:50 -0000      1.2
@@ -1,121 +1,128 @@
+
 /* by Azundris */
+
 /* Modified for ecore_config by HandyAndE */
 
 #include "Ecore_Config.h"
 
 #include <Ewl.h>
-#include <Ecore.h>
-#include <Ecore_Ipc.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 
-#include "ipc.h"
-#include "ecore_config_client.h"
-
-
+#include "examine_client.h"
 
-#define MI 4096
+int             debug = 1;
 
+void            render_ewl(void);
 
-typedef enum {
-  P_NONE=0,
-  P_SERIAL=1,
-  P_DIR=2,
-  P_FILE=4,
-  P_KEY=8,
-  P_VALUE=16,
-  P_SILENT=32,
-  P_HELPONLY=64,
-  P_LAST=P_HELPONLY } para;
+void            print_usage(void);
 
+Ewl_Widget     *main_win;
+Ewl_Widget     *main_box;
 
-typedef struct _call {
-  ex_ipc_call  id;
-  char        *name;
-  para         signature; } call;
-
+/*****************************************************************************/
 
+void
+__destroy_main_window(Ewl_Widget * main_win, void *ex_data, void *user_data)
+{
+  ewl_widget_destroy(main_win);
+  ewl_main_quit();
 
-static call calls[]={
-  { IPC_NONE,         "bundle",           P_HELPONLY},
-  { IPC_BUNDLE_LIST,     "bundle-list",      P_NONE},
-  { IPC_BUNDLE_NEW,      "bundle-new",       P_DIR},
-  { IPC_BUNDLE_LABEL_GET,  "bundle-label-get",   P_SILENT|P_SERIAL},
-  { IPC_BUNDLE_LABEL_GET,  "bundle-label",       P_SERIAL},
-  { IPC_BUNDLE_LABEL_SET,  "bundle-label-set",   P_SILENT|P_SERIAL|P_DIR},
-  { IPC_BUNDLE_LABEL_SET,  "bundle-label",       P_SILENT|P_HELPONLY},
-  { IPC_BUNDLE_LABEL_FIND, "bundle-label-find",  P_SILENT|P_DIR},
-  { IPC_BUNDLE_LABEL_FIND, "bundle-find",      P_DIR},
+  return;
+}
 
-  { IPC_NONE,         "prop",          P_HELPONLY},
-  { IPC_PROP_LIST,    "prop-list",     P_SERIAL},
-  { IPC_PROP_DESC,    "prop-describe", P_SERIAL|P_KEY},
-  { IPC_PROP_GET,     "prop-get",      P_SERIAL|P_KEY},
-  { IPC_PROP_SET,     "prop-set",      P_SERIAL|P_KEY|P_VALUE},
-  { IPC_PROP_LIST,    "list",          P_SILENT|P_SERIAL},
-  { IPC_PROP_DESC,    "describe",      P_SILENT|P_SERIAL|P_KEY},
-  { IPC_PROP_DESC,    "explain",       P_SILENT|P_SERIAL|P_KEY},
-  { IPC_PROP_GET,     "print",         P_SILENT|P_SERIAL|P_KEY},
-  { IPC_PROP_GET,     "get",           P_SILENT|P_SERIAL|P_KEY},
-  { IPC_PROP_SET,     "set",           P_SILENT|P_SERIAL|P_KEY|P_VALUE},
-  { IPC_PROP_SET,     "let",           P_SILENT|P_SERIAL|P_KEY|P_VALUE},
 
-};
+int
+main(int argc, char **argv)
+{
+  int             ret = ECORE_CONFIG_ERR_SUCC, cc = 0;
+  connstate       cs = OFFLINE;
+  char           *pipe_name = NULL;
 
+  if (argc <= 1 ||
+      (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)) {
+    print_usage();
+    return 0;
+  }
 
+  pipe_name = argv[1];
+  E(2, "examine: connecting to %s.\n", pipe_name);
 
-int debug=1;
+  ecore_init();
+  ecore_app_args_set(argc, (const char **) argv);
+  ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ex_ipc_sigexit, &cs);
 
-void print_usage(void);
+  ewl_init(&argc, argv);
 
-Ewl_Widget *main_win;
-Ewl_Widget *main_box;
+  main_win = ewl_window_new();
+  ewl_window_set_title(EWL_WINDOW(main_win), "Examine Configuration Client");
+  ewl_object_set_minimum_size(EWL_OBJECT(main_win), 200, 100);
+  ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW,
+                      __destroy_main_window, NULL);
 
-/*****************************************************************************/
+  main_box = ewl_vbox_new();
+  ewl_container_append_child(EWL_CONTAINER(main_win), main_box);
+  ewl_object_set_padding(EWL_OBJECT(main_box), 2, 2, 2, 2);
+  ewl_widget_show(main_box);
 
 
+reconnect:
+  cc++;
+  if ((ret = examine_client_init(pipe_name, &cs)) != ECORE_CONFIG_ERR_SUCC)
+    E(0, "examine: %sconnect to %s failed: %d\n", (cc > 1) ? "re" : "",
+      pipe_name, ret);
+  else {
+//    ewl_widget_show(main_win);
+    render_ewl();
+    ewl_widget_show(main_win);
+    ewl_main();
 
-int ex_ipc_server_con(void *data,int type,void *event) {
-  connstate                  *cs=(connstate *)data;
-  *cs=ONLINE;
-  E(1,"ecore_config: Connected .\n"); /*to %s.\n", pipe_name)); */
-  return 1; }
+  }
 
+  examine_client_exit();
+  ecore_shutdown();
 
+  return ret;
+}
 
-int ex_ipc_server_dis(void *data,int type,void *event) {
-  connstate                  *cs=(connstate *)data;
-  *cs=OFFLINE;
-  ecore_main_loop_quit();
-  E(1,"ecore_config: Disconnected.\n");
-  return 1; }
+void
+print_usage(void)
+{
+  printf("Examine - ecore_config Graphical Configuration Client\n");
+  printf("Version 0.0.1 (Nov 3 2003)\n");
+  printf("(c)2003 by HandyAndE.\n");
+  printf("Based on work in evidence by Azundris.\n");
+  printf("Usage: examine [options] target\n\n");
+  printf("Supported Options:\n");
+  printf("-h, --help        Print this help text\n");
 
+}
 
+void
+render_ewl(void)
+{
+  Ewl_Widget     *row, *cell[2], *text[2];
+  char           *label, *typename, *start, *end;
+  char           *prop_list;
+  int             tmpi;
+  double          tmpd;
 
-int ex_ipc_server_sent(void *data,int type,void *event) {
-  Ewl_Widget *row, *cell[2], *text[2];
-  char *label, *typename, *start, *end;
-  Ecore_Ipc_Event_Server_Data *e;
-  
-  e=(Ecore_Ipc_Event_Server_Data *)event;
-  E(2,"application sent: %2d.%02d  #%03d=>#%03d  \"%s\".%d\n",
-    e->major,e->minor,0,0,(char *)e->data,e->size);
-  if(e->data&&(e->size>0)) {
-    printf("%s\n",(char *)e->data);
+  prop_list = examine_client_list_props();
+  if (prop_list && (strlen(prop_list) > 0)) {
 
-    row = ewl_grid_new(2, 1);
+    row = ewl_grid_new(3, 1);
     cell[0] = ewl_cell_new();
     cell[1] = ewl_cell_new();
     text[0] = ewl_text_new("Property");
-    text[1] = ewl_text_new("type");
-    
+    text[1] = ewl_text_new("Value");
+
     ewl_container_append_child(EWL_CONTAINER(cell[0]), text[0]);
     ewl_container_append_child(EWL_CONTAINER(cell[1]), text[1]);
     ewl_grid_add(EWL_GRID(row), cell[0], 1, 1, 1, 1);
-    ewl_grid_add(EWL_GRID(row), cell[1], 2, 2, 1, 1);
+    ewl_grid_add(EWL_GRID(row), cell[1], 2, 3, 1, 1);
 
     ewl_widget_show(cell[0]);
     ewl_widget_show(cell[1]);
@@ -124,11 +131,11 @@
 
     ewl_container_append_child(EWL_CONTAINER(main_box), row);
     ewl_widget_show(row);
-    
-    start = (char *)e->data;
-    end = ((char *)e->data) + strlen((char *)e->data);
-    
-    while (*start) {
+
+    start = prop_list;
+    end = prop_list + strlen(prop_list);
+
+    while (start < end) {
       label = start;
       while (*start) {
         if (*start == ':') {
@@ -137,7 +144,8 @@
         }
         start++;
       }
-      start++; 
+
+      start++;
       typename = ++start;
       while (*start) {
         if (*start == '\n') {
@@ -148,273 +156,49 @@
       }
 
       if (*label && *typename) {
-        row = ewl_grid_new(2, 1);
+        row = ewl_grid_new(3, 1);
         cell[0] = ewl_cell_new();
         cell[1] = ewl_cell_new();
         text[0] = ewl_text_new(label);
 
         if (!strcmp(typename, "string"))
-          text[1] = ewl_entry_new("<a string>");
-        else if (!strcmp(typename, "integer")) 
+          text[1] = ewl_entry_new(examine_client_get_val(label));
+        else if (!strcmp(typename, "integer")) {
           text[1] = ewl_spinner_new();
-        else 
+          ewl_spinner_set_digits(EWL_SPINNER(text[1]), 0);
+          ewl_spinner_set_step(EWL_SPINNER(text[1]), 1);
+          sscanf(examine_client_get_val(label), "%d", &tmpi);
+          ewl_spinner_set_value(EWL_SPINNER(text[1]), tmpi);
+        } else if (!strcmp(typename, "float")) {
+          text[1] = ewl_spinner_new();
+//          ewl_spinner_set_digits(EWL_SPINNER(text[1]), 0);
+//          ewl_spinner_set_step(EWL_SPINNER(text[1]), 1);
+          sscanf(examine_client_get_val(label), "%lf", &tmpd);
+          ewl_spinner_set_value(EWL_SPINNER(text[1]), tmpd);
+        } else if (!strcmp(typename, "colour"))
+          text[1] = ewl_entry_new(examine_client_get_val(label));
+        else
           text[1] = ewl_text_new(typename);
 
         ewl_container_append_child(EWL_CONTAINER(cell[0]), text[0]);
         ewl_container_append_child(EWL_CONTAINER(cell[1]), text[1]);
         ewl_grid_add(EWL_GRID(row), cell[0], 1, 1, 1, 1);
-        ewl_grid_add(EWL_GRID(row), cell[1], 2, 2, 1, 1);
-             
+        ewl_grid_add(EWL_GRID(row), cell[1], 2, 3, 1, 1);
+
         ewl_widget_show(cell[0]);
         ewl_widget_show(cell[1]);
         ewl_widget_show(text[0]);
         ewl_widget_show(text[1]);
-        
+
         ewl_container_append_child(EWL_CONTAINER(main_box), row);
+        ewl_object_set_minimum_h(EWL_OBJECT(row), 22);
         ewl_widget_show(row);
       }
 
       start++;
     }
   }
-  else if(e->response<0)
-    printf("error #%d\n",e->response);
-  else if(!e->response)
-    printf("OK\n");
-  else
-    printf("result: %d\n",e->response);
-  ecore_main_loop_quit();
-  return 1; }
-
-
-
-/*****************************************************************************/
-/* parser */
-
-
-
-static long get_serial(char **m) {
-  long ret=-1;
-  if(m&&*m) {
-    char *b;
-    ret=strtol(*m,&b,10);
-    if(b==*m)
-      ret=0;
-    else {
-      while(isspace(*b))
-        b++;
-      *m=b; }}
-  return ret; }
-
-
-
-static int get_token(char **beg,char **end,int tol) {
-  int     l;
-  char   *b=*beg,*e;
-
-  if(!b||!*b)
-    return ECORE_CONFIG_ERR_NODATA;
-
-  while(isspace(*b))
-    b++;
-  e=b;
-
-  if(*e=='\"') {
-    do {
-      e++;
-      if(*e=='\\')
-        e++;
-    } while(*e&&*e!='\"'); }
-  else {
-    while(*e&&!isspace(*e)) {
-      if(tol&&isupper(*e))
-        *e=tolower(*e);
-      e++; }}
-
-  if(*e) {
-    *(e++)='\0';
-    while(*e&&isspace(*e))
-      *(e++)='\0';
-    *end=e; }
-  else
-    *end=NULL;
-  *beg=b;
-  l=e-b;
-  return (l<=0)?ECORE_CONFIG_ERR_NODATA:l; }
-
-
-
-/*****************************************************************************/
-
-
-
-static int handle_any(ex_ipc_server_list **server,call *cp,char *line) {
-  long  serial=-1;
-  int   ret,pars=0,l=0;
-  char *b=line,*e,*file=NULL,*k=NULL,*v=NULL,*m=NULL;
-
-  if(cp->signature&P_SERIAL)
-    serial=get_serial(&b);
-
-  if(cp->signature&(P_DIR|P_FILE)) {
-    if((ret=get_token(&b,&e,FALSE))<0)
-      return ret;
-    file=b;
-    pars++;
-    b=e; }
-    /*  b=e?e+1:NULL; */
-
-  if(cp->signature&(P_KEY)) {
-    if((ret=get_token(&b,&e,TRUE))<0)
-      return ret;
-    k=b;
-    pars++;
-    b=e; }
-    /*  b=e?e+1:NULL; */
-        
-  if(cp->signature&(P_VALUE)) {
-    if((ret=get_token(&b,&e,FALSE))<0)
-      return ret;
-    v=b;
-    pars++;
-    b=e; }
-    /*  b=e?e+1:NULL; */
-        
-  if(file)
-    send_append(&m,&l,file);
-  if(k)
-    send_append(&m,&l,k);
-  if(v)
-    send_append(&m,&l,v);
-
-  E(3,"found \"%s\" |serial:%ld|file:%s|key:%s|value:%s|\n",cp->name,serial,file,k,v);
-
-  ret=ex_ipc_send(server,cp->id,serial,m,l);
-  if(m)
-    free(m);
-  return ret; }
-
-
-
-
-
-
-/*****************************************************************************/
-
-
-
-static int abbrevcmp(char *a,char *t) {
-  size_t  l1;
-  char   *p,*q;
-  int     ret;
-
-  while(1) {
-    if(!(p=strchr(a,'-')))
-      p=a+strlen(a);
-    l1=p-a;
-    if((ret=strncasecmp(a,t,l1)))
-      return ret;
-
-    a=p;
-    if(*a)
-      a++;
-
-    if(!(q=strchr(t,'-')))
-      t=t+strlen(t);
-    else
-      t=q+1;
-
-    if(!*a)
-      return *t?-1:0;
-    else if(!*t)
-      return 1; }}
-
-
-
-static call *find_call(char *b) {
-  int          nc=sizeof(calls)/sizeof(call);
-  call        *cp=calls,*r=NULL;
-  while(nc-->0) {
-    if(!abbrevcmp(b,cp->name)) {
-      if(r) {
-        printf("\"%s\" is not unique.\n",b);
-        return NULL; }
-      r=cp; }
-    cp++; }
-  return r; }
-
-
-
-
-
-/*****************************************************************************/
-
-void  __destroy_main_window(Ewl_Widget *main_win, void *ex_data, void *user_data) {
-  ewl_widget_destroy(main_win);
-  ewl_main_quit();
-
-  return;
-}
-        
-
-int main(int argc,char **argv) {
-  ex_ipc_server_list *server=NULL;
-  int                ret=ECORE_CONFIG_ERR_SUCC,cc=0;
-  connstate          cs=OFFLINE;
-  char              *pipe_name=NULL;
-
-  if (argc <= 1  || (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0))  {
-    print_usage();
-    return 0;
-  }
-
-  pipe_name=argv[1];
-  printf("ecore_configr: connecting to %s.\n", pipe_name);
-  
-  ecore_init();
-  ecore_app_args_set(argc,(const char **)argv);
-  ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,ex_ipc_sigexit,&cs);
-
-  ewl_init(&argc, argv);
-
-  main_win = ewl_window_new();
-  ewl_window_set_title(EWL_WINDOW(main_win), "Examine Configuration Client");
-  ewl_object_set_minimum_size(EWL_OBJECT(main_win), 200, 100);
-  ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW, __destroy_main_window, 
NULL);
-
-  main_box = ewl_vbox_new();
-  ewl_container_append_child(EWL_CONTAINER(main_win), main_box);
-  ewl_object_set_padding(EWL_OBJECT(main_box), 2, 2, 2, 2);
-  ewl_widget_show(main_box);
- 
-
-reconnect:
-  cc++;
-  if((ret=ex_ipc_init(&server,pipe_name,&cs))!=ECORE_CONFIG_ERR_SUCC)
-    E(0,"exsh: %sconnect to %s failed: %d\n",(cc>1)?"re":"",pipe_name,ret);
-  else {
-
-    call *c=find_call("prop-list");
-    handle_any(&server, c, "");
-    ewl_widget_show(main_win);
-    ewl_main();
-    
-  }
-
-  ex_ipc_exit(&server);
-  ecore_shutdown();
-
-  return ret; }
-
-void print_usage(void) {
-  printf("Examine - ecore_config Graphical Configuration Client\n");
-  printf("Version 0.0.1 (Nov 3 2003)\n");
-  printf("(c)2003 by HandyAndE.\n");
-  printf("Based on work in evidence by Azundris.\n");
-  printf("Usage: examine [options] target\n\n");
-  printf("Supported Options:\n");
-  printf("-h, --help        Print this help text\n");
-
+  free(prop_list);
 }
 
 /*****************************************************************************/
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/examine/src/exsh.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- exsh.c      5 Jan 2004 20:45:10 -0000       1.1
+++ exsh.c      13 Jan 2004 19:51:50 -0000      1.2
@@ -1,4 +1,6 @@
+
 /* by Azundris */
+
 /* Modified for ecore_config by HandyAndE */
 
 #include "Ecore_Config.h"
@@ -18,9 +20,9 @@
 #  elif defined(HAVE_READLINE_H)
 #    include <readline.h>
 #  else
-extern char *readline();
+extern char    *readline();
 #  endif
-char *cmdline=NULL;
+char           *cmdline = NULL;
 #endif
 
 #ifdef HAVE_READLINE_HISTORY
@@ -29,9 +31,9 @@
 #  elif defined(HAVE_HISTORY_H)
 #    include <history.h>
 #  else
-extern void add_history();
-extern int  write_history();
-extern int  read_history();
+extern void     add_history();
+extern int      write_history();
+extern int      read_history();
 #  endif
 #endif
 
@@ -52,54 +54,75 @@
 
 
 typedef enum {
-  P_NONE=0,
-  P_SERIAL=1,
-  P_DIR=2,
-  P_FILE=4,
-  P_KEY=8,
-  P_VALUE=16,
-  P_SILENT=32,
-  P_HELPONLY=64,
-  P_LAST=P_HELPONLY } para;
+  P_NONE = 0,
+  P_SERIAL = 1,
+  P_DIR = 2,
+  P_FILE = 4,
+  P_KEY = 8,
+  P_VALUE = 16,
+  P_SILENT = 32,
+  P_HELPONLY = 64,
+  P_LAST = P_HELPONLY
+} para;
 
 
 typedef struct _call {
-  ex_ipc_call  id;
-  char        *name;
-  para         signature;
-  const char  *help; } call;
-
-void print_usage(void);
-
-static call calls[]={
-  { IPC_NONE,         "bundle",           P_HELPONLY, "List of propertyset-related 
commands" },
-  { IPC_BUNDLE_LIST,     "bundle-list",      P_NONE, "bundle.list\nList all property 
sets, giving bundle id and label for each." },
-  { IPC_BUNDLE_NEW,      "bundle-new",       P_DIR, "bundle.new <label>\nCreate a new 
bundle labeled <label>." },
-  { IPC_BUNDLE_LABEL_GET,  "bundle-label-get",   P_SILENT|P_SERIAL, "bundle.label.get 
<bundle-id>\nShow the label of bundle <bundle-id>." },
-  { IPC_BUNDLE_LABEL_GET,  "bundle-label",       P_SERIAL, "bundle.label -- short for 
bundle.label.get, see there." },
-  { IPC_BUNDLE_LABEL_SET,  "bundle-label-set",   P_SILENT|P_SERIAL|P_DIR, 
"bundle.label.set <bundle-id> <label>\nLabel the bundle <bundle-id> <label>." },
-  { IPC_BUNDLE_LABEL_SET,  "bundle-label",       P_SILENT|P_HELPONLY, "List of 
bundle-label related functions." },
-  { IPC_BUNDLE_LABEL_FIND, "bundle-label-find",  P_SILENT|P_DIR, "bundle.label.find 
<label>\nReturn the ID of the first bundle labeled as <label>." },
-  { IPC_BUNDLE_LABEL_FIND, "bundle-find",      P_DIR, "bundle.find -- short for 
bundle.label.find, see there." },
-
-  { IPC_NONE,         "prop",          P_HELPONLY, "List of property-related 
commands" },
-  { IPC_PROP_LIST,    "prop-list",     P_SERIAL, "prop.list <bundle-id>\nList all 
properties that are currently registered for bundle <bundle-id>." },
-  { IPC_PROP_DESC,    "prop-describe", P_SERIAL|P_KEY, "prop.desc <bundle-id> 
<prop>\nDescribe property <prop> set on bundle <bundle-id>." },
-  { IPC_PROP_GET,     "prop-get",      P_SERIAL|P_KEY, "prop.get <bundle-id> 
<prop>\nShow the value of property <prop> set on bundle <bundle-id>." },
-  { IPC_PROP_SET,     "prop-set",      P_SERIAL|P_KEY|P_VALUE, "prop.set <bundle-id> 
<prop> <new-value>\nSet the value of property <prop> set on bundle <bundle-id> to 
<new-value>." },
-  { IPC_PROP_LIST,    "list",          P_SILENT|P_SERIAL, "list -- short for 
prop.list, see there." },
-  { IPC_PROP_DESC,    "describe",      P_SILENT|P_SERIAL|P_KEY, "desc -- short for 
prop.desc, see there." },
-  { IPC_PROP_DESC,    "explain",       P_SILENT|P_SERIAL|P_KEY, "desc -- short for 
prop.desc, see there." },
-  { IPC_PROP_GET,     "print",         P_SILENT|P_SERIAL|P_KEY, "get -- short for 
prop.get, see there." },
-  { IPC_PROP_GET,     "get",           P_SILENT|P_SERIAL|P_KEY, "get -- short for 
prop.get, see there." },
-  { IPC_PROP_SET,     "set",           P_SILENT|P_SERIAL|P_KEY|P_VALUE, "set -- short 
for prop.get, see there." },
-  { IPC_PROP_SET,     "let",           P_SILENT|P_SERIAL|P_KEY|P_VALUE, "let -- short 
for prop.get, see there." },
+  ex_ipc_call     id;
+  char           *name;
+  para            signature;
+  const char     *help;
+} call;
+
+void            print_usage(void);
+
+static call     calls[] = {
+  {IPC_NONE, "bundle", P_HELPONLY, "List of propertyset-related commands"},
+  {IPC_BUNDLE_LIST, "bundle-list", P_NONE,
+   "bundle.list\nList all property sets, giving bundle id and label for each."},
+  {IPC_BUNDLE_NEW, "bundle-new", P_DIR,
+   "bundle.new <label>\nCreate a new bundle labeled <label>."},
+  {IPC_BUNDLE_LABEL_GET, "bundle-label-get", P_SILENT | P_SERIAL,
+   "bundle.label.get <bundle-id>\nShow the label of bundle <bundle-id>."},
+  {IPC_BUNDLE_LABEL_GET, "bundle-label", P_SERIAL,
+   "bundle.label -- short for bundle.label.get, see there."},
+  {IPC_BUNDLE_LABEL_SET, "bundle-label-set", P_SILENT | P_SERIAL | P_DIR,
+   "bundle.label.set <bundle-id> <label>\nLabel the bundle <bundle-id> <label>."},
+  {IPC_BUNDLE_LABEL_SET, "bundle-label", P_SILENT | P_HELPONLY,
+   "List of bundle-label related functions."},
+  {IPC_BUNDLE_LABEL_FIND, "bundle-label-find", P_SILENT | P_DIR,
+   "bundle.label.find <label>\nReturn the ID of the first bundle labeled as 
<label>."},
+  {IPC_BUNDLE_LABEL_FIND, "bundle-find", P_DIR,
+   "bundle.find -- short for bundle.label.find, see there."},
+
+  {IPC_NONE, "prop", P_HELPONLY, "List of property-related commands"},
+  {IPC_PROP_LIST, "prop-list", P_SERIAL,
+   "prop.list <bundle-id>\nList all properties that are currently registered for 
bundle <bundle-id>."},
+  {IPC_PROP_DESC, "prop-describe", P_SERIAL | P_KEY,
+   "prop.desc <bundle-id> <prop>\nDescribe property <prop> set on bundle 
<bundle-id>."},
+  {IPC_PROP_GET, "prop-get", P_SERIAL | P_KEY,
+   "prop.get <bundle-id> <prop>\nShow the value of property <prop> set on bundle 
<bundle-id>."},
+  {IPC_PROP_SET, "prop-set", P_SERIAL | P_KEY | P_VALUE,
+   "prop.set <bundle-id> <prop> <new-value>\nSet the value of property <prop> set on 
bundle <bundle-id> to <new-value>."},
+  {IPC_PROP_LIST, "list", P_SILENT | P_SERIAL,
+   "list -- short for prop.list, see there."},
+  {IPC_PROP_DESC, "describe", P_SILENT | P_SERIAL | P_KEY,
+   "desc -- short for prop.desc, see there."},
+  {IPC_PROP_DESC, "explain", P_SILENT | P_SERIAL | P_KEY,
+   "desc -- short for prop.desc, see there."},
+  {IPC_PROP_GET, "print", P_SILENT | P_SERIAL | P_KEY,
+   "get -- short for prop.get, see there."},
+  {IPC_PROP_GET, "get", P_SILENT | P_SERIAL | P_KEY,
+   "get -- short for prop.get, see there."},
+  {IPC_PROP_SET, "set", P_SILENT | P_SERIAL | P_KEY | P_VALUE,
+   "set -- short for prop.get, see there."},
+  {IPC_PROP_SET, "let", P_SILENT | P_SERIAL | P_KEY | P_VALUE,
+   "let -- short for prop.get, see there."},
 
 };
 
 
 
-int debug=99;
+int             debug = 99;
 
 
 
@@ -107,93 +130,118 @@
 
 
 
-int ex_ipc_server_con(void *data,int type,void *event) {
-  connstate                  *cs=(connstate *)data;
-  *cs=ONLINE;
-  E(1,"exsh: Connected .\n", NULL); /*to %s.\n", pipe_name)); */
-  return 1; }
+int
+ex_ipc_server_con(void *data, int type, void *event)
+{
+  connstate      *cs = (connstate *) data;
+
+  *cs = ONLINE;
+  E(1, "exsh: Connected .\n", NULL);    /*to %s.\n", pipe_name)); */
+  return 1;
+}
+
 
 
+int
+ex_ipc_server_dis(void *data, int type, void *event)
+{
+  connstate      *cs = (connstate *) data;
 
-int ex_ipc_server_dis(void *data,int type,void *event) {
-  connstate                  *cs=(connstate *)data;
-  *cs=OFFLINE;
+  *cs = OFFLINE;
   ecore_main_loop_quit();
-  E(1,"exsh: Disconnected.\n", NULL);
-  return 1; }
+  E(1, "exsh: Disconnected.\n", NULL);
+  return 1;
+}
 
 
 
-int ex_ipc_server_sent(void *data,int type,void *event) {
-  Ecore_Ipc_Event_Server_Data *e=(Ecore_Ipc_Event_Server_Data *)event;
-  E(2,"application sent: %2d.%02d  #%03d=>#%03d  \"%s\".%d\n",
-    e->major,e->minor,0,0,(char *)e->data,e->size);
-  if(e->data&&(e->size>0))
-    printf(OUT "%s\n",(char *)e->data);
-  else if(e->response<0)
-    printf(OUT "error #%d\n",e->response);
-  else if(!e->response)
+int
+ex_ipc_server_sent(void *data, int type, void *event)
+{
+  Ecore_Ipc_Event_Server_Data *e = (Ecore_Ipc_Event_Server_Data *) event;
+
+  E(2, "application sent: %2d.%02d  #%03d=>#%03d  \"%s\".%d\n",
+    e->major, e->minor, 0, 0, (char *) e->data, e->size);
+  if (e->data && (e->size > 0))
+    printf(OUT "%s\n", (char *) e->data);
+  else if (e->response < 0)
+    printf(OUT "error #%d\n", e->response);
+  else if (!e->response)
     printf(OUT "OK\n");
   else
-    printf(OUT "result: %d\n",e->response);
+    printf(OUT "result: %d\n", e->response);
   ecore_main_loop_quit();
-  return 1; }
+  return 1;
+}
 
 
 
 /*****************************************************************************/
+
 /* parser */
 
 
 
-static long get_serial(char **m) {
-  long ret=-1;
-  if(m&&*m) {
-    char *b;
-    ret=strtol(*m,&b,10);
-    if(b==*m)
-      ret=0;
+static long
+get_serial(char **m)
+{
+  long            ret = -1;
+
+  if (m && *m) {
+    char           *b;
+
+    ret = strtol(*m, &b, 10);
+    if (b == *m)
+      ret = 0;
     else {
-      while(isspace(*b))
+      while (isspace(*b))
         b++;
-      *m=b; }}
-  return ret; }
+      *m = b;
+    }
+  }
+  return ret;
+}
 
 
 
-static int get_token(char **beg,char **end,int tol) {
-  int     l;
-  char   *b=*beg,*e;
+static int
+get_token(char **beg, char **end, int tol)
+{
+  int             l;
+  char           *b = *beg, *e;
 
-  if(!b||!*b)
+  if (!b || !*b)
     return ECORE_CONFIG_ERR_NODATA;
 
-  while(isspace(*b))
+  while (isspace(*b))
     b++;
-  e=b;
+  e = b;
 
-  if(*e=='\"') {
+  if (*e == '\"') {
     do {
       e++;
-      if(*e=='\\')
+      if (*e == '\\')
         e++;
-    } while(*e&&*e!='\"'); }
-  else {
-    while(*e&&!isspace(*e)) {
-      if(tol&&isupper(*e))
-        *e=tolower(*e);
-      e++; }}
-
-  if(*e) {
-    *(e++)='\0';
-    while(*e&&isspace(*e))
-      *(e++)='\0';
-    *end=e; }
-  else
-    *end=NULL;
-  *beg=b;
-  l=e-b;
-  return (l<=0)?ECORE_CONFIG_ERR_NODATA:l; }
+    } while (*e && *e != '\"');
+  } else {
+    while (*e && !isspace(*e)) {
+      if (tol && isupper(*e))
+        *e = tolower(*e);
+      e++;
+    }
+  }
+
+  if (*e) {
+    *(e++) = '\0';
+    while (*e && isspace(*e))
+      *(e++) = '\0';
+    *end = e;
+  } else
+    *end = NULL;
+  *beg = b;
+  l = e - b;
+  return (l <= 0) ? ECORE_CONFIG_ERR_NODATA : l;
+}
 
 
 
@@ -201,51 +249,58 @@
 
 
 
-static int handle_any(ex_ipc_server_list **server_list,call *cp,char *line) {
-  long  serial=-1;
-  int   ret,pars=0,l=0;
-  char *b=line,*e,*file=NULL,*k=NULL,*v=NULL,*m=NULL;
+static int
+handle_any(ex_ipc_server_list ** server_list, call * cp, char *line)
+{
+  long            serial = -1;
+  int             ret, pars = 0, l = 0;
+  char           *b = line, *e, *file = NULL, *k = NULL, *v = NULL, *m = NULL;
 
-  if(cp->signature&P_SERIAL)
-    serial=get_serial(&b);
+  if (cp->signature & P_SERIAL)
+    serial = get_serial(&b);
 
-  if(cp->signature&(P_DIR|P_FILE)) {
-    if((ret=get_token(&b,&e,FALSE))<0)
+  if (cp->signature & (P_DIR | P_FILE)) {
+    if ((ret = get_token(&b, &e, FALSE)) < 0)
       return ret;
-    file=b;
+    file = b;
     pars++;
-    b=e; }
-    /*  b=e?e+1:NULL; */
+    b = e;
+  }
+  /*  b=e?e+1:NULL; */
 
-  if(cp->signature&(P_KEY)) {
-    if((ret=get_token(&b,&e,TRUE))<0)
+  if (cp->signature & (P_KEY)) {
+    if ((ret = get_token(&b, &e, TRUE)) < 0)
       return ret;
-    k=b;
+    k = b;
     pars++;
-    b=e; }
-    /*  b=e?e+1:NULL; */
-        
-  if(cp->signature&(P_VALUE)) {
-    if((ret=get_token(&b,&e,FALSE))<0)
+    b = e;
+  }
+  /*  b=e?e+1:NULL; */
+
+  if (cp->signature & (P_VALUE)) {
+    if ((ret = get_token(&b, &e, FALSE)) < 0)
       return ret;
-    v=b;
+    v = b;
     pars++;
-    b=e; }
-    /*  b=e?e+1:NULL; */
-        
-  if(file)
-    send_append(&m,&l,file);
-  if(k)
-    send_append(&m,&l,k);
-  if(v)
-    send_append(&m,&l,v);
+    b = e;
+  }
+  /*  b=e?e+1:NULL; */
+
+  if (file)
+    send_append(&m, &l, file);
+  if (k)
+    send_append(&m, &l, k);
+  if (v)
+    send_append(&m, &l, v);
 
-  E(3,"found \"%s\" |serial:%ld|file:%s|key:%s|value:%s|\n",cp->name,serial,file,k,v);
+  E(3, "found \"%s\" |serial:%ld|file:%s|key:%s|value:%s|\n", cp->name, serial,
+    file, k, v);
 
-  ret=ex_ipc_send(server_list,cp->id,serial,m,l);
-  if(m)
+  ret = ex_ipc_send(server_list, cp->id, serial, m, l);
+  if (m)
     free(m);
-  return ret; }
+  return ret;
+}
 
 
 
@@ -256,210 +311,261 @@
 
 
 
-static char *clean(char *c) {
-  char   *p=c;
-  size_t  l;
+static char    *
+clean(char *c)
+{
+  char           *p = c;
+  size_t          l;
 
-  while(*p) {
-    if(*p=='\"') {
+  while (*p) {
+    if (*p == '\"') {
       do {
         p++;
-        if(*p=='\\')
+        if (*p == '\\')
           p++;
-      } while(*p&&*p!='\"');
-      if(!*p) {
-        E(0,"unterminated string in input?\n", NULL);
-        *c='\0';
-        return c; }
-      else
-        p++; }
-    else if(isspace(*p)) {    /* turn any sort of space into a single ' ' */
-      l=strlen(p);
-      while(isspace(p[1]))
-        memmove(p,p+1,l--);
-      *(p++)=' '; }
-    else
-      p++; }
+      } while (*p && *p != '\"');
+      if (!*p) {
+        E(0, "unterminated string in input?\n", NULL);
+        *c = '\0';
+        return c;
+      } else
+        p++;
+    } else if (isspace(*p)) {   /* turn any sort of space into a single ' ' */
+      l = strlen(p);
+      while (isspace(p[1]))
+        memmove(p, p + 1, l--);
+      *(p++) = ' ';
+    } else
+      p++;
+  }
+
+  if ((l = strlen(c))) {
+    while (isspace(*c))
+      memmove(c, c + 1, l--);
+    while (isspace(c[l - 1]))
+      c[l - 1] = '\0';
+  }
 
-  if((l=strlen(c))) {
-    while(isspace(*c))
-      memmove(c,c+1,l--);
-    while(isspace(c[l-1]))
-      c[l-1]='\0'; }
-
-  p=c;
-  while(*p&&!isspace(*p)) {
-    if(!isalpha(*p)) {
-      while(p[1]&&!isalpha(p[1]))
-        memmove(p,p+1,strlen(p));
-      *p='-'; }
-    p++; }
-
-  return c; }
+  p = c;
+  while (*p && !isspace(*p)) {
+    if (!isalpha(*p)) {
+      while (p[1] && !isalpha(p[1]))
+        memmove(p, p + 1, strlen(p));
+      *p = '-';
+    }
+    p++;
+  }
+
+  return c;
+}
 
 
 
-static int abbrevcmp(char *a,char *t) {
-  size_t  l1;
-  char   *p,*q;
-  int     ret;
-
-  while(1) {
-    if(!(p=strchr(a,'-')))
-      p=a+strlen(a);
-    l1=p-a;
-    if((ret=strncasecmp(a,t,l1)))
+static int
+abbrevcmp(char *a, char *t)
+{
+  size_t          l1;
+  char           *p, *q;
+  int             ret;
+
+  while (1) {
+    if (!(p = strchr(a, '-')))
+      p = a + strlen(a);
+    l1 = p - a;
+    if ((ret = strncasecmp(a, t, l1)))
       return ret;
 
-    a=p;
-    if(*a)
+    a = p;
+    if (*a)
       a++;
 
-    if(!(q=strchr(t,'-')))
-      t=t+strlen(t);
+    if (!(q = strchr(t, '-')))
+      t = t + strlen(t);
     else
-      t=q+1;
+      t = q + 1;
 
-    if(!*a)
-      return *t?-1:0;
-    else if(!*t)
-      return 1; }}
+    if (!*a)
+      return *t ? -1 : 0;
+    else if (!*t)
+      return 1;
+  }
+}
 
 
 
-static call *find_call(char *b) {
-  int          nc=sizeof(calls)/sizeof(call);
-  call        *cp=calls,*r=NULL;
-  while(nc-->0) {
-    if(!abbrevcmp(b,cp->name)) {
-      if(r) {
-        printf(ERR "\"%s\" is not unique.\n",b);
-        return NULL; }
-      r=cp; }
-    cp++; }
-  return r; }
+static call    *
+find_call(char *b)
+{
+  int             nc = sizeof(calls) / sizeof(call);
+  call           *cp = calls, *r = NULL;
+
+  while (nc-- > 0) {
+    if (!abbrevcmp(b, cp->name)) {
+      if (r) {
+        printf(ERR "\"%s\" is not unique.\n", b);
+        return NULL;
+      }
+      r = cp;
+    }
+    cp++;
+  }
+  return r;
+}
 
 
 
-static call *find_abbrev(char **beg,char **end) {
-  char        *b=*beg,*m,*q;
-  size_t       l=strlen(b);
-  call        *cp=calls;
+static call    *
+find_abbrev(char **beg, char **end)
+{
+  char           *b = *beg, *m, *q;
+  size_t          l = strlen(b);
+  call           *cp = calls;
 
-  if(!(q=m=malloc(l*2)))
+  if (!(q = m = malloc(l * 2)))
     return NULL;
 
-  while(*b) {
-    *(q++)=*(b++);
-    *(q++)='-'; }
-  *(--q)='\0';
+  while (*b) {
+    *(q++) = *(b++);
+    *(q++) = '-';
+  }
+  *(--q) = '\0';
 
-  cp=find_call(m);
+  cp = find_call(m);
 
   free(m);
-  return cp; }
+  return cp;
+}
 
 
 
-static call *find_with_delims(char **beg,char **end) {
-  char *b=*beg;
-  int   d=0;
+static call    *
+find_with_delims(char **beg, char **end)
+{
+  char           *b = *beg;
+  int             d = 0;
 
-  while(*b) {
-    if(*b=='-')
+  while (*b) {
+    if (*b == '-')
       d++;
-    b++; }
-  return d?find_call(*beg):NULL; }
+    b++;
+  }
+  return d ? find_call(*beg) : NULL;
+}
 
 
 
-static call *find_with_spaces(char **beg,char **end) {
-  call *cp=NULL,*lcp=NULL;
-  char *e=*end,*b=*beg,*d=NULL;
+static call    *
+find_with_spaces(char **beg, char **end)
+{
+  call           *cp = NULL, *lcp = NULL;
+  char           *e = *end, *b = *beg, *d = NULL;
 
-  if(!*end)
+  if (!*end)
     return find_call(b);
 
-  while(1) {
-    if(!(cp=find_call(b))) {
-      *e=' ';
-      if(d) {
-        *d='\0';
-        *end=d; }
-      return lcp; }
-    lcp=cp;
-    d=e;
-    *(e++)='-';
-    if(!(e=strchr(e,' '))) {
-      if((cp=find_call(b))) {
-        *end=NULL;
-        return cp; }
-      *end=d;
-      return lcp; }
-    *e='\0'; }}
+  while (1) {
+    if (!(cp = find_call(b))) {
+      *e = ' ';
+      if (d) {
+        *d = '\0';
+        *end = d;
+      }
+      return lcp;
+    }
+    lcp = cp;
+    d = e;
+    *(e++) = '-';
+    if (!(e = strchr(e, ' '))) {
+      if ((cp = find_call(b))) {
+        *end = NULL;
+        return cp;
+      }
+      *end = d;
+      return lcp;
+    }
+    *e = '\0';
+  }
+}
 
 
 
-static int parse_line(ex_ipc_server_list **server_list,char *line) {
-  call        *cp=NULL;
-  char        *c=NULL,*b=line,*e=NULL,*p;
-  int          ret=ECORE_CONFIG_ERR_SUCC,h=0;
+static int
+parse_line(ex_ipc_server_list ** server_list, char *line)
+{
+  call           *cp = NULL;
+  char           *c = NULL, *b = line, *e = NULL, *p;
+  int             ret = ECORE_CONFIG_ERR_SUCC, h = 0;
 
-  if(!line||!*line)
+  if (!line || !*line)
     return ECORE_CONFIG_ERR_IGNORED;
 
-  if(!(c=strdup(line)))
+  if (!(c = strdup(line)))
     return ECORE_CONFIG_ERR_OOM;
 
-  if((p=clean(c))) {
-    if(!strcasecmp(p,"help")) {
-      int   nc=sizeof(calls)/sizeof(call);
-      cp=calls;
+  if ((p = clean(c))) {
+    if (!strcasecmp(p, "help")) {
+      int             nc = sizeof(calls) / sizeof(call);
+
+      cp = calls;
       puts(HELP_ALL);
-      while(nc-->0) {
-        if((cp->signature&P_HELPONLY)&&!(cp->signature&P_SILENT))
-          printf("  %s\n",cp->name);
-        cp++; }
-      goto done; }
+      while (nc-- > 0) {
+        if ((cp->signature & P_HELPONLY) && !(cp->signature & P_SILENT))
+          printf("  %s\n", cp->name);
+        cp++;
+      }
+      goto done;
+    }
 
-    else if(!strncasecmp(p,"help ",5)) {
+    else if (!strncasecmp(p, "help ", 5)) {
       h++;
-      p+=5; }
+      p += 5;
+    }
 
-    b=p;
-    if((e=strchr(b,' ')))
-      *e='\0';
-    if(!(cp=find_with_delims(&b,&e))) {
-      if(!(cp=find_with_spaces(&b,&e))) {
-        if(e)
-          *e='\0';
-        cp=find_abbrev(&b,&e); }}
-    if(!cp)
-      ret=ECORE_CONFIG_ERR_NOTFOUND;
+    b = p;
+    if ((e = strchr(b, ' ')))
+      *e = '\0';
+    if (!(cp = find_with_delims(&b, &e))) {
+      if (!(cp = find_with_spaces(&b, &e))) {
+        if (e)
+          *e = '\0';
+        cp = find_abbrev(&b, &e);
+      }
+    }
+    if (!cp)
+      ret = ECORE_CONFIG_ERR_NOTFOUND;
     else {
-      if(h)
+      if (h)
         puts(cp->help);
-      else if(cp->signature&P_HELPONLY) {
-        int   nc=sizeof(calls)/sizeof(call),l=strlen(cp->name);
-        call *r=calls;
+      else if (cp->signature & P_HELPONLY) {
+        int             nc = sizeof(calls) / sizeof(call), l = strlen(cp->name);
+        call           *r = calls;
 
-        if(cp->help&&*cp->help)
+        if (cp->help && *cp->help)
           puts(cp->help);
-        while(nc-->0) {
-          
if(!strncmp(cp->name,r->name,l)&&(r->name[l]=='-')&&!(r->signature&P_SILENT))
-            printf("  %s\n",r->name);
-          r++; }}
-      else {
-        E(3,"parsed: \"%s\" => %s { \"%s\" }\n",b,cp->name,e?e:"");
-        if((ret=handle_any(server_list,cp,e?e+1:""))==ECORE_CONFIG_ERR_NODATA)
-          E(0,ERR "Insufficient parameters for %s: 
%s\n",cp->name,cp->help?cp->help:"");
-        else E(0,"ret: %d\n",ret); }}}
-  else
-    ret=ECORE_CONFIG_ERR_FAIL;
+        while (nc-- > 0) {
+          if (!strncmp(cp->name, r->name, l) && (r->name[l] == '-') &&
+              !(r->signature & P_SILENT))
+            printf("  %s\n", r->name);
+          r++;
+        }
+      } else {
+        E(3, "parsed: \"%s\" => %s { \"%s\" }\n", b, cp->name, e ? e : "");
+        if ((ret =
+             handle_any(server_list, cp,
+                        e ? e + 1 : "")) == ECORE_CONFIG_ERR_NODATA)
+          E(0, ERR "Insufficient parameters for %s: %s\n", cp->name,
+            cp->help ? cp->help : "");
+        else
+          E(0, "ret: %d\n", ret);
+      }
+    }
+  } else
+    ret = ECORE_CONFIG_ERR_FAIL;
 
- done:
+done:
   free(c);
-  return ret; }
+  return ret;
+}
 
 
 
@@ -470,98 +576,111 @@
 
 
 
-int main(int argc,char **argv) {
+int
+main(int argc, char **argv)
+{
   ex_ipc_server_list *server;
-  int                 ret,cc;
-  connstate           cs;
-  char               *p,*f,*q;
-  char               *pipe_name;
-  #ifndef HAVE_LIBREADLINE
-    char              buf[MI];
-  #elif defined(HAVE_READLINE_HISTORY)
-    char             *history;
-  #endif
-
-  f=NULL;
-  server=NULL;
-  pipe_name=NULL;
-  ret=ECORE_CONFIG_ERR_SUCC;
-  cc=0;
-  cs=OFFLINE;
+  int             ret, cc;
+  connstate       cs;
+  char           *p, *f, *q;
+  char           *pipe_name;
+
+#ifndef HAVE_LIBREADLINE
+  char            buf[MI];
+#elif defined(HAVE_READLINE_HISTORY)
+  char           *history;
+#endif
+
+  f = NULL;
+  server = NULL;
+  pipe_name = NULL;
+  ret = ECORE_CONFIG_ERR_SUCC;
+  cc = 0;
+  cs = OFFLINE;
 
-  if (argc <= 1  || (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0))  {
+  if (argc <= 1 ||
+      (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)) {
     print_usage();
     return 0;
   }
 
-  pipe_name=argv[1];
+  pipe_name = argv[1];
   printf("exsh: connecting to %s.\n", pipe_name);
-  
+
 #if defined(HAVE_READLINE_HISTORY)
-  *history=NULL;
+  *history = NULL;
 
   using_history();
   stifle_history(96);
-  if((p=getenv("HOME"))) {
-    if((history=malloc(strlen(p)+sizeof(HISTORY)))) {
-      strcat(strcpy(history,p),HISTORY);
-      read_history(history); }}
+  if ((p = getenv("HOME"))) {
+    if ((history = malloc(strlen(p) + sizeof(HISTORY)))) {
+      strcat(strcpy(history, p), HISTORY);
+      read_history(history);
+    }
+  }
 #endif
 
   ecore_init();
-  ecore_app_args_set(argc,(const char **)argv);
-  ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,ex_ipc_sigexit,&cs);
+  ecore_app_args_set(argc, (const char **) argv);
+  ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ex_ipc_sigexit, &cs);
 
 reconnect:
   cc++;
-  if((ret=ex_ipc_init(&server,pipe_name,&cs))!=ECORE_CONFIG_ERR_SUCC)
-    E(0,"exsh: %sconnect to %s failed: %d\n",(cc>1)?"re":"",pipe_name,ret);
+  if ((ret = ex_ipc_init(&server, pipe_name, &cs)) != ECORE_CONFIG_ERR_SUCC)
+    E(0, "exsh: %sconnect to %s failed: %d\n", (cc > 1) ? "re" : "", pipe_name,
+      ret);
   else {
-    while(1) {
-      p=NULL;
+    while (1) {
+      p = NULL;
       ecore_main_loop_iterate();
-      if(cs==OFFLINE) {
+      if (cs == OFFLINE) {
         ex_ipc_exit(&server);
-        cs=ONLINE;
-        goto reconnect; }
-
+        cs = ONLINE;
+        goto reconnect;
+      }
 #ifdef HAVE_LIBREADLINE
-      if((p=readline(IN))) {
+      if ((p = readline(IN))) {
 #else
       printf(IN);
-      if((f=p=fgets(buf,MI,stdin))) {
+      if ((f = p = fgets(buf, MI, stdin))) {
 #endif
-        q=strchr(p,'\n');
-        if(q)
-          *q='\0';
-        if(!strcasecmp(p,"exit")||!strcasecmp(p,"quit")) {
-          if(f)
+        q = strchr(p, '\n');
+        if (q)
+          *q = '\0';
+        if (!strcasecmp(p, "exit") || !strcasecmp(p, "quit")) {
+          if (f)
             free(f);
-          break; }
-
+          break;
+        }
 #ifdef HAVE_READLINE_HISTORY
         add_history(p);
 #endif
-        ret=parse_line(&server,p);
-        if((ret<ECORE_CONFIG_ERR_SUCC)&&(ret!=ECORE_CONFIG_ERR_IGNORED))
-          printf(ERR "error #%d: \"%s.\"\n",-ret,ecore_config_error(ret));
-        if(f)
-          free(f); }
-      else
-        break; }}
+        ret = parse_line(&server, p);
+        if ((ret < ECORE_CONFIG_ERR_SUCC) && (ret != ECORE_CONFIG_ERR_IGNORED))
+          printf(ERR "error #%d: \"%s.\"\n", -ret, ecore_config_error(ret));
+        if (f)
+          free(f);
+      } else
+        break;
+    }
+  }
 
   ex_ipc_exit(&server);
   ecore_shutdown();
 
 #ifdef HAVE_READLINE_HISTORY
-  if(history) {
+  if (history) {
     write_history(history);
-    free(history); }
+    free(history);
+  }
 #endif
 
-  return ret; }
+  return ret;
+}
 
-void print_usage(void) {
+void
+print_usage(void)
+{
   printf("Examine Shell - ecore_config Configuration Client\n");
   printf("Version 1.0.0 (Dec 6 2003)\n");
   printf("(c)2002-2003 by Azundris et al.\n");




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to