Imported Upstream version 2.5.2p1
[debian/amanda] / oldrecover-src / extract_list.c
index 6d69910a32e43aff25c6473fa3b9f7e7ef7c73f4..a952ac0d0a9e2ea78f4531ca0d096115fcb350fb 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: extract_list.c,v 1.6.2.1 2006/11/08 17:11:39 martinea Exp $
+ * $Id: extract_list.c,v 1.6 2006/08/24 01:57:15 paddy_s Exp $
  *
  * implements the "extract" command in amrecover
  */
@@ -702,15 +702,14 @@ void add_file(
                        puts(l);
                        continue;
                    }
-#define sc "201-"
-                   if(strncmp(l, sc, sizeof(sc)-1) != 0) {
+
+                   s = l;
+                   if(strncmp_const_skip(l, "201-", s, ch) != 0) {
                        err = "bad reply: not 201-";
                        continue;
                    }
 
-                   s = l + sizeof(sc)-1;
                    ch = *s++;
-#undef sc
                    skip_whitespace(s, ch);
                    if(ch == '\0') {
                        err = "bad reply: missing date field";
@@ -741,12 +740,14 @@ void add_file(
                     s[-1] = (char)ch;
 
                    if(am_has_feature(indexsrv_features, fe_amindexd_fileno_in_ORLD)) {
+                       OFF_T_FMT_TYPE fileno_ = (OFF_T_FMT_TYPE)0;
                        skip_whitespace(s, ch);
-                       if(ch == '\0' || sscanf(s - 1, OFF_T_FMT,
-                               (OFF_T_FMT_TYPE *)&lditem.fileno) != 1) {
+                       if(ch == '\0' ||
+                          sscanf(s - 1, OFF_T_FMT, &fileno_) != 1) {
                            err = "bad reply: cannot parse fileno field";
                            continue;
                        }
+                       lditem.fileno = (off_t)fileno_;
                        skip_integer(s, ch);
                    }
 
@@ -1019,14 +1020,14 @@ delete_file(
                        puts(l);
                        continue;
                    }
-#define sc "201-"
-                   if(strncmp(l, sc, sizeof(sc)-1) != 0) {
+
+                   s = l;
+                   if(strncmp_const_skip(l, "201-", s, ch) != 0) {
                        err = "bad reply: not 201-";
                        continue;
                    }
-                   s = l + sizeof(sc)-1;
                    ch = *s++;
-#undef sc
+
                    skip_whitespace(s, ch);
                    if(ch == '\0') {
                        err = "bad reply: missing date field";
@@ -1055,12 +1056,14 @@ delete_file(
                    *tape_undo = '\0';
 
                    if(am_has_feature(indexsrv_features, fe_amindexd_fileno_in_ORLD)) {
+                       OFF_T_FMT_TYPE fileno_ = (OFF_T_FMT_TYPE)0;
                        skip_whitespace(s, ch);
-                       if(ch == '\0' || sscanf(s - 1, OFF_T_FMT,
-                               (OFF_T_FMT_TYPE *)&fileno) != 1) {
+                       if(ch == '\0' ||
+                          sscanf(s - 1, OFF_T_FMT, &fileno_) != 1) {
                            err = "bad reply: cannot parse fileno field";
                            continue;
                        }
+                       fileno = (off_t)fileno_;
                        skip_integer(s, ch);
                    }