-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhead.h
59 lines (43 loc) · 1.41 KB
/
head.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#define TNRM "\x1B[0m"
#define TRED "\033[1;31m"
#define TGRN "\x1B[32m"
#define TYEL "\x1B[33m"
#define TBLU "\x1B[34m"
#define TMAG "\x1B[35m"
#define TCYN "\x1B[36m"
#define TWHT "\x1B[37m"
#define TRSE "\33[2K\r"
#define _GNU_SOURCE/*For strcasestr*/
#define UNUSED(x) (void)(x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/io.h>
#include <sys/mman.h>
#include <dirent.h>
extern int cflag, vflag, iflag, wflag, Hflag, fflag, rflag, hflag, mflag, noflag, mnum, bflag, fileflag, eflag, qflag;
extern int opterr, nl;
typedef struct pat_info{
char *pat;
int *pos;
}pat_info;
int check(char *token, const char *substr);
int valid(char ch);
char *excep(char *token, const char *substr);
void modify(char *line, int read);
char *file_mmap(const char *substr);
void printline(char *line, pat_info *p, int j, int exist, int blank, const char *path, FILE *fs);
void recursive(const char *basePath, const char *substr);
void print_filename(char *fname);
void search(char *path, const char *substr);
void find(char *path, const char *substr);
void multiple_files(const char **path, const char *substr, int j);
void byte_offset(FILE *fp, char *line);
char *icase (const char* substr, char *tline, char *ptr);
void frecursive(const char *basePath, int num, char newpath[][100]);