OSSP CVS Repository

ossp - Difference in ossp-pkg/uuid/uuid_cli.c versions 1.5 and 1.6
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/uuid/uuid_cli.c 1.5 -> 1.6

--- uuid_cli.c   2004/01/09 16:11:40     1.5
+++ uuid_cli.c   2004/01/09 21:01:04     1.6
@@ -78,7 +78,7 @@
     int count;
     int i;
     int iterate;
-    int ascii;
+    int raw;
     int decode;
     char *cp;
     void *vp;
@@ -88,10 +88,10 @@
     count = -1;     /* no count yet */
     fp = stdout;    /* default output file */
     iterate = 0;    /* not one at a time */
-    ascii = 0;      /* default is binary output */
+    raw = 0;        /* default is ASCII output */
     decode = 0;     /* default is to encode */
     version = UUID_VERSION1;
-    while ((ch = getopt(argc, argv, "1n:ado:v:")) != -1) {
+    while ((ch = getopt(argc, argv, "1n:rdo:v:")) != -1) {
         switch (ch) {
             case '1':
                 iterate = 1;
@@ -103,8 +103,8 @@
                 if (*p != '\0' || count < 1)
                     usage("invalid argument to option 'n'");
                 break;
-            case 'a':
-                ascii = 1;
+            case 'r':
+                raw = 1;
                 break;
             case 'd':
                 decode = 1;
@@ -165,20 +165,20 @@
                 rc = uuid_generate(uuid, version);
             if (rc != UUID_RC_OK)
                 error(1, "uuid_generate: %s", uuid_error(rc));
-            if (ascii) {
+            if (raw) {
+                vp = NULL;
+                if ((rc = uuid_pack(uuid, &vp)) != UUID_RC_OK)
+                    error(1, "uuid_pack: %s", uuid_error(rc));
+                fwrite(vp, UUID_LEN_BIN, 1, fp);
+                free(vp);
+            }
+            else {
                 cp = NULL;
                 if ((rc = uuid_format(uuid, &cp)) != UUID_RC_OK)
-                    error(1, "uuid_unparse: %s", uuid_error(rc));
+                    error(1, "uuid_format: %s", uuid_error(rc));
                 fprintf(fp, "%s\n", cp);
                 free(cp);
             }
-            else {
-                vp = NULL;
-                if ((rc = uuid_pack(uuid, &vp)) != UUID_RC_OK)
-                    error(1, "uuid_unpack: %s", uuid_error(rc));
-                fwrite(vp, UUID_LEN_BIN, 1, vp);
-                free(vp);
-            }
         }
         if ((rc = uuid_destroy(uuid)) != UUID_RC_OK)
             error(1, "uuid_destroy: %s", uuid_error(rc));

CVSTrac 2.0.1