]> git.pond.sub.org Git - empserver/commitdiff
(ship_ca): Fix selector name's ca_len.
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 30 Aug 2004 16:20:05 +0000 (16:20 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 30 Aug 2004 16:20:05 +0000 (16:20 +0000)
(xflds): Ignore ca_len for NSC_STRINGY.

src/lib/commands/xdump.c
src/lib/global/nsc.c

index 2e1f11ba0f95401f79ee800c528f30b70cd1c4a9..e778e048403749770bd2b91754b260e6b63e5576 100644 (file)
@@ -329,7 +329,7 @@ xdprval(struct valstr *val, char *sep)
 static void
 xdflds(struct castr ca[], void *ptr)
 {
-    int i, j;
+    int i, j, n;
     struct valstr val;
     char *sep = "";
 
@@ -338,11 +338,12 @@ xdflds(struct castr ca[], void *ptr)
            continue;
        if (ca[i].ca_flags & NSC_EXTRA)
            continue;
+       n = ca[i].ca_type != NSC_STRINGY ? ca[i].ca_len : 0;
        j = 0;
        do {
            xdeval(&val, ca[i].ca_type, ptr, ca[i].ca_off, j);
            sep = xdprval(&val, sep);
-       } while (++j < ca[i].ca_len);
+       } while (++j < n);
     }
 }
 
@@ -359,7 +360,7 @@ xdfldnam(struct castr ca[])
        if (ca[i].ca_flags & NSC_EXTRA)
            continue;
        pr("%s%s", sep, ca[i].ca_name);
-       if (ca[i].ca_len)
+       if (ca[i].ca_len && ca[i].ca_type != NSC_STRINGY)
            pr(" %d", ca[i].ca_len);
        sep = " ";
     }
index 288cf906570137dbcd8c703eaac567d2fb59714a..6fcfabded460506af67daabe6da80ad37b7f91aa 100644 (file)
@@ -143,7 +143,7 @@ struct castr ship_ca[] = {
     {NSC_TIME, 0, 0, fldoff(shpstr, shp_access), "access"},
     {NSC_TIME, 0, 0, fldoff(shpstr, shp_timestamp), "timestamp"},
     /* FIXME sail stuff missing */
-    {NSC_STRINGY, 0, 0, fldoff(shpstr, shp_name), "name"},
+    {NSC_STRINGY, 0, MAXSHPNAMLEN, fldoff(shpstr, shp_name), "name"},
     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_fuel), "fuel"},
     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_nchoppers), "nchoppers"},
     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_nxlight), "nxlight"},