Diffstat (limited to 'gammu/emb/common/service/backup') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/service/backup/backgen.h | 2 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/backtext.c | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h index 9a930fc..9d97954 100644 --- a/gammu/emb/common/service/backup/backgen.h +++ b/gammu/emb/common/service/backup/backgen.h | |||
@@ -63,9 +63,9 @@ typedef struct { | |||
63 | GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; | 63 | GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; |
64 | } GSM_SMS_Backup; | 64 | } GSM_SMS_Backup; |
65 | 65 | ||
66 | extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); | 66 | extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); |
67 | extern GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); | 67 | extern GSM_Error GSM_AddSMSBackupFile (char *FileName, GSM_SMS_Backup *backup); |
68 | 68 | ||
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | /* How should editor hadle tabs in this file? Add editor commands here. | 71 | /* How should editor hadle tabs in this file? Add editor commands here. |
diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c index 4cb1bb7..07a3b22 100644 --- a/gammu/emb/common/service/backup/backtext.c +++ b/gammu/emb/common/service/backup/backtext.c | |||
@@ -2995,17 +2995,21 @@ GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) | |||
2995 | 2995 | ||
2996 | return GSM_ReadSMSBackupTextFile(FileName, backup); | 2996 | return GSM_ReadSMSBackupTextFile(FileName, backup); |
2997 | } | 2997 | } |
2998 | 2998 | ||
2999 | GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) | 2999 | static GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) |
3000 | { | 3000 | { |
3001 | int i,w,current; | 3001 | int i,w,current; |
3002 | unsigned char buffer[10000]; | 3002 | unsigned char buffer[10000]; |
3003 | GSM_DateTimeDT; | 3003 | GSM_DateTimeDT; |
3004 | 3004 | ||
3005 | fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION); | 3005 | fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION); |
3006 | GSM_GetCurrentDateTime (&DT); | 3006 | GSM_GetCurrentDateTime (&DT); |
3007 | fprintf(file,"# Saved %s\n\n",OSDateTime(DT,false)); | 3007 | fprintf(file,"# Saved "); |
3008 | fprintf(file, "%04d%02d%02dT%02d%02d%02d", | ||
3009 | DT.Year, DT.Month, DT.Day, | ||
3010 | DT.Hour, DT.Minute, DT.Second); | ||
3011 | fprintf(file," (%s)\n\n",OSDateTime(DT,false)); | ||
3008 | 3012 | ||
3009 | i=0; | 3013 | i=0; |
3010 | while (backup->SMS[i]!=NULL) { | 3014 | while (backup->SMS[i]!=NULL) { |
3011 | fprintf(file,"[SMSBackup%03i]\n",i); | 3015 | fprintf(file,"[SMSBackup%03i]\n",i); |
@@ -3087,13 +3091,13 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) | |||
3087 | } | 3091 | } |
3088 | return ERR_NONE; | 3092 | return ERR_NONE; |
3089 | } | 3093 | } |
3090 | 3094 | ||
3091 | GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) | 3095 | GSM_Error GSM_AddSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) |
3092 | { | 3096 | { |
3093 | FILE *file; | 3097 | FILE *file; |
3094 | 3098 | ||
3095 | file = fopen(FileName, "wb"); | 3099 | file = fopen(FileName, "ab"); |
3096 | if (file == NULL) return(ERR_CANTOPENFILE); | 3100 | if (file == NULL) return(ERR_CANTOPENFILE); |
3097 | 3101 | ||
3098 | SaveSMSBackupTextFile(file,backup); | 3102 | SaveSMSBackupTextFile(file,backup); |
3099 | 3103 | ||