From 16d53ae072750761ce1074ee253f867af3d906da Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 11 Nov 2013 13:49:46 +1100 Subject: [PATCH] Fixed pitdate selection and query date configuration --- lib/dsmobjects.c | 13 +++++++++---- tsmpipe.c | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/dsmobjects.c b/lib/dsmobjects.c index b08c3fa..08c568a 100644 --- a/lib/dsmobjects.c +++ b/lib/dsmobjects.c @@ -34,10 +34,16 @@ dsmDate dsmStrToDate(char *s) { if (verbose) printf("dsmStrToDate: Date String: %s\n", s); - /* if user key in some inputs */ if (s[0] != '\0') { - strncpy(x,s,sizeof(strchr(s,':'))); + y=strchr(s,':'); + + if (y != NULL) { + strncpy(x,s,strlen(s)-strlen(y)); + x[strlen(s)-strlen(y)] = '\0'; + y = strchr(s,':')+1; + } else + x = s; d = atol(x); date->month = d / 1000000; @@ -46,8 +52,7 @@ dsmDate dsmStrToDate(char *s) { date->day = d / 10000; date->year = d % 10000; - if (strlen(x) != strlen(s)) { - y = strchr(s,':')+1; + if (y != NULL) { t = atol(y); date->hour = t / 10000; diff --git a/tsmpipe.c b/tsmpipe.c index 3fddba4..8152819 100644 --- a/tsmpipe.c +++ b/tsmpipe.c @@ -253,7 +253,20 @@ int main(int argc, char *argv[]) { qbData.stVersion = qryBackupDataVersion; qbData.objName = &objName; qbData.owner = ""; - qbData.objState = (action == ACTION_DELETE) ? DSM_ACTIVE : DSM_ANY_MATCH; + + switch (action) { + case ACTION_DELETE: + qbData.objState = DSM_ACTIVE; + break; + + case ACTION_EXTRACT: + qbData.objState = pitdate ? DSM_ANY_MATCH : DSM_ACTIVE; + break; + + case ACTION_LIST: + qbData.objState = DSM_ANY_MATCH; + break; + } if (action == ACTION_DELETE || ! pitdate) { qbData.pitDate.year = DATE_MINUS_INFINITE;