X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=oldrecover-src%2Fextract_list.c;h=a952ac0d0a9e2ea78f4531ca0d096115fcb350fb;hb=d3b2175e084f88c8736ad7073eacbf4670147aec;hp=6d69910a32e43aff25c6473fa3b9f7e7ef7c73f4;hpb=34197d9f46a5f4e944378cbb65fca32ee0eec7b9;p=debian%2Famanda diff --git a/oldrecover-src/extract_list.c b/oldrecover-src/extract_list.c index 6d69910..a952ac0 100644 --- a/oldrecover-src/extract_list.c +++ b/oldrecover-src/extract_list.c @@ -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); }