-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
36 lines (30 loc) · 884 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef __HEADER_UTILS_H__
#define __HEADER_UTILS_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include <unistd.h>
#include <ncurses.h>
#include "mystring.h"
#include "utils.h"
#include "parsers.h"
#include "main.h"
#include "commands.h"
#define ROOT_DIR "root"
extern String buf;
extern String outbuf;
extern String clip;
extern String pipebuf;
char *convert_path(char *path);
int address_error(char *path);
int file_not_found_error(char *path);
size_t get_file_size(FILE *fp);
int count_file_lines(FILE *fp); // count the number of lines in a file without changing the cursor position
char *get_backup_path(char *path);
void copy_file(char *src, char *dst);
int count_digits(int num);
size_t pos2idx(String *buf, size_t line_num, size_t idx);
size_t posstr2idx(String *buf, char *posstr);
#endif // __HEADER_UTILS_H__