/[tar]/tar/src/xheader.c
ViewVC logotype

Diff of /tar/src/xheader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by eggert, Wed Sep 3 06:22:34 2003 UTC revision 1.5 by gray, Thu Sep 4 09:37:48 2003 UTC
# Line 51  locate_handler (char const *keyword) Line 51  locate_handler (char const *keyword)
51    return NULL;    return NULL;
52  }  }
53    
54    /* Decodes a single extended header record. Advances P to the next
55       record.
56       Returns true on success, false otherwise. */
57  static bool  static bool
58  decode_record (char **p, struct tar_stat_info *st)  decode_record (char **p, struct tar_stat_info *st)
59  {  {
# Line 61  decode_record (char **p, struct tar_stat Line 64  decode_record (char **p, struct tar_stat
64    struct xhdr_tab const *t;    struct xhdr_tab const *t;
65    
66    if (**p == 0)    if (**p == 0)
67      return true;      return false;
68    
69    len = strtoul (*p, p, 10);    len = strtoul (*p, p, 10);
70    if (**p != ' ')    if (**p != ' ')
71      {      {
72        ERROR ((0, 0, _("Malformed extended header")));        ERROR ((0, 0, _("Malformed extended header: missing whitespace after the length")));
73        return true;        return false;
74      }      }
75    
76    keyword = ++*p;    keyword = ++*p;
# Line 77  decode_record (char **p, struct tar_stat Line 80  decode_record (char **p, struct tar_stat
80    
81    if (**p != '=')    if (**p != '=')
82      {      {
83        ERROR ((0, 0, _("Malformed extended header")));        ERROR ((0, 0, _("Malformed extended header: missing equal sign")));
84        return true;        return false;
85      }      }
86    
87    eqp = *p;    eqp = *p;
# Line 98  decode_record (char **p, struct tar_stat Line 101  decode_record (char **p, struct tar_stat
101      }      }
102    *eqp = '=';    *eqp = '=';
103    *p = &start[len];    *p = &start[len];
104    return false;    return true;
105  }  }
106    
107  void  void
# Line 108  xheader_decode (struct tar_stat_info *st Line 111  xheader_decode (struct tar_stat_info *st
111    char *endp = &extended_header.buffer[extended_header.size-1];    char *endp = &extended_header.buffer[extended_header.size-1];
112    
113    while (p < endp)    while (p < endp)
114      if (decode_record (&p, st))      if (!decode_record (&p, st))
115        break;        break;
116  }  }
117    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26