├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── epoll.c ├── epoll.h ├── hook.c ├── hook.h ├── libcolorthis.c ├── main.c ├── pty.c ├── pty.h └── test └── target ├── c └── main.c └── go ├── go.mod ├── go.sum └── main.go /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *.so 14 | *.so.* 15 | *_pch.h.cpp 16 | *_resource.rc 17 | *.qm 18 | .#* 19 | *.*# 20 | core 21 | !core/ 22 | tags 23 | .DS_Store 24 | .directory 25 | *.debug 26 | Makefile* 27 | *.prl 28 | *.app 29 | moc_*.cpp 30 | ui_*.h 31 | qrc_*.cpp 32 | Thumbs.db 33 | *.res 34 | *.rc 35 | *.user 36 | /.qmake.cache 37 | /.qmake.stash 38 | 39 | # qtcreator generated files 40 | *.pro.user* 41 | 42 | # xemacs temporary files 43 | *.flc 44 | 45 | # Vim temporary files 46 | .*.swp 47 | 48 | # Visual Studio generated files 49 | *.ib_pdb_index 50 | *.idb 51 | *.ilk 52 | *.pdb 53 | *.sln 54 | *.suo 55 | *.vcproj 56 | *vcproj.*.*.user 57 | *.ncb 58 | *.sdf 59 | *.opensdf 60 | *.vcxproj 61 | *vcxproj.* 62 | 63 | # MinGW generated files 64 | *.Debug 65 | *.Release 66 | 67 | # Python byte code 68 | *.pyc 69 | 70 | # Binaries 71 | # -------- 72 | *.dll 73 | *.exe 74 | 75 | isatty 76 | build 77 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9) 2 | 3 | project(ColorThis) 4 | 5 | add_library(LibColorThis SHARED libcolorthis.c) 6 | target_link_libraries(LibColorThis dl) 7 | 8 | add_executable(${PROJECT_NAME} 9 | main.c 10 | hook.c hook.h 11 | pty.c pty.h 12 | epoll.c epoll.h 13 | ) 14 | 15 | install(TARGETS ColorThis LibColorThis 16 | RUNTIME DESTINATION bin 17 | LIBRARY DESTINATION lib 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Sasasu 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ColorThis 2 | 3 | Tell the program I just want you to print the color. 4 | 5 | ## Quick start 6 | 7 | ### Prerequisites 8 | 9 | the compile depends is 10 | 11 | ``` 12 | cmake make gcc 13 | ``` 14 | 15 | no runtime depends 16 | 17 | ### Installation 18 | 19 | 1. Download ColorThis use `git clone git@github.com:Sasasu/ColorThis.git` 20 | 2. Compile 21 | 22 | ```shell 23 | cmake -DCMAKE_INSTALL_PREFIX=/usr . 24 | make 25 | sudo make install 26 | ``` 27 | 28 | ## Usage 29 | 30 | type ColorThis in your terminal, you will get like this 31 | 32 | ```shell 33 | $ ColorThis 34 | Usage: ColorThis