[maemo-commits] [maemo-commits] r16589 - projects/connectivity/osso-obc/trunk/src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Nov 6 13:16:05 EET 2008
Author: jh
Date: 2008-11-06 13:16:05 +0200 (Thu, 06 Nov 2008)
New Revision: 16589

Modified:
   projects/connectivity/osso-obc/trunk/src/put.c
Log:
Add support for specifying the type header in put commands

Modified: projects/connectivity/osso-obc/trunk/src/put.c
===================================================================
--- projects/connectivity/osso-obc/trunk/src/put.c	2008-11-06 11:12:54 UTC (rev 16588)
+++ projects/connectivity/osso-obc/trunk/src/put.c	2008-11-06 11:16:05 UTC (rev 16589)
@@ -127,7 +127,7 @@
 }
 
 static gboolean put_object(ObcContext *ctx, const char *name,
-                           gboolean is_dir, gint *err)
+                           const char *type, gboolean is_dir, gint *err)
 {
     gboolean ret;
 
@@ -183,7 +183,7 @@
                     continue;
             }
 
-            if (!put_object(ctx, ep->d_name, dir, err)) {
+            if (!put_object(ctx, ep->d_name, NULL, dir, err)) {
                 closedir(dp);
                 gw_obex_chdir(ctx->obex, "..", NULL);
                 chdir("..");
@@ -204,7 +204,7 @@
     if (ctx->async)
         ret = put_async(ctx, name, err);
     else
-        ret = gw_obex_put_file(ctx->obex, name, name, NULL, err);
+        ret = gw_obex_put_file(ctx->obex, name, name, type, err);
     g_free(ctx->object);
     ctx->object = NULL;
 
@@ -215,18 +215,23 @@
 {
     int c, i;
     gboolean ret, recursive;
+    char *type;
 
     if (argc < 2)
         return FALSE;
 
     /* Defaults */
     recursive = FALSE;
+    type = NULL;
 
-    while ((c = getopt(argc, argv, "r")) != -1) {
+    while ((c = getopt(argc, argv, "rt:")) != -1) {
         switch (c) {
             case 'r':
                 recursive = TRUE;
                 break;
+            case 't':
+                type = optarg;
+                break;
             default:
                 printf("Unhandled option character: '%c'\n", c);
                 break;
@@ -258,7 +263,7 @@
         else
             continue;
 
-        if (!put_object(ctx, argv[i], S_ISDIR(st.st_mode), err)) {
+        if (!put_object(ctx, argv[i], type, S_ISDIR(st.st_mode), err)) {
             printf("Puting %s failed\n", argv[i]);
             return FALSE;
         }


More information about the maemo-commits mailing list