From 7ebcf7cb6bcda9dffd21acdbbdbc2bb5a6014272 Mon Sep 17 00:00:00 2001 From: Huck Boles Date: Wed, 2 Nov 2022 21:00:02 -0500 Subject: [PATCH] automatic backup --- .ccls-cache/@home@huck@.repos@odot/file.c | 15 ++++++--------- .../@home@huck@.repos@odot/file.c.blob | Bin 6742 -> 6757 bytes .ccls-cache/@home@huck@.repos@odot/input.c | 18 ++++++++++++++++++ .../@home@huck@.repos@odot/input.c.blob | Bin 3822 -> 4622 bytes .../@home@huck@.repos@odot/structure.c | 18 ------------------ .../@home@huck@.repos@odot/structure.c.blob | Bin 3373 -> 2603 bytes file.c | 15 ++++++--------- input.c | 18 ++++++++++++++++++ structure.c | 18 ------------------ 9 files changed, 48 insertions(+), 54 deletions(-) diff --git a/.ccls-cache/@home@huck@.repos@odot/file.c b/.ccls-cache/@home@huck@.repos@odot/file.c index f636508..14a07c9 100644 --- a/.ccls-cache/@home@huck@.repos@odot/file.c +++ b/.ccls-cache/@home@huck@.repos@odot/file.c @@ -8,10 +8,10 @@ enum color {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE}; void add(struct task t, int size){ - int l,m,h,i,len; - FILE *fcopy; - char *s; - h = len = linecount(); + int l,m,h,i; + FILE *fcopy = fopen("/tmp/fcopy", "w"); + char *s = malloc(MAXLINE * sizeof(char)); + h = size; m = h / 2; l = 0; @@ -32,22 +32,20 @@ void add(struct task t, int size){ } fseek(fp, 0, SEEK_SET); - fcopy = fopen("/tmp/fcopy", "w"); - for (i = 0; i < len;){ + for (i = 0; i <= (size + 1); i++){ if (i == m){ fprintf(fp, "%s\t%i\t%s\n",t.task,t.date,t.group); } else { fgets(s, MAXLINE, fp); fputs(s, fcopy); - i++; } } fclose(fp); fclose(fcopy); remove(TODOLIST); rename("/tmp/fcopy", TODOLIST); - + free(s); return; } @@ -82,7 +80,6 @@ void show(void){ fp = fopen(TODOLIST,"r"); while (fgets(c, MAXLINE, fp) != NULL ) printf("\t\t\033[1;35m*\033[0m %s", c); - fclose(fp); free(c); } diff --git a/.ccls-cache/@home@huck@.repos@odot/file.c.blob b/.ccls-cache/@home@huck@.repos@odot/file.c.blob index 03b9d1378e33e42762150c5a941926ac984f83c4..ba4f73213cda76b5840328ece1f49d0e0e554c0b 100644 GIT binary patch delta 1601 zcmZWpe{2&~9Pew7`PO^2x9)l^v)0@7u06W09ou!qYrAxHrCVodS49SKI^0;Q0X7vu z3^<}JsvXB;%{y8+%W`<~l$D z)vHRzvy0zr9~PeLqd*I6;f+nNUl!(me{(5s1V+q2D{SSB1H;ot3KM^g(koFI<&6*S z`e)Z-^4KH=XvfC!{h#4^2Zw)Qa}2EmA9Z#!1KfZQ*Kz$m+70mpaWNjIYr>WA(Y53% z`LM&@<+jmoD5CkarL`y(qgX-}Tgscld(gj+7wiR>6%;HF(J=yJ+wS8FN4`D$_bTdW znhT9-8f951i>4{ivW(&01tnPd3Y`t;L zeXDvSu>CzJt@IwBy@bk;GKr#f`X!+WC z{gE%H4^klQO`D0NA~fE9`RBd!hiwJw(G9!JL}p>u4D`SrGqZdS=FHR*5tG5VvF2QN zFGICL0s|@$y3!1ErGfDdZoQ3^jn8mnjZ}8@fHp=~LI936Y-OqX=$;ghry4f0R7rGC z(&AeUd6r6z?nz;|=<0Sh~Le__XabMji^TpHYAwu`^&#L$8Wm0r+8K33D zHf5)Rf8#?=Wmu__8?_gU*Ycer;*nql2%MQCY4AORDI2fD6zAJ=&C)y zk?PiG#PEm(A@XQIKi^M!=!gBn(nOddEZWH>sZ6RL7#!GwK*d$zNeM}B*p>>WaMkY`E;3Q@?rId{dxw!xEgk{o8LHp@w@GR+<9Dw!f0Ivgu)?W zwXjC4uIil`P;4u95rwE_d~J1~+$yvNGa%X?&5}PheN+bQOD*p@gEXhvWPR$gk>`(#zd4&|5!GE#AWf1CCjqKxJ6wgMvdcquUKNU{_*|x zeeZpLeLkPNo1rTq!OyMzq+hte0q(@Od#Qeh4M^l0Td;~x!Ibl!-VX9GU-0A=TZ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690e 100644 --- a/.ccls-cache/@home@huck@.repos@odot/input.c +++ b/.ccls-cache/@home@huck@.repos@odot/input.c @@ -36,3 +36,21 @@ void getopt(int n, char *arg[]){ } } +struct task maketask(char *task, char *group){ + struct task tmp; + + tmp.task = task; + tmp.date = 0; + tmp.group = group; + + return tmp; +} + + +struct task gettask(void){ + struct task tmp; + + fscanf(fp,"%s\t%i\t%s\n",tmp.task,&tmp.date,tmp.group); + + return tmp; +} diff --git a/.ccls-cache/@home@huck@.repos@odot/input.c.blob b/.ccls-cache/@home@huck@.repos@odot/input.c.blob index 0338a569a4846675ed62909ea2b64ad189c8409b..bd2c79821f1f19961328772050d104a513c0054b 100644 GIT binary patch delta 903 zcmZvaUq}>D6vpR{gN)1UFw`;)=5F&Kcb(Z>+3{wym6~Bugb+qpku>Zd6>-;QM<~P= zLqdZD8`8H3A_;;bs+S<5AR(}a9wgLysz-^S2P?Aa+?n>zLl^G3!!Y+dzwbNqH9Xr` zr!#+^;-w`9&9$hHwf?$dz@3_8Z}xtFdnR+q&R98hC}*qLLdwi#n~oei(XHxMreIq` zDSNk?%I6BUni@2%>bLQDTw`QeV7%oWi0~w|)!2z#*9W= zTRiG)6I-2k!R}&dF#ne~R0HG<-oWL|Jav*Jog5-PTxvc@*jea@V{`=1K zf`A5qYwPcdQ07WHcP10!0UF5icoX-Mr j?g<^v8&PX5|3CiqfBXXQBiw`gJen@t=hMX0m@c5dy^RCk delta 78 zcmV-U0I~m$B<>vvDggf8_Ql2k0g*2tu_;~&0SA*e3W>8K3u6M4*bOfM3zKpYK$Acb kGn4WV9Ft!VVUs2hIg?)xMUyNKGn3^GN0Y1$Ig_#xDKYaJX#fBK diff --git a/.ccls-cache/@home@huck@.repos@odot/structure.c b/.ccls-cache/@home@huck@.repos@odot/structure.c index 403c254..65828eb 100644 --- a/.ccls-cache/@home@huck@.repos@odot/structure.c +++ b/.ccls-cache/@home@huck@.repos@odot/structure.c @@ -3,21 +3,3 @@ extern FILE *fp; -struct task maketask(char *task, char *group){ - struct task tmp; - - tmp.task = task; - tmp.date = 0; - tmp.group = group; - - return tmp; -} - - -struct task gettask(void){ - struct task tmp; - - fscanf(fp,"%s\t%i\t%s\n",tmp.task,&tmp.date,tmp.group); - - return tmp; -} diff --git a/.ccls-cache/@home@huck@.repos@odot/structure.c.blob b/.ccls-cache/@home@huck@.repos@odot/structure.c.blob index d5b11573ffe39e1037f256518e2114b212208c35..af2db949188e017ce0430a2c035310f3f359b87c 100644 GIT binary patch delta 37 tcmZ20wOWKji{alEwPVK^Cg*WVPW0y4sGG#e#K1K9D_7>^Z#)K!3;_5r3^o7& delta 813 zcmZ9J&1(}u7{+HdJL~K+U3Qst-Nv-6P(m7N5Dy-52yH>ZDh07f{h%1vO%qDfu-Q_f zXebo%qF96NO~jKZBK`{=3Wc797QK10f(L~{X}Z3%Ytzty`C!@SeSXjTen@^y(HuJb zIk>TbS~azA^(y;(?!MYgge%L^%Nu_-Z+Q;`&#yVvTHur$ZmCwzUcPeel9ThjM&MW7 zVAyfzYmLBhDB+MGs=vGBTxr&eYQ}JY z8bJyN0~4EMB}`C{Fi3>X*IlyscYQN_n;vdg(C+wXI4S>5_qm4(iY*f1<8S?6-i>Z4 z-5yJikgijKAl7NvQb*XKmWfU*87r1DAY(%};B8tayj!bkwMjewbr%li>cFW$c+)YV z6(%(^9fBTcsLTs|M8p!j+58gaokK>9C6bdu`{6ZZuTN9Xq zSJDhEmBhT#AsS`H*fLq3K^jGX~qOfHgQB*~FtETIE5!&>|5`BRu%JjL)o DsI=OC diff --git a/file.c b/file.c index f636508..14a07c9 100644 --- a/file.c +++ b/file.c @@ -8,10 +8,10 @@ enum color {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE}; void add(struct task t, int size){ - int l,m,h,i,len; - FILE *fcopy; - char *s; - h = len = linecount(); + int l,m,h,i; + FILE *fcopy = fopen("/tmp/fcopy", "w"); + char *s = malloc(MAXLINE * sizeof(char)); + h = size; m = h / 2; l = 0; @@ -32,22 +32,20 @@ void add(struct task t, int size){ } fseek(fp, 0, SEEK_SET); - fcopy = fopen("/tmp/fcopy", "w"); - for (i = 0; i < len;){ + for (i = 0; i <= (size + 1); i++){ if (i == m){ fprintf(fp, "%s\t%i\t%s\n",t.task,t.date,t.group); } else { fgets(s, MAXLINE, fp); fputs(s, fcopy); - i++; } } fclose(fp); fclose(fcopy); remove(TODOLIST); rename("/tmp/fcopy", TODOLIST); - + free(s); return; } @@ -82,7 +80,6 @@ void show(void){ fp = fopen(TODOLIST,"r"); while (fgets(c, MAXLINE, fp) != NULL ) printf("\t\t\033[1;35m*\033[0m %s", c); - fclose(fp); free(c); } diff --git a/input.c b/input.c index a8846d3..7a7690e 100644 --- a/input.c +++ b/input.c @@ -36,3 +36,21 @@ void getopt(int n, char *arg[]){ } } +struct task maketask(char *task, char *group){ + struct task tmp; + + tmp.task = task; + tmp.date = 0; + tmp.group = group; + + return tmp; +} + + +struct task gettask(void){ + struct task tmp; + + fscanf(fp,"%s\t%i\t%s\n",tmp.task,&tmp.date,tmp.group); + + return tmp; +} diff --git a/structure.c b/structure.c index 403c254..65828eb 100644 --- a/structure.c +++ b/structure.c @@ -3,21 +3,3 @@ extern FILE *fp; -struct task maketask(char *task, char *group){ - struct task tmp; - - tmp.task = task; - tmp.date = 0; - tmp.group = group; - - return tmp; -} - - -struct task gettask(void){ - struct task tmp; - - fscanf(fp,"%s\t%i\t%s\n",tmp.task,&tmp.date,tmp.group); - - return tmp; -} -- 2.45.2