[PVFS2-CVS] commit by slang in pvfs2/test/client/sysint: del-eattr.c get-eattr.c set-eattr.c create.set.get.eattr.c module.mk.in get.eattr.c set.eattr.c

CVS commit program cvs at parl.clemson.edu
Wed Aug 10 16:38:11 EDT 2005


Update of /projects/cvsroot/pvfs2/test/client/sysint
In directory parlweb:/tmp/cvs-serv30967/test/client/sysint

Modified Files:
      Tag: slang-attr-cache-fixups-branch
	create.set.get.eattr.c module.mk.in 
Added Files:
      Tag: slang-attr-cache-fixups-branch
	del-eattr.c get-eattr.c set-eattr.c 
Removed Files:
      Tag: slang-attr-cache-fixups-branch
	get.eattr.c set.eattr.c 
Log Message:
merge changes from trunk since branch point into branch.  Effectively moves the branchpoint to the latest trunk.


--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ del-eattr.c	2005-08-10 15:38:11.000000000 -0400
@@ -0,0 +1,264 @@
+/*
+ * (C) 2004 Clemson University and The University of Chicago
+ * 
+ * See COPYING in top-level directory.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdlib.h>
+
+#include "pvfs2.h"
+#include "str-utils.h"
+#include "pint-sysint-utils.h"
+#include "../../../src/common/gossip/gossip.h"
+
+#ifndef PVFS2_VERSION
+#define PVFS2_VERSION "Unknown"
+#endif
+
+/* optional parameters, filled in by parse_args() */
+struct options
+{
+    PVFS_ds_keyval key;
+    int target_count;
+    char** destfiles;
+};
+
+static struct options* parse_args(int argc, char* argv[]);
+int pvfs2_deleattr (PVFS_ds_keyval key, char *destfile);
+static void usage(int argc, char** argv);
+int check_perm(char c);
+
+int main(int argc, char **argv)
+{
+  int ret = 0;
+  struct options* user_opts = NULL;
+  int i;
+
+  /* look at command line arguments */
+  user_opts = parse_args(argc, argv);
+  if(!user_opts)
+  {
+    fprintf(stderr, "Error: failed to parse "
+            "command line arguments.\n");
+    return(-1);
+  }
+
+  ret = PVFS_util_init_defaults();
+  if(ret < 0)
+  {
+    PVFS_perror("PVFS_util_init_defaults", ret);
+    return(-1);
+  }
+
+  /*
+   * for each file the user specified
+   * for each file the user specified
+   */
+  for (i = 0; i < user_opts->target_count; i++) {
+    ret = pvfs2_deleattr(user_opts->key,user_opts->destfiles[i]);
+    if (ret != 0) {
+      break;
+    }
+    /* TODO: need to free the request descriptions */
+  }
+  PVFS_sys_finalize();
+  return(ret);
+}
+
+/* pvfs2_deleattr()
+ *
+ * changes the mode of the given file to the given permissions
+ *
+ * returns zero on success and negative one on failure
+ */
+int pvfs2_deleattr (PVFS_ds_keyval key, char *destfile) {
+  int ret = -1;
+  char str_buf[PVFS_NAME_MAX] = {0};
+  char pvfs_path[PVFS_NAME_MAX] = {0};
+  PVFS_fs_id cur_fs;
+  PVFS_sysresp_lookup resp_lookup;
+  PVFS_object_ref parent_ref;
+  PVFS_credentials credentials;
+  /* translate local path into pvfs2 relative path */
+  ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
+  if(ret < 0)
+  {
+    PVFS_perror("PVFS_util_resolve", ret);
+    return -1;
+  }
+
+  PVFS_util_gen_credentials(&credentials);
+
+  /* this if-else statement just pulls apart the pathname into its
+   * parts....I think...this should be a function somewhere
+   */
+  if (strcmp(pvfs_path,"/") == 0)
+  {
+    memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
+    ret = PVFS_sys_lookup(cur_fs, pvfs_path,
+                          &credentials, &resp_lookup,
+                          PVFS2_LOOKUP_LINK_FOLLOW);
+    if (ret < 0)
+    {
+      PVFS_perror("PVFS_sys_lookup", ret);
+      return -1;
+    }
+    parent_ref.handle = resp_lookup.ref.handle;
+    parent_ref.fs_id = resp_lookup.ref.fs_id;
+  }
+  else
+  {
+    /* get the absolute path on the pvfs2 file system */
+    if (PINT_remove_base_dir(pvfs_path,str_buf,PVFS_NAME_MAX))
+    {
+      if (pvfs_path[0] != '/')
+      {
+        fprintf(stderr, "Error: poorly formatted path.\n");
+      }
+      fprintf(stderr, "Error: cannot retrieve entry name for "
+              "creation on %s\n",pvfs_path);
+      return -1;
+    }
+
+    ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials, 
+                                  &parent_ref.handle);
+    if(ret < 0)
+    {
+      PVFS_perror("PINT_lookup_parent", ret);
+      return -1;
+    }
+    else
+    {
+      parent_ref.fs_id = cur_fs;
+    }
+  }
+  memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
+
+  ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
+                            parent_ref, &credentials, &resp_lookup,
+                            PVFS2_LOOKUP_LINK_NO_FOLLOW);
+  if (ret != 0)
+  {
+    fprintf(stderr, "Target '%s' does not exist!\n", str_buf);
+    return -1;
+  }
+
+  /* del extended attribute */
+  /* gossip_set_debug_mask(1,0xffffffffffffffffUL);
+   * gossip_enable_stderr();
+   */
+  ret = PVFS_sys_deleattr(resp_lookup.ref, &credentials, &key);
+  if (ret < 0)
+  {
+      PVFS_perror("deleattr failed with errcode", ret);
+      return(-1);
+  }
+
+  return 0;
+}
+
+
+/* parse_args()
+ *
+ * parses command line arguments
+ *
+ * returns pointer to options structure on success, NULL on failure
+ */
+static struct options* parse_args(int argc, char* argv[])
+{
+    /* getopt stuff */
+    extern char* optarg;
+    extern int optind, opterr, optopt;
+    char flags[] = "v";
+    int one_opt = 0;
+    int i;
+
+    struct options* tmp_opts = NULL;
+
+    /* create storage for the command line options */
+    tmp_opts = (struct options*)malloc(sizeof(struct options));
+    if(!tmp_opts){
+	return(NULL);
+    }
+    memset(tmp_opts, 0, sizeof(struct options));
+
+    /* fill in defaults */
+    tmp_opts->key.buffer = NULL;
+    tmp_opts->key.buffer_sz = 0;
+    tmp_opts->target_count = 0;
+    tmp_opts->destfiles = NULL;
+
+    if (argc < 3) {
+      usage(argc,argv);
+      exit(0);
+    } 
+
+    /* look at command line arguments */
+    while((one_opt = getopt(argc, argv, flags)) != EOF)
+    {
+	switch(one_opt){
+            case('v'):
+                printf("%s\n", PVFS2_VERSION);
+                exit(0);
+	    case('?'):
+                printf("?\n");
+		usage(argc, argv);
+		exit(EXIT_FAILURE);
+	}
+    }
+    /* parse key from argv[optind] */
+    tmp_opts->key.buffer = argv[optind];
+    tmp_opts->key.buffer_sz = strlen(((char *)tmp_opts->key.buffer)) + 1;
+
+    /* finished up argument processing */
+    optind = optind + 1;
+    tmp_opts->target_count = argc-optind;
+    tmp_opts->destfiles=(char **)malloc(sizeof(char *)*(tmp_opts->target_count));
+    for (i = 0; i < tmp_opts->target_count; i++) {
+      char *cur_arg_str = argv[optind+i];
+      int length = strlen(cur_arg_str);
+      tmp_opts->destfiles[i] = (char *)malloc(sizeof(char)*(length+1));
+      strncpy(tmp_opts->destfiles[i],cur_arg_str,length+1);
+    }
+   
+    return(tmp_opts);
+}
+
+
+static void usage(int argc, char** argv)
+{
+    fprintf(stderr,"Usage: %s [-v] key filename(s)\n",argv[0]);
+    fprintf(stderr,"    -v - print program version and terminate.\n");
+    return;
+}
+int check_perm(char c) {
+    switch (c) {
+      case '0': return 0;
+      case '1': return 1;
+      case '2': return 2;
+      case '3': return 3;
+      case '4': return 4;
+      case '5': return 5;
+      case '6': return 6;
+      case '7': return 7;
+      default: return -1;
+   }
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
+

--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ get-eattr.c	2005-08-10 15:38:12.000000000 -0400
@@ -0,0 +1,312 @@
+/*
+ * (C) 2004 Clemson University and The University of Chicago
+ * 
+ * See COPYING in top-level directory.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdlib.h>
+
+#include "pvfs2.h"
+#include "str-utils.h"
+#include "pint-sysint-utils.h"
+
+#ifndef PVFS2_VERSION
+#define PVFS2_VERSION "Unknown"
+#endif
+
+#define VALBUFSZ 1024
+
+/* optional parameters, filled in by parse_args() */
+struct options
+{
+    int nkey;
+    PVFS_ds_keyval *key;
+    PVFS_ds_keyval *val;
+    int target_count;
+    char** destfiles;
+};
+
+static struct options* parse_args(int argc, char* argv[]);
+int pvfs2_geteattr (int nkey, PVFS_ds_keyval *key_p,
+        PVFS_ds_keyval *val_p, char *destfile);
+static void usage(int argc, char** argv);
+int check_perm(char c);
+
+int main(int argc, char **argv)
+{
+  int ret = 0;
+  struct options* user_opts = NULL;
+  int i, k;
+
+  /* look at command line arguments */
+  user_opts = parse_args(argc, argv);
+  if(!user_opts)
+  {
+    fprintf(stderr, "Error: failed to parse "
+            "command line arguments.\n");
+    return(-1);
+  }
+
+  ret = PVFS_util_init_defaults();
+  if(ret < 0)
+  {
+    PVFS_perror("PVFS_util_init_defaults", ret);
+    return(-1);
+  }
+
+  /*
+   * for each file the user specified
+   * for each file the user specified
+   */
+  for (i = 0; i < user_opts->target_count; i++) {
+    ret = pvfs2_geteattr(user_opts->nkey, user_opts->key, user_opts->val,
+            user_opts->destfiles[i]);
+    if (ret != 0) {
+        printf("geteattr returned error code - exiting\n");
+        break;
+    }
+    for (k = 0; k < user_opts->nkey; k++) {
+        printf("key[%d]:%s Value:\n%s\n",k,
+                (char *)user_opts->key[k].buffer,
+                (char *)user_opts->val[k].buffer);
+    }
+    /* TODO: need to free the request descriptions */
+  }
+  PVFS_sys_finalize();
+  return(ret);
+}
+
+/* pvfs2_geteattr()
+ *
+ * changes the mode of the given file to the given permissions
+ *
+ * returns zero on success and negative one on failure
+ */
+int pvfs2_geteattr(int nkey, PVFS_ds_keyval *key_p,
+        PVFS_ds_keyval *val_p, char *destfile) {
+  int ret = -1;
+  char str_buf[PVFS_NAME_MAX] = {0};
+  char pvfs_path[PVFS_NAME_MAX] = {0};
+  PVFS_fs_id cur_fs;
+  PVFS_sysresp_lookup resp_lookup;
+  PVFS_sysresp_geteattr resp_geteattr;
+  PVFS_object_ref parent_ref;
+  PVFS_credentials credentials;
+  /* translate local path into pvfs2 relative path */
+  ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
+  if(ret < 0)
+  {
+    PVFS_perror("PVFS_util_resolve", ret);
+    return -1;
+  }
+
+  PVFS_util_gen_credentials(&credentials);
+
+  /* this if-else statement just pulls apart the pathname into its
+   * parts....I think...this should be a function somewhere
+   */
+  if (strcmp(pvfs_path,"/") == 0)
+  {
+    memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
+    ret = PVFS_sys_lookup(cur_fs, pvfs_path,
+                          &credentials, &resp_lookup,
+                          PVFS2_LOOKUP_LINK_FOLLOW);
+    if (ret < 0)
+    {
+      PVFS_perror("PVFS_sys_lookup", ret);
+      return -1;
+    }
+    parent_ref.handle = resp_lookup.ref.handle;
+    parent_ref.fs_id = resp_lookup.ref.fs_id;
+  }
+  else
+  {
+    /* get the absolute path on the pvfs2 file system */
+    if (PINT_remove_base_dir(pvfs_path,str_buf,PVFS_NAME_MAX))
+    {
+      if (pvfs_path[0] != '/')
+      {
+        fprintf(stderr, "Error: poorly formatted path.\n");
+      }
+      fprintf(stderr, "Error: cannot retrieve entry name for "
+              "creation on %s\n",pvfs_path);
+      return -1;
+    }
+
+    ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials, 
+                                  &parent_ref.handle);
+    if(ret < 0)
+    {
+      PVFS_perror("PINT_lookup_parent", ret);
+      return -1;
+    }
+    else
+    {
+      parent_ref.fs_id = cur_fs;
+    }
+  }
+  memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
+
+  ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
+                            parent_ref, &credentials, &resp_lookup,
+                            PVFS2_LOOKUP_LINK_NO_FOLLOW);
+  if (ret != 0)
+  {
+    fprintf(stderr, "Target '%s' does not exist!\n", str_buf);
+    return -1;
+  }
+
+  /* get extended attribute */
+  resp_geteattr.val_array = val_p;
+  ret = PVFS_sys_geteattr_list(resp_lookup.ref,
+          &credentials, nkey, key_p, &resp_geteattr);
+  if (ret < 0)
+  {
+      PVFS_perror("PVFS_sys_geteattr failed with errcode", ret);
+      return(-1);
+  }
+
+  return 0;
+}
+
+
+/* parse_args()
+ *
+ * parses command line arguments
+ *
+ * returns pointer to options structure on success, NULL on failure
+ */
+static struct options* parse_args(int argc, char* argv[])
+{
+    /* getopt stuff */
+    extern char* optarg;
+    extern int optind, opterr, optopt;
+    char flags[] = "v";
+    int one_opt = 0;
+    int i, k;
+    char *cptr;
+
+    struct options* tmp_opts = NULL;
+
+    /* create storage for the command line options */
+    tmp_opts = (struct options*)malloc(sizeof(struct options));
+    if(!tmp_opts){
+	return(NULL);
+    }
+    memset(tmp_opts, 0, sizeof(struct options));
+
+    /* fill in defaults */
+    tmp_opts->key = NULL;
+    tmp_opts->val = NULL;
+    tmp_opts->nkey = 0;
+    tmp_opts->target_count = 0;
+    tmp_opts->destfiles = NULL;
+
+    if (argc < 3) {
+      usage(argc,argv);
+      exit(0);
+    } 
+
+    /* look at command line arguments */
+    while((one_opt = getopt(argc, argv, flags)) != EOF)
+    {
+	switch(one_opt){
+            case('v'):
+                printf("%s\n", PVFS2_VERSION);
+                exit(0);
+	    case('?'):
+                printf("?\n");
+		usage(argc, argv);
+		exit(EXIT_FAILURE);
+	}
+    }
+    /* parse keys from argv[optind] */
+    /* first count the keys */
+    /* since argv[optind] exists, there must be at least one */
+    tmp_opts->nkey = 0;
+    cptr = argv[optind];
+    while(cptr)
+    {
+        /* must be something after a comma */
+        if ((tmp_opts->nkey == 0 && *cptr != ',') || *(cptr+1) != '\0')
+            tmp_opts->nkey++;
+        else
+        {
+            usage(argc,argv);
+            exit(EXIT_FAILURE);
+        }
+        /* a comma separates and indicates another key */
+        cptr++;
+        cptr = strchr(cptr, ',');
+    }
+    /* now malloc space for the keys and values */
+    tmp_opts->key = (PVFS_ds_keyval *)
+            malloc(sizeof(PVFS_ds_keyval) * tmp_opts->nkey);
+    tmp_opts->val = (PVFS_ds_keyval *)
+            malloc(sizeof(PVFS_ds_keyval) * tmp_opts->nkey);
+    /* now re-run the list to set up the key strings */
+    cptr = argv[optind];
+    for (k = 0; k < tmp_opts->nkey; k++)
+    {
+        if (k > 0)
+        {
+            /* zero out the comma */
+            *cptr = '\0';
+            /* point to the first char of the next key */
+            cptr++;
+        }
+        tmp_opts->key[k].buffer = cptr;
+        cptr = strchr(cptr, ',');
+    }
+    /* now re-run the list and copy them in */
+    for (k = 0; k < tmp_opts->nkey; k++)
+    {
+        cptr = tmp_opts->key[k].buffer;
+        tmp_opts->key[k].buffer_sz = strlen(cptr) + 1;
+        tmp_opts->key[k].buffer =
+            (char *)malloc(sizeof(char)*tmp_opts->key[k].buffer_sz);
+        strncpy(tmp_opts->key[k].buffer, cptr,
+                tmp_opts->key[k].buffer_sz);
+        tmp_opts->val[k].buffer_sz = VALBUFSZ;
+        tmp_opts->val[k].buffer = malloc(VALBUFSZ);
+    }
+
+    /* finished up argument processing */
+    optind = optind + 1;
+    tmp_opts->target_count = argc-optind;
+    tmp_opts->destfiles=(char **)malloc(sizeof(char *)*(tmp_opts->target_count));
+    for (i = 0; i < tmp_opts->target_count; i++) {
+      char *cur_arg_str = argv[optind+i];
+      int length = strlen(cur_arg_str);
+      tmp_opts->destfiles[i] = (char *)malloc(sizeof(char)*(length+1));
+      strncpy(tmp_opts->destfiles[i],cur_arg_str,length+1);
+    }
+   
+    return(tmp_opts);
+}
+
+
+static void usage(int argc, char** argv)
+{
+    fprintf(stderr,"Usage: %s [-v] key[,key] filename(s)\n",argv[0]);
+    fprintf(stderr,"    -v - print program version and terminate.\n");
+    return;
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
+

--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ set-eattr.c	2005-08-10 15:38:12.000000000 -0400
@@ -0,0 +1,339 @@
+/*
+ * (C) 2004 Clemson University and The University of Chicago
+ * 
+ * See COPYING in top-level directory.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdlib.h>
+
+#include "pvfs2.h"
+#include "str-utils.h"
+#include "pint-sysint-utils.h"
+
+#ifndef PVFS2_VERSION
+#define PVFS2_VERSION "Unknown"
+#endif
+
+/* optional parameters, filled in by parse_args() */
+struct options
+{
+    int nkey;
+    PVFS_ds_keyval *key;
+    PVFS_ds_keyval *val;
+    int target_count;
+    char** destfiles;
+};
+
+static struct options* parse_args(int argc, char* argv[]);
+int pvfs2_seteattr (int nkey, PVFS_ds_keyval *key, PVFS_ds_keyval *val,
+        char *destfile);
+static void usage(int argc, char** argv);
+int check_perm(char c);
+
+int main(int argc, char **argv)
+{
+  int ret = 0;
+  struct options* user_opts = NULL;
+  int i;
+
+  /* look at command line arguments */
+  user_opts = parse_args(argc, argv);
+  if(!user_opts)
+  {
+    fprintf(stderr, "Error: failed to parse "
+            "command line arguments.\n");
+    return(-1);
+  }
+
+  ret = PVFS_util_init_defaults();
+  if(ret < 0)
+  {
+    PVFS_perror("PVFS_util_init_defaults", ret);
+    return(-1);
+  }
+
+  /*
+   * for each file the user specified
+   * for each file the user specified
+   */
+  for (i = 0; i < user_opts->target_count; i++) {
+    ret = pvfs2_seteattr(user_opts->nkey, user_opts->key, user_opts->val,
+            user_opts->destfiles[i]);
+    if (ret != 0) {
+      PVFS_perror("pvfs2_seteattr", ret);
+      break;
+    }
+    /* TODO: need to free the request descriptions */
+  }
+  PVFS_sys_finalize();
+  return(ret);
+}
+
+/* pvfs2_seteattr()
+ *
+ * changes the mode of the given file to the given permissions
+ *
+ * returns zero on success and negative one on failure
+ */
+int pvfs2_seteattr (int nkey, PVFS_ds_keyval *key, PVFS_ds_keyval *val,
+        char *destfile) {
+  int ret = -1;
+  char str_buf[PVFS_NAME_MAX] = {0};
+  char pvfs_path[PVFS_NAME_MAX] = {0};
+  PVFS_fs_id cur_fs;
+  PVFS_sysresp_lookup resp_lookup;
+  PVFS_object_ref parent_ref;
+  PVFS_credentials credentials;
+  /* translate local path into pvfs2 relative path */
+  ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
+  if(ret < 0)
+  {
+    PVFS_perror("PVFS_util_resolve", ret);
+    return -1;
+  }
+
+  PVFS_util_gen_credentials(&credentials);
+
+  /* this if-else statement just pulls apart the pathname into its
+   * parts....I think...this should be a function somewhere
+   */
+  if (strcmp(pvfs_path,"/") == 0)
+  {
+    memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
+    ret = PVFS_sys_lookup(cur_fs, pvfs_path,
+                          &credentials, &resp_lookup,
+                          PVFS2_LOOKUP_LINK_FOLLOW);
+    if (ret < 0)
+    {
+      PVFS_perror("PVFS_sys_lookup", ret);
+      return -1;
+    }
+    parent_ref.handle = resp_lookup.ref.handle;
+    parent_ref.fs_id = resp_lookup.ref.fs_id;
+  }
+  else
+  {
+    /* get the absolute path on the pvfs2 file system */
+    if (PINT_remove_base_dir(pvfs_path,str_buf,PVFS_NAME_MAX))
+    {
+      if (pvfs_path[0] != '/')
+      {
+        fprintf(stderr, "Error: poorly formatted path.\n");
+      }
+      fprintf(stderr, "Error: cannot retrieve entry name for "
+              "creation on %s\n",pvfs_path);
+      return -1;
+    }
+
+    ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials, 
+                                  &parent_ref.handle);
+    if(ret < 0)
+    {
+      PVFS_perror("PINT_lookup_parent", ret);
+      return -1;
+    }
+    else
+    {
+      parent_ref.fs_id = cur_fs;
+    }
+  }
+  memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
+
+  ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
+                            parent_ref, &credentials, &resp_lookup,
+                            PVFS2_LOOKUP_LINK_NO_FOLLOW);
+  if (ret != 0)
+  {
+    fprintf(stderr, "Target '%s' does not exist!\n", str_buf);
+    return -1;
+  }
+
+  /* set extended attribute */
+  { int k;
+      printf("nkey = %d\n",nkey);
+      for(k=0; k<nkey; k++)
+      {
+          printf("key = %s val = %s\n", (char *)key[k].buffer,
+                  (char *)val[k].buffer);
+      }
+  }
+  ret = PVFS_sys_seteattr_list(resp_lookup.ref, &credentials, nkey, key, val, 0);
+  if (ret < 0)
+  {
+      PVFS_perror("seteattr_list failed with errcode", ret);
+      return(-1);
+  }
+
+  return 0;
+}
+
+
+/* parse_args()
+ *
+ * parses command line arguments
+ *
+ * returns pointer to options structure on success, NULL on failure
+ */
+static struct options* parse_args(int argc, char* argv[])
+{
+    /* getopt stuff */
+    extern char* optarg;
+    extern int optind, opterr, optopt;
+    char flags[] = "v";
+    int one_opt = 0;
+    int i, k;
+    char *cptr, *cptr2;
+
+    struct options* tmp_opts = NULL;
+
+    /* create storage for the command line options */
+    tmp_opts = (struct options*)malloc(sizeof(struct options));
+    if(!tmp_opts){
+	return(NULL);
+    }
+    memset(tmp_opts, 0, sizeof(struct options));
+
+    /* fill in defaults */
+    tmp_opts->nkey = 0;
+    tmp_opts->key = NULL;
+    tmp_opts->val = NULL;
+    tmp_opts->target_count = 0;
+    tmp_opts->destfiles = NULL;
+
+    if (argc < 3) {
+      usage(argc,argv);
+      exit(0);
+    } 
+
+    /* look at command line arguments */
+    while((one_opt = getopt(argc, argv, flags)) != EOF)
+    {
+	switch(one_opt){
+            case('v'):
+                printf("%s\n", PVFS2_VERSION);
+                exit(0);
+	    case('?'):
+                printf("?\n");
+		usage(argc, argv);
+		exit(EXIT_FAILURE);
+	}
+    }
+    /* parse key and value from argv[optind] */
+    /* first count the keys */
+    /* since argv[optind] exists, there must be at least one */
+    tmp_opts->nkey = 0;
+    cptr = argv[optind];
+    while(cptr)
+    {
+        /* must be something after a comma */
+        if ((tmp_opts->nkey == 0 && *cptr != ',') || *(cptr+1) != '\0')
+            tmp_opts->nkey++;
+        else
+        {
+            usage(argc,argv);
+            exit(EXIT_FAILURE);
+        }
+        /* a comma separates and indicates another key */
+        cptr++;
+        cptr = strchr(cptr, ',');
+    }
+    /* now malloc space for the keys and values */
+    tmp_opts->key = (PVFS_ds_keyval *)
+            malloc(sizeof(PVFS_ds_keyval) * tmp_opts->nkey);
+    tmp_opts->val = (PVFS_ds_keyval *)
+            malloc(sizeof(PVFS_ds_keyval) * tmp_opts->nkey);
+    /* now re-run the list to set up the key strings */
+    cptr = argv[optind];
+    for (k = 0; k < tmp_opts->nkey; k++)
+    {
+        if (k > 0)
+        {
+            /* zero out the comma */
+            *cptr = '\0';
+            /* point to the first char of the next key */
+            cptr++;
+        }
+        tmp_opts->key[k].buffer = cptr;
+        cptr = strchr(cptr, ',');
+    }
+    /* now re-run the list and copy them in */
+    for (k = 0; k < tmp_opts->nkey; k++)
+    {
+        cptr = tmp_opts->key[k].buffer;
+        cptr2 = strchr(cptr, ':');
+        if (cptr2)
+        {
+            *cptr2 = '\0';
+            cptr2++;
+            tmp_opts->val[k].buffer_sz = strlen(cptr2) + 1;
+            tmp_opts->val[k].buffer =
+                (char *)malloc(sizeof(char)*tmp_opts->val[k].buffer_sz);
+            strncpy(tmp_opts->val[k].buffer, cptr2,
+                    tmp_opts->val[k].buffer_sz);
+        }
+        else
+        {
+            /* colon not found */
+	    usage(argc, argv);
+	    exit(EXIT_FAILURE);
+        }
+        tmp_opts->key[k].buffer_sz = strlen(cptr) + 1;
+        tmp_opts->key[k].buffer =
+            (char *)malloc(sizeof(char)*tmp_opts->key[k].buffer_sz);
+        strncpy(tmp_opts->key[k].buffer, cptr,
+                tmp_opts->key[k].buffer_sz);
+    }
+
+    /* finished up argument processing */
+    optind = optind + 1;
+    tmp_opts->target_count = argc-optind;
+    tmp_opts->destfiles=(char **)malloc(sizeof(char *)*(tmp_opts->target_count));
+    for (i = 0; i < tmp_opts->target_count; i++) {
+      char *cur_arg_str = argv[optind+i];
+      int length = strlen(cur_arg_str);
+      tmp_opts->destfiles[i] = (char *)malloc(sizeof(char)*(length+1));
+      strncpy(tmp_opts->destfiles[i],cur_arg_str,length+1);
+    }
+   
+    return(tmp_opts);
+}
+
+
+static void usage(int argc, char** argv)
+{
+    fprintf(stderr,"Usage: %s [-v] key:value[,key:value] filename(s)\n",argv[0]);
+    fprintf(stderr,"    -v - print program version and terminate.\n");
+    return;
+}
+
+int check_perm(char c) {
+    switch (c) {
+      case '0': return 0;
+      case '1': return 1;
+      case '2': return 2;
+      case '3': return 3;
+      case '4': return 4;
+      case '5': return 5;
+      case '6': return 6;
+      case '7': return 7;
+      default: return -1;
+   }
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
+

Index: create.set.get.eattr.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/create.set.get.eattr.c,v
diff -p -u -r1.1 -r1.1.4.1
--- create.set.get.eattr.c	16 Jun 2005 23:46:35 -0000	1.1
+++ create.set.get.eattr.c	10 Aug 2005 19:38:11 -0000	1.1.4.1
@@ -26,7 +26,6 @@ int main(int argc, char **argv)
     char *val_s = (char *)0;
     PVFS_fs_id cur_fs;
     PVFS_sysresp_create resp_create;
-    PVFS_sysresp_geteattr resp_geteattr;
     char* entry_name;
     PVFS_object_ref parent_refn;
     PVFS_sys_attr attr;
@@ -106,7 +105,7 @@ int main(int argc, char **argv)
 	 key.buffer_sz = strlen(key_s) + 1;
 	 val.buffer = val_s;
 	 val.buffer_sz = strlen(val_s) + 1;
-	 ret = PVFS_sys_seteattr(resp_create.ref, &credentials, &key, &val);
+	 ret = PVFS_sys_seteattr(resp_create.ref, &credentials, &key, &val, 0);
     if (ret < 0)
     {
         PVFS_perror("seteattr failed with errcode", ret);
@@ -118,24 +117,23 @@ int main(int argc, char **argv)
 
 	 // get extended attribute
 	 printf("--geteattr--\n");
-	 resp_geteattr.val.buffer_sz = strlen(val_s) + 10;
-	 resp_geteattr.val.buffer = malloc(val.buffer_sz);
-	 ret = PVFS_sys_geteattr(resp_create.ref, &credentials, &key,
-			 &resp_geteattr);
+	 val.buffer_sz = strlen(val_s) + 10;
+	 val.buffer = malloc(val.buffer_sz);
+	 ret = PVFS_sys_geteattr(resp_create.ref, &credentials, &key, &val);
     if (ret < 0)
     {
         PVFS_perror("geteattr failed with errcode", ret);
     }
 
 	 // safety valve!
-	 ((char *)resp_geteattr.val.buffer)[resp_geteattr.val.buffer_sz-1] = 0;
+	 ((char *)val.buffer)[val.buffer_sz-1] = 0;
 
 	 // print result if we got any
-    printf("Returned %d bytes in value: %s\n", resp_geteattr.val.read_sz,
-		  (char *)resp_geteattr.val.buffer);
+    printf("Returned %d bytes in value: %s\n", val.read_sz,
+		  (char *)val.buffer);
 
-	 if (!strncmp(resp_geteattr.val.buffer, key_s, resp_geteattr.val.read_sz) &&
-              resp_geteattr.val.read_sz == strlen(key_s))
+	 if (!strncmp(val.buffer, key_s, val.read_sz) &&
+              val.read_sz == strlen(key_s))
 			 printf("Success!\n");
 	 else
 			 printf("Failure!\n");

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/module.mk.in,v
diff -p -u -r1.45 -r1.45.14.1
--- module.mk.in	18 Oct 2004 20:56:41 -0000	1.45
+++ module.mk.in	10 Aug 2005 19:38:11 -0000	1.45.14.1
@@ -30,5 +30,9 @@ TESTSRC += \
 	$(DIR)/getparent.c \
 	$(DIR)/io-bug.c \
 	$(DIR)/test-create-scale.c \
-	$(DIR)/io-hole.c
+	$(DIR)/io-hole.c \
+	$(DIR)/create.set.get.eattr.c \
+	$(DIR)/set-eattr.c \
+	$(DIR)/get-eattr.c \
+	$(DIR)/del-eattr.c
 

--- get.eattr.c	2005-08-10 15:38:12.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,260 +0,0 @@
-/*
- * (C) 2004 Clemson University and The University of Chicago
- * 
- * See COPYING in top-level directory.
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <time.h>
-#include <stdlib.h>
-
-#include "pvfs2.h"
-#include "str-utils.h"
-#include "pint-sysint-utils.h"
-
-#ifndef PVFS2_VERSION
-#define PVFS2_VERSION "Unknown"
-#endif
-
-/* optional parameters, filled in by parse_args() */
-struct options
-{
-    PVFS_ds_keyval key;
-    PVFS_ds_keyval val;
-    int target_count;
-    char** destfiles;
-};
-
-static struct options* parse_args(int argc, char* argv[]);
-int pvfs2_seteattr (PVFS_ds_keyval key, PVFS_ds_keyval val, char *destfile);
-static void usage(int argc, char** argv);
-int check_perm(char c);
-
-int main(int argc, char **argv)
-{
-  int ret = 0;
-  struct options* user_opts = NULL;
-  int i;
-
-  /* look at command line arguments */
-  user_opts = parse_args(argc, argv);
-  if(!user_opts)
-  {
-    fprintf(stderr, "Error: failed to parse "
-            "command line arguments.\n");
-    return(-1);
-  }
-
-  ret = PVFS_util_init_defaults();
-  if(ret < 0)
-  {
-    PVFS_perror("PVFS_util_init_defaults", ret);
-    return(-1);
-  }
-
-  /*
-   * for each file the user specified
-   * for each file the user specified
-   */
-  for (i = 0; i < user_opts->target_count; i++) {
-    ret = pvfs2_geteattr(user_opts->key, &user_opts->val,
-            user_opts->destfiles[i]);
-    if (ret != 0) {
-      break;
-
-    printf("%s\n",user_opts->val.buffer);
-    }
-    /* TODO: need to free the request descriptions */
-  }
-  PVFS_sys_finalize();
-  return(ret);
-}
-
-/* pvfs2_seteattr()
- *
- * changes the mode of the given file to the given permissions
- *
- * returns zero on success and negative one on failure
- */
-int pvfs2_geteattr (PVFS_ds_keyval key, PVFS_ds_keyval *val, char *destfile) {
-  int ret = -1;
-  char str_buf[PVFS_NAME_MAX] = {0};
-  char pvfs_path[PVFS_NAME_MAX] = {0};
-  PVFS_fs_id cur_fs;
-  PVFS_sysresp_lookup resp_lookup;
-  PVFS_sysresp_geteattr resp_geteattr;
-  PVFS_object_ref parent_ref;
-  PVFS_credentials credentials;
-  /* translate local path into pvfs2 relative path */
-  ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
-  if(ret < 0)
-  {
-    PVFS_perror("PVFS_util_resolve", ret);
-    return -1;
-  }
-
-  PVFS_util_gen_credentials(&credentials);
-
-  /* this if-else statement just pulls apart the pathname into its
-   * parts....I think...this should be a function somewhere
-   */
-  if (strcmp(pvfs_path,"/") == 0)
-  {
-    memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
-    ret = PVFS_sys_lookup(cur_fs, pvfs_path,
-                          &credentials, &resp_lookup,
-                          PVFS2_LOOKUP_LINK_FOLLOW);
-    if (ret < 0)
-    {
-      PVFS_perror("PVFS_sys_lookup", ret);
-      return -1;
-    }
-    parent_ref.handle = resp_lookup.ref.handle;
-    parent_ref.fs_id = resp_lookup.ref.fs_id;
-  }
-  else
-  {
-    /* get the absolute path on the pvfs2 file system */
-    if (PINT_remove_base_dir(pvfs_path,str_buf,PVFS_NAME_MAX))
-    {
-      if (pvfs_path[0] != '/')
-      {
-        fprintf(stderr, "Error: poorly formatted path.\n");
-      }
-      fprintf(stderr, "Error: cannot retrieve entry name for "
-              "creation on %s\n",pvfs_path);
-      return -1;
-    }
-
-    ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials, 
-                                  &parent_ref.handle);
-    if(ret < 0)
-    {
-      PVFS_perror("PINT_lookup_parent", ret);
-      return -1;
-    }
-    else
-    {
-      parent_ref.fs_id = cur_fs;
-    }
-  }
-  memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
-
-  ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
-                            parent_ref, &credentials, &resp_lookup,
-                            PVFS2_LOOKUP_LINK_NO_FOLLOW);
-  if (ret != 0)
-  {
-    fprintf(stderr, "Target '%s' does not exist!\n", str_buf);
-    return -1;
-  }
-
-  /* get extended attribute */
-  resp_geteattr.val.buffer = val->buffer;
-  resp_geteattr.val.buffer_sz = val->buffer_sz;
-  ret = PVFS_sys_geteattr(resp_lookup.ref,
-          &credentials, &key, &resp_geteattr);
-  if (ret < 0)
-  {
-      PVFS_perror("seteattr failed with errcode", ret);
-      return(-1);
-  }
-  val->read_sz = resp_geteattr.val.read_sz;
-
-  return 0;
-}
-
-
-/* parse_args()
- *
- * parses command line arguments
- *
- * returns pointer to options structure on success, NULL on failure
- */
-static struct options* parse_args(int argc, char* argv[])
-{
-    /* getopt stuff */
-    extern char* optarg;
-    extern int optind, opterr, optopt;
-    char flags[] = "v";
-    int one_opt = 0;
-    int i;
-
-    struct options* tmp_opts = NULL;
-
-    /* create storage for the command line options */
-    tmp_opts = (struct options*)malloc(sizeof(struct options));
-    if(!tmp_opts){
-	return(NULL);
-    }
-    memset(tmp_opts, 0, sizeof(struct options));
-
-    /* fill in defaults */
-    tmp_opts->key.buffer = NULL;
-    tmp_opts->key.buffer_sz = 0;
-    tmp_opts->val.buffer = NULL;
-    tmp_opts->val.buffer_sz = 0;
-    tmp_opts->target_count = 0;
-    tmp_opts->destfiles = NULL;
-
-    if (argc < 3) {
-      usage(argc,argv);
-      exit(0);
-    } 
-
-    /* look at command line arguments */
-    while((one_opt = getopt(argc, argv, flags)) != EOF)
-    {
-	switch(one_opt){
-            case('v'):
-                printf("%s\n", PVFS2_VERSION);
-                exit(0);
-	    case('?'):
-                printf("?\n");
-		usage(argc, argv);
-		exit(EXIT_FAILURE);
-	}
-    }
-    /* parse key and value from argv[optind] */
-    tmp_opts->key.buffer = argv[optind];
-    tmp_opts->key.buffer_sz = strlen(argv[optind]);
-    tmp_opts->val.buffer = malloc(VALBUFSZ);
-    tmp_opts->val.buffer_sz = VALBUFSZ;
-
-    /* finished up argument processing */
-    optind = optind + 1;
-    tmp_opts->target_count = argc-optind;
-    tmp_opts->destfiles=(char **)malloc(sizeof(char *)*(tmp_opts->target_count));
-    for (i = 0; i < tmp_opts->target_count; i++) {
-      char *cur_arg_str = argv[optind+i];
-      int length = strlen(cur_arg_str);
-      tmp_opts->destfiles[i] = (char *)malloc(sizeof(char)*(length+1));
-      strncpy(tmp_opts->destfiles[i],cur_arg_str,length+1);
-    }
-   
-    return(tmp_opts);
-}
-
-
-static void usage(int argc, char** argv)
-{
-    fprintf(stderr,"Usage: %s [-v] key filename(s)\n",argv[0]);
-    fprintf(stderr,"    -v - print program version and terminate.\n");
-    return;
-}
-
-/*
- * Local variables:
- *  c-indent-level: 4
- *  c-basic-offset: 4
- * End:
- *
- * vim: ts=8 sts=4 sw=4 expandtab
- */
-

--- set.eattr.c	2005-08-10 15:38:12.000000000 -0400
+++ /dev/null	2003-01-30 05:24:37.000000000 -0500
@@ -1,279 +0,0 @@
-/*
- * (C) 2004 Clemson University and The University of Chicago
- * 
- * See COPYING in top-level directory.
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <time.h>
-#include <stdlib.h>
-
-#include "pvfs2.h"
-#include "str-utils.h"
-#include "pint-sysint-utils.h"
-
-#ifndef PVFS2_VERSION
-#define PVFS2_VERSION "Unknown"
-#endif
-
-/* optional parameters, filled in by parse_args() */
-struct options
-{
-    PVFS_ds_keyval key;
-    PVFS_ds_keyval val;
-    int target_count;
-    char** destfiles;
-};
-
-static struct options* parse_args(int argc, char* argv[]);
-int pvfs2_seteattr (PVFS_ds_keyval key, PVFS_ds_keyval val, char *destfile);
-static void usage(int argc, char** argv);
-int check_perm(char c);
-
-int main(int argc, char **argv)
-{
-  int ret = 0;
-  struct options* user_opts = NULL;
-  int i;
-
-  /* look at command line arguments */
-  user_opts = parse_args(argc, argv);
-  if(!user_opts)
-  {
-    fprintf(stderr, "Error: failed to parse "
-            "command line arguments.\n");
-    return(-1);
-  }
-
-  ret = PVFS_util_init_defaults();
-  if(ret < 0)
-  {
-    PVFS_perror("PVFS_util_init_defaults", ret);
-    return(-1);
-  }
-
-  /*
-   * for each file the user specified
-   * for each file the user specified
-   */
-  for (i = 0; i < user_opts->target_count; i++) {
-    ret = pvfs2_seteattr(user_opts->key,user_opts->val,user_opts->destfiles[i]);
-    if (ret != 0) {
-      break;
-    }
-    /* TODO: need to free the request descriptions */
-  }
-  PVFS_sys_finalize();
-  return(ret);
-}
-
-/* pvfs2_seteattr()
- *
- * changes the mode of the given file to the given permissions
- *
- * returns zero on success and negative one on failure
- */
-int pvfs2_seteattr (PVFS_ds_keyval key, PVFS_ds_keyval val, char *destfile) {
-  int ret = -1;
-  char str_buf[PVFS_NAME_MAX] = {0};
-  char pvfs_path[PVFS_NAME_MAX] = {0};
-  PVFS_fs_id cur_fs;
-  PVFS_sysresp_lookup resp_lookup;
-  PVFS_object_ref parent_ref;
-  PVFS_credentials credentials;
-  /* translate local path into pvfs2 relative path */
-  ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
-  if(ret < 0)
-  {
-    PVFS_perror("PVFS_util_resolve", ret);
-    return -1;
-  }
-
-  PVFS_util_gen_credentials(&credentials);
-
-  /* this if-else statement just pulls apart the pathname into its
-   * parts....I think...this should be a function somewhere
-   */
-  if (strcmp(pvfs_path,"/") == 0)
-  {
-    memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
-    ret = PVFS_sys_lookup(cur_fs, pvfs_path,
-                          &credentials, &resp_lookup,
-                          PVFS2_LOOKUP_LINK_FOLLOW);
-    if (ret < 0)
-    {
-      PVFS_perror("PVFS_sys_lookup", ret);
-      return -1;
-    }
-    parent_ref.handle = resp_lookup.ref.handle;
-    parent_ref.fs_id = resp_lookup.ref.fs_id;
-  }
-  else
-  {
-    /* get the absolute path on the pvfs2 file system */
-    if (PINT_remove_base_dir(pvfs_path,str_buf,PVFS_NAME_MAX))
-    {
-      if (pvfs_path[0] != '/')
-      {
-        fprintf(stderr, "Error: poorly formatted path.\n");
-      }
-      fprintf(stderr, "Error: cannot retrieve entry name for "
-              "creation on %s\n",pvfs_path);
-      return -1;
-    }
-
-    ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials, 
-                                  &parent_ref.handle);
-    if(ret < 0)
-    {
-      PVFS_perror("PINT_lookup_parent", ret);
-      return -1;
-    }
-    else
-    {
-      parent_ref.fs_id = cur_fs;
-    }
-  }
-  memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
-
-  ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
-                            parent_ref, &credentials, &resp_lookup,
-                            PVFS2_LOOKUP_LINK_NO_FOLLOW);
-  if (ret != 0)
-  {
-    fprintf(stderr, "Target '%s' does not exist!\n", str_buf);
-    return -1;
-  }
-
-  /* set extended attribute */
-  ret = PVFS_sys_seteattr(resp_lookup.ref, &credentials, &key, &val);
-  if (ret < 0)
-  {
-      PVFS_perror("seteattr failed with errcode", ret);
-      return(-1);
-  }
-
-  return 0;
-}
-
-
-/* parse_args()
- *
- * parses command line arguments
- *
- * returns pointer to options structure on success, NULL on failure
- */
-static struct options* parse_args(int argc, char* argv[])
-{
-    /* getopt stuff */
-    extern char* optarg;
-    extern int optind, opterr, optopt;
-    char flags[] = "v";
-    int one_opt = 0;
-    int i;
-
-    struct options* tmp_opts = NULL;
-
-    /* create storage for the command line options */
-    tmp_opts = (struct options*)malloc(sizeof(struct options));
-    if(!tmp_opts){
-	return(NULL);
-    }
-    memset(tmp_opts, 0, sizeof(struct options));
-
-    /* fill in defaults */
-    tmp_opts->key.buffer = NULL;
-    tmp_opts->key.buffer_sz = 0;
-    tmp_opts->val.buffer = NULL;
-    tmp_opts->val.buffer_sz = 0;
-    tmp_opts->target_count = 0;
-    tmp_opts->destfiles = NULL;
-
-    if (argc < 3) {
-      usage(argc,argv);
-      exit(0);
-    } 
-
-    /* look at command line arguments */
-    while((one_opt = getopt(argc, argv, flags)) != EOF)
-    {
-	switch(one_opt){
-            case('v'):
-                printf("%s\n", PVFS2_VERSION);
-                exit(0);
-	    case('?'):
-                printf("?\n");
-		usage(argc, argv);
-		exit(EXIT_FAILURE);
-	}
-    }
-    /* parse key and value from argv[optind] */
-    tmp_opts->key.buffer = argv[optind];
-    tmp_opts->val.buffer = strchr(argv[optind], ':');
-    if (!tmp_opts->val.buffer)
-    {
-        /* colon not found */
-	usage(argc, argv);
-	exit(EXIT_FAILURE);
-    }
-    else
-    {
-        *((char *)tmp_opts->val.buffer) = '\0';
-        ((char *)tmp_opts->val.buffer)++;
-        tmp_opts->key.buffer_sz =
-            ((char *)tmp_opts->val.buffer) -
-            ((char *)tmp_opts->key.buffer);
-        tmp_opts->val.buffer_sz =
-            strlen(((char *)tmp_opts->val.buffer)) + 1;
-    }
-
-    /* finished up argument processing */
-    optind = optind + 1;
-    tmp_opts->target_count = argc-optind;
-    tmp_opts->destfiles=(char **)malloc(sizeof(char *)*(tmp_opts->target_count));
-    for (i = 0; i < tmp_opts->target_count; i++) {
-      char *cur_arg_str = argv[optind+i];
-      int length = strlen(cur_arg_str);
-      tmp_opts->destfiles[i] = (char *)malloc(sizeof(char)*(length+1));
-      strncpy(tmp_opts->destfiles[i],cur_arg_str,length+1);
-    }
-   
-    return(tmp_opts);
-}
-
-
-static void usage(int argc, char** argv)
-{
-    fprintf(stderr,"Usage: %s [-v] key:value filename(s)\n",argv[0]);
-    fprintf(stderr,"    -v - print program version and terminate.\n");
-    return;
-}
-int check_perm(char c) {
-    switch (c) {
-      case '0': return 0;
-      case '1': return 1;
-      case '2': return 2;
-      case '3': return 3;
-      case '4': return 4;
-      case '5': return 5;
-      case '6': return 6;
-      case '7': return 7;
-      default: return -1;
-   }
-}
-
-/*
- * Local variables:
- *  c-indent-level: 4
- *  c-basic-offset: 4
- * End:
- *
- * vim: ts=8 sts=4 sw=4 expandtab
- */
-



More information about the PVFS2-CVS mailing list