aboutsummaryrefslogtreecommitdiffstats
path: root/src/easydir.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-03-03 20:10:05 +0000
committerJoursoir <chat@joursoir.net>2021-03-03 20:10:05 +0000
commit8a48afccb97462b0dc261e8c99c0825295ebc019 (patch)
tree5efa557df3969708d4ce052713033d9e57df84b7 /src/easydir.c
parentce7c8411d7af66904da5e852f01fd95426ccf5c0 (diff)
downloadlock-password-8a48afccb97462b0dc261e8c99c0825295ebc019.tar.gz
lock-password-8a48afccb97462b0dc261e8c99c0825295ebc019.tar.bz2
lock-password-8a48afccb97462b0dc261e8c99c0825295ebc019.zip
cmd 'edit' has become more secure
Diffstat (limited to 'src/easydir.c')
-rw-r--r--src/easydir.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/easydir.c b/src/easydir.c
index c94b944..cf10110 100644
--- a/src/easydir.c
+++ b/src/easydir.c
@@ -54,37 +54,3 @@ int count_dir_entries(const char *path)
closedir(dir);
return counter;
}
-
-char *fileCropLineFeed(char *path, char *text, int maxlen)
-{
- FILE *file = fopen(path, "r+");
- if(file == NULL) callError(130);
-
- int symbol;
- int pos = 0;
- char *str = (char *) malloc(sizeof(char) * maxlen);
- while((symbol = fgetc(file)))
- {
- switch(symbol)
- {
- case '\n':
- case EOF: {
- str[pos] = '\0';
- pos = -1; // for break while
- break;
- }
- default: {
- str[pos] = symbol;
- pos++;
- break;
- }
- }
- if(pos == -1) break;
- if(pos > maxlen-1) { str[pos-1] = '\0'; break; }
- }
- fclose(file);
-
- strcpy(text, str);
- free(str);
- return text;
-}