Some fixes

This commit is contained in:
Your Name 2024-06-15 09:40:18 +03:00
parent 3b7d810177
commit 8ff9103d7f
4 changed files with 34 additions and 8 deletions

8
TODO
View File

@ -52,10 +52,14 @@ Findutils:
find
BUGS:
ls (unicode strlen)
xargs (getopt with glibc)
FIX:
ps
echo
head
echo (escape)
xargs (-I)
ls (unicode)
que (unicode)
nl
df

View File

@ -1,3 +1,3 @@
#!/bin/sh
project_dir=$(pwd)
echo ./*.c $CFLAGS -o $OUTPUT$(basename $project_dir) | xargs $CC
echo *.c $CFLAGS -o $OUTPUT$(basename $project_dir) | xargs $CC

View File

@ -43,10 +43,16 @@ char *file_path;
enum {
FAILED_SAVE = 1,
SUCCESS_SAVE
SUCCESS_SAVE,
MARK
};
int status_type;
int modified_flag;
char status_type;
char modified_flag;
/* for mark */
char mark_flag;
unsigned int curx2;
unsigned int cury2;
/* Cleaners */
void bufFree(void) {
@ -322,7 +328,7 @@ void insertNewline(void) {
}
void delChar(void) {
if (curx == 0 && cury == 0 || cury == (unsigned int)row_size)
if ((curx == 0 && cury == 0) || cury == (unsigned int)row_size)
return;
else if (curx > 0) {
@ -373,6 +379,10 @@ void delChar(void) {
}
}
void cmd(void) {
/* Execute internal cmds */
}
/* Terminal */
void DRawMode(void) {
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios) < 0)
@ -419,6 +429,9 @@ void statusBar(const char *path) {
else if (status_type == SUCCESS_SAVE)
ret = snprintf(info, sizeof(info), "File %s success saved", path);
else if (status_type == MARK)
ret = snprintf(info, sizeof(info), "Mark set at %ux %uy", curx, cury);
status_type = 0;
bufAppend(info, ret);
}
@ -529,6 +542,10 @@ void keyboard(void) {
insertNewline();
break;
case CTRL_KEY('f'):
cmd();
break;
case CTRL_KEY('q'):
die(0, NULL);
break;

View File

@ -12,7 +12,12 @@ void readcfg(const char *cfg, char *buf, size_t len) {
exit(1);
}
fgets(buf, len, fp);
if (fgets(buf, len, fp) == NULL) {
fprintf(stderr, "hostname: fgets returned NULL: %s\n", strerror(errno));
fclose(fp);
exit(1);
}
/* Remove \n from string */
*(strrchr(buf, '\n')) = '\0';