]> arthur.barton.de Git - netatalk.git/blobdiff - bin/getzones/getzones.c
- merge branch-netatalk-afp-3x-dev, HEAD was tagged before
[netatalk.git] / bin / getzones / getzones.c
index db44f2b96de8a0a15f4d9125c3eb20ffcb5db59b..7b717386811baf2280d7bec8f7b5e46fd0102b7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: getzones.c,v 1.6 2001-08-11 11:47:22 srittau Exp $
+ * $Id: getzones.c,v 1.7 2005-04-28 20:49:19 bfernhomberg Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -24,6 +24,7 @@
 #include <netatalk/at.h>
 #include <atalk/atp.h>
 #include <atalk/util.h>
+#include <atalk/unicode.h>
 #include <atalk/zip.h>
 
 void print_zones(short n, char *buf);
@@ -151,7 +152,22 @@ int main( argc, argv )
  */
 void print_zones( short n, char *buf )
 {
+    size_t zone_len;
+    char *zone;
+
     for ( ; n--; buf += (*buf) + 1 ) {
-       printf( "%.*s\n", *buf, buf+1 );
+
+        if ((size_t)(-1) == (zone_len = convert_string_allocate( CH_MAC,
+                       CH_UNIX, buf+1, *buf, &zone)) ) {
+            zone_len = *buf;
+            if (( zone = strdup(buf+1)) == NULL ) {
+               perror( "strdup" );
+               exit( 1 );
+            }
+        }
+
+       printf( "%.*s\n", (int)zone_len, zone );
+
+       free(zone);
     }
 }