spicylord / clutils (public) (License: GPLv3) (since 2019-07-04) (hash sha1)
An assortment of new and rewritten preexisting tools written by me.
List of commits:
Subject Hash Author Date (UTC)
ins has been replaced with a shell script and clp has been fixed 35072ced804239e2f886fdf3b4dd995dfe6805f1 spicylord 2019-08-22 18:49:38
reverted sc because I cannot into memory management. ins is suffering from memory as well so use at your own risk. 1f24dcf261e3d779782a5e5ba2bd0c26da0fd928 spicylord 2019-08-17 19:10:51
im an idiot c6aa7a7fa124fb08422fb24de68ecb70ba066195 spicylord 2019-08-16 04:30:23
bug fixes 5ec9e0063dee0e8cb9b7c88a06535a1c13faa2af spicylord 2019-08-16 04:20:21
added free for previously unfreed malloc buffer fbuf ec2c9bbcb387a718d36bd861083ac2c40134c152 spicylord 2019-08-16 02:01:00
put all of the programs under the GPLv3 or later, also updated sc.c 77dbf20cedc357042ffc03e5da9a51690337a977 spicylord 2019-08-16 01:08:49
added ins to INSTALL script 6d58cd823d49a8ad4a32a57173d5d690ddb677c6 spicylord 2019-08-15 21:23:41
added ins, a program that takes standard input and inserts that into the beginning of a file c51d12a96e47c407a2e82980401556194b2c090e matt 2019-08-15 21:17:47
added exho, a program that runs a command and outputs that command to stdout 4c7b8d4998e747541c420256494cee40ff19fc12 spicylord 2019-07-12 02:29:35
allow for easy use of different c compilers in INSTALL a1bb4ec6cdbd070edb7955022f93ff33ca7255da spicylord 2019-07-11 16:16:46
made COPYING less cringe-inducing 8d1e9ca0093f143c25b919552b544db92c9f865d spicylord 2019-07-10 01:32:22
modified usage output and allowed for #,p 504ca7b3d8db60cb6d1f36a3fd48043ff62f78c0 spicylord 2019-07-06 15:49:16
spelling error in README 351dbee78173eef7ae94f9142c6a97452db0d208 spicylord 2019-07-04 20:30:33
added examples and instructions for clp, spng, and sc in the README 313a86755e40d909861bc95a11b75bbb109012c9 spicylord 2019-07-04 19:25:33
made regex slightly neater ac8eda8f7290e5f138edac12f789b1215de90719 spicylord 2019-07-04 18:31:55
fixed outputting garbled text into clipboard file a100287acf1993ae13130e036d7104bd2afe4585 spicylord 2019-07-04 18:30:34
fixed install script to compile clp.c instead of clb.c 54a54b5da1a122e69ed62bc0f030f11044a62fb9 spicylord 2019-07-04 13:47:33
added email a04151394c9a4b3afe23e8ebd11939fe7892737d spicylord 2019-07-04 02:58:00
initial commit 484a7ed27b1835a962cec85cc6f55a20d4a95b46 spicylord 2019-07-04 02:50:23
Commit 35072ced804239e2f886fdf3b4dd995dfe6805f1 - ins has been replaced with a shell script and clp has been fixed
Author: spicylord
Author date (UTC): 2019-08-22 18:49
Committer name: spicylord
Committer date (UTC): 2019-08-22 18:49
Parent(s): 1f24dcf261e3d779782a5e5ba2bd0c26da0fd928
Signing key:
Tree: 819b94089c10c23ff48ad7d99f6f1da08c0404db
File Lines added Lines deleted
INSTALL 1 2
README 5 4
clp.c 2 2
echo.c 0 60
ins 6 0
yes.c 29 0
File INSTALL changed (mode: 100755) (index b83c078..b9f5cac)
... ... if [ "$1" = "" ]; then
10 10 $CC exho.c -o exho $CC exho.c -o exho
11 11 ./exho "$CC clp.c -o clp" ./exho "$CC clp.c -o clp"
12 12 ./exho "$CC echo.c -o echo" ./exho "$CC echo.c -o echo"
13 ./exho "$CC ins.c -o ins"
14 13 ./exho "lex nl.l && $CC lex.yy.c -o nl -lfl && rm lex.yy.c" ./exho "lex nl.l && $CC lex.yy.c -o nl -lfl && rm lex.yy.c"
15 14 ./exho "$CC sc.c -o sc" ./exho "$CC sc.c -o sc"
16 15 ./exho "$CC spng.c -o spng" ./exho "$CC spng.c -o spng"
 
... ... if [ "$1" = "" ]; then
18 17 ./exho "$CC wc.c -o wc" ./exho "$CC wc.c -o wc"
19 18 ./exho "$CC yes.c -o yes" ./exho "$CC yes.c -o yes"
20 19 fi fi
21 [ "$1" = "clean" ] && rm clp echo exho ins nl sc spng tee wc yes
20 [ "$1" = "clean" ] && rm clp echo exho nl sc spng tee wc yes
File README changed (mode: 100644) (index b38b363..7e7dee0)
... ... manager for standard input and output.
14 14
15 15 clp: clp:
16 16 Insert by piping in standard input ex. Insert by piping in standard input ex.
17 echo lmao | clp i
17 echo test | clp i
18 18 that uses its "i" option. This will copy the stdin that uses its "i" option. This will copy the stdin
19 19 into your ~/.clipboard file as an entry. into your ~/.clipboard file as an entry.
20 20 the -f option will set your clipboard file to be the -f option will set your clipboard file to be
21 whatever you want for that command: echo lmao | clip -f altclipboard i
21 whatever you want for that command: echo test | clip -f altclipboard i
22 22 the following commands use ed-like addressing. the following commands use ed-like addressing.
23 23 clp ,p will print (paste) your entire clipboard, clp ,p will print (paste) your entire clipboard,
24 24 clp 1,2p will print the earliest 2 entries, clp 1,2p will print the earliest 2 entries,
25 25 and clp p will print the latest entry. and clp p will print the latest entry.
26 the same works with the "d" option, except
27 it deletes the entries.
26 the same works with the "d" option, which deletes.
28 27 clp c just counts the entries and ends the program. clp c just counts the entries and ends the program.
29 28 i: insert i: insert
30 29 p: print p: print
 
... ... the versions already in your /usr/bin or /bin,
53 52 for any issues and changes you would like to see, for any issues and changes you would like to see,
54 53 email me at sl@airmail.cc email me at sl@airmail.cc
55 54
55 Copyright 2020 Matthew Graham <sl@airmail.cc>
56 56 These programs are under the GPLv3 or any later version. These programs are under the GPLv3 or any later version.
57 A copy of the GPL is available in the COPYING file.
File clp.c changed (mode: 100644) (index 10d3ad5..e26e8ee)
... ... int main(int argc, char *argv[])
56 56 break; break;
57 57 case 'p': outflag = 1; case 'p': outflag = 1;
58 58 break; break;
59 case 'd': delflag = 1;;
59 case 'd': delflag = 1;
60 60 break; break;
61 61 case 'c': ocountflag = 1; case 'c': ocountflag = 1;
62 62 break; break;
 
... ... int main(int argc, char *argv[])
99 99 fprintf(filep, "%s%s", delim, inbuf); fprintf(filep, "%s%s", delim, inbuf);
100 100 goto ending; goto ending;
101 101 } }
102
102 rewind(filep); //so it can start at the beginning
103 103 while (fgets(tester, sizeof(tester), filep)!=NULL) while (fgets(tester, sizeof(tester), filep)!=NULL)
104 104 if (memcmp(tester, delim, sizeof(delim)-1)==0) if (memcmp(tester, delim, sizeof(delim)-1)==0)
105 105 end++; end++;
File echo.c changed (mode: 100644) (index 3f3c327..59c4523)
... ... int main(int argc, char *argv[])
24 24 printf("%s%c", argv[i], i==argc? '\n':' '); printf("%s%c", argv[i], i==argc? '\n':' ');
25 25 return 0; return 0;
26 26 } }
27 )
28 if (memcmp(tester, delim, sizeof(delim)-1)==0)
29 end++;
30 rewind(filep);
31
32 if (ocountflag) {
33 printf("%ld\n", end);
34 goto ending; /* stops program after outputting count */
35 }
36
37 if (end==0) {
38 fputs("nothing to act on\n", stderr);
39 fclose(filep);
40 exit(1);
41 }
42 if (to>end) {
43 fputs("clip: end point too big\n", stderr);
44 fclose(filep);
45 exit(1);
46 }
47 if (!from && !to && commaflag) { from=1; to=end; }
48 if (!from && !to && !commaflag) { from = end; to = end; }
49 if (from && !to && commaflag) to = end;
50 if (delflag) {
51 int delimflag=0;
52 if ((tdelfilep=fopen(".clipboard~~~", "w+"))==NULL) {
53 fputs("clip: cannot create temporary file\n", stderr);
54 fclose(filep);
55 exit(1);
56 }
57 while (counter <= end && fgets(tester, sizeof(tester), filep)) {
58 if (memcmp(tester, delim, sizeof(delim)-1)==0) {
59 counter++;
60 delimflag=1;
61 continue;
62 }
63 if (counter < from || counter > to) {
64 fprintf(tdelfilep, "%s%s", delimflag?delim:"", tester);
65 delimflag=0;
66 }
67 }
68 rename(".clipboard~~~", filename);
69 goto ending;
70 }
71
72 if (outflag) {
73 while (counter <= end && fgets(tester, sizeof(tester), filep)) {
74 if (memcmp(tester, delim, sizeof(delim)-1)==0) {
75 counter++;
76 continue;
77 }
78 if (counter >= from && counter <= to) {
79 fputs(tester, stdout);
80 }
81 }
82 }
83 ending:
84 fclose(filep);
85 exit(0);
86 }
File ins added (mode: 100755) (index 0000000..81a9e92)
1 #!/bin/sh
2 cat - > ".temp~~"
3 for file in "$@"; do
4 cat ".temp~~" "$file" | spng "$file"
5 done
6 rm ".temp~~"
File yes.c changed (mode: 100644) (index e69de29..962e0d9)
1 /*
2 Copyright (c) 2019 Matthew Graham
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18 #include <stdio.h>
19
20 void main(int argc, char *argv[])
21 {
22 pledge("stdio", 0);
23 if (argc==1)
24 for(;;)
25 puts("y");
26 else
27 for (;;)
28 puts(argv[1]);
29 }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/spicylord/clutils

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/spicylord/clutils

Clone this repository using git:
git clone git://git.rocketgit.com/user/spicylord/clutils

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main