Index: /branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.basic/list.c
===================================================================
--- /branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.basic/list.c	(revision 35801)
+++ /branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.basic/list.c	(revision 35802)
@@ -2,4 +2,6 @@
 # define D_NLINES 100
 static char prompt[] = ">> ";
+
+static int set_list_varname (char *line, char *base, int N, int excelStyle);
 
 int list (int argc, char **argv) {
@@ -21,4 +23,14 @@
   }
 
+  int EXCEL_STYLE = FALSE;
+  if ((N = get_argument (argc, argv, "-excel-style"))) {
+    remove_argument (N, &argc, argv);
+    EXCEL_STYLE = TRUE;
+  }
+  if ((N = get_argument (argc, argv, "-excel"))) {
+    remove_argument (N, &argc, argv);
+    EXCEL_STYLE = TRUE;
+  }
+
   if ((N = get_argument (argc, argv, "-vectors"))) {
     remove_argument (N, &argc, argv);
@@ -49,5 +61,5 @@
     
     for (i = 0; i < argc - 3; i++) {
-      sprintf (line, "%s:%d", argv[1], i);
+      set_list_varname (line, argv[1], i, EXCEL_STYLE);
       set_str_variable (line, argv[i+3]);
     }
@@ -83,5 +95,7 @@
 	if (!word) break;
 	
-	sprintf (line, "%s:%d", argv[1], nWords);
+	// sprintf (line, "%s:%d", argv[1], nWords);
+	set_list_varname (line, argv[1], nWords, EXCEL_STYLE);
+
 	set_str_variable (line, word);
 	FREE (word);
@@ -120,5 +134,6 @@
       sprintf (line, "%s:%d", argv[3], i);
       value = get_variable (line);
-      sprintf (line, "%s:%d", argv[1], i);
+      // sprintf (line, "%s:%d", argv[1], i);
+      set_list_varname (line, argv[1], i, EXCEL_STYLE);
       set_str_variable (line, value);
     }
@@ -136,5 +151,6 @@
     N = get_int_variable (line, &found);
     for (i = 0; i < argc - 3; i++) {
-      sprintf (line, "%s:%d", argv[1], N + i);
+      // sprintf (line, "%s:%d", argv[1], N + i);
+      set_list_varname (line, argv[1], N + i, EXCEL_STYLE);
       set_str_variable (line, argv[i+3]);
     }
@@ -159,5 +175,6 @@
     N = get_int_variable (line, &found);
     for (i = 0; i < N; i++) {
-      sprintf (line, "%s:%d", argv[1], i);
+      // sprintf (line, "%s:%d", argv[1], i);
+      set_list_varname (line, argv[1], i, EXCEL_STYLE);
       value = get_variable (line);
       if (value == NULL) continue;
@@ -165,5 +182,6 @@
 	free (value);
 	for (j = i + 1; j < N; j++) {
-	  sprintf (line2, "%s:%d", argv[1], j);
+	  // sprintf (line2, "%s:%d", argv[1], j);
+	  set_list_varname (line2, argv[1], j, EXCEL_STYLE);
 	  next_value = get_variable (line2);
 	  set_str_variable (line, next_value);
@@ -235,5 +253,6 @@
       if (B != (char *) NULL) { *B = 0; }
       if (*A != 0) {
-	sprintf (line, "%s:%d", argv[1], i);
+	// sprintf (line, "%s:%d", argv[1], i);
+	set_list_varname (line, argv[1], i, EXCEL_STYLE);
 	set_str_variable (line, A);
 	A = B + 1;
@@ -283,10 +302,41 @@
 
     if (*input) { 
-      sprintf (line, "%s:%d", argv[1], i);
+      // sprintf (line, "%s:%d", argv[1], i);
+      set_list_varname (line, argv[1], i, EXCEL_STYLE);
       set_str_variable (line, input);
       free (input);
       i++;
-   }
+    }
   }
   return (TRUE);
 }
+
+static int set_list_varname (char *line, char *base, int N, int excelStyle) {
+
+  int i;
+    
+  // A-Z correspond to 0 - 25
+
+  if (excelStyle) {
+    float f = log(26.0);
+    float g = (N == 0) ? 0.0 : log(1.0*N);
+    int Ndigit = (int) (g / f) + 1;
+    if (Ndigit > 10) {
+      sprintf (line, "%s:ZZZZZZZZZZ", base);
+      return FALSE;
+    }
+    char name[12];
+    memset (name, 0, 12);
+    for (i = 0; i < Ndigit; i++) {
+      float Npow = Ndigit - i - 1;
+      float g = pow(26.0, Npow);
+      int V = (int) (N / g);
+      name[i] = (Npow == 0.0) ? 'A' + V : 'A' + V - 1;
+      N -= V * g;
+    }
+    sprintf (line, "%s:%s", base, name);
+  } else {
+    sprintf (line, "%s:%d", base, N);
+  }
+  return TRUE;
+}
Index: /branches/eam_branches/ipp-20130711/Ohana/src/opihi/lib.shell/ListOps.c
===================================================================
--- /branches/eam_branches/ipp-20130711/Ohana/src/opihi/lib.shell/ListOps.c	(revision 35801)
+++ /branches/eam_branches/ipp-20130711/Ohana/src/opihi/lib.shell/ListOps.c	(revision 35802)
@@ -189,12 +189,19 @@
 int is_list_data (char *line) {
 
-  char *comm, *temp;
-
-  temp = thisword (nextword (nextword (line)));
-  comm = thisword (line);
-
+  char *comm = NULL;
+  char *temp = NULL;
+  char *ptr  = NULL;
+
+  comm = thisword (line);
   if (comm == NULL) goto escape;
-
   if (strcmp (comm, "list")) goto escape;
+
+  ptr = nextword (line);
+  if (!strncmp("-excel", ptr, strlen("-excel"))) ptr = nextword (ptr);
+  if (!strncmp("-excel-style", ptr, strlen("-excel-style"))) ptr = nextword (ptr);
+  ptr = nextword (ptr);
+  if (!strncmp("-excel", ptr, strlen("-excel"))) ptr = nextword (ptr);
+  if (!strncmp("-excel-style", ptr, strlen("-excel-style"))) ptr = nextword (ptr);
+  temp = thisword (ptr);
 
   /* if (cond) (command) does not define a complete block */
