/* Bak.HC Toby Betts Public domain. Like any other piece of software (and information generally), this software comes with NO WARRANTY. This is version 20250312 of Bak.HC. */ #include "Sha1.HC" #define BACKUP_DIR "~/Backup" U0 WriteNote(U8 *dir=NULL) { CDoc *cd; I64 i; U8 *buf; U8 *file; if (!dir) { return; } /* Create commit CDoc */ cd=DocNew; DocFlagsToggle(cd,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR); DocPrint(cd, "\n\n# Enter notes; comment ends at first '#'\n"); /* Edit msg */ DocEd(cd); /* Get the important lines */ buf=DocSave(cd); DocDel(cd); i=StrFind("\n#",buf)-buf; if (!i) { return; } while (0x0A==buf[--i]) buf[i]=0; /* Write file */ file=MStrPrint("%s/notes.TXT",dir); if (0full_name,dst); tmpde=tmpde->next; } DirEntryDel(de); sum=MStrPrint("%s/sha1sum.TXT",dst); Sha1Sum(dst,sum,FALSE); Free(sum); return dst; }