/sc.c (d59401d46002608d4563dd4afdac5ff394ed8df4) (1932 bytes) (mode 100644) (type blob)
/*
Copyright (c) 2019 Matthew Graham
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
int character;
unsigned int ccase = 0;
int iter = 1;
FILE *filep = stdin;
if (argv[1] && argv[1][0]=='-' && argv[1][1]) {
switch (argv[1][1]) {
case 'l': ccase = 'l'; break;
case 'u': ccase = 'u'; break;
case 's': ccase = 's'; break;
}
}
else {
fprintf(stderr, "sc: usage: sc -[ l|u|s ] [file...]\n");
return 1;
}
argc--;
argv++;
do {
if (argc > 1 && (filep=fopen(argv[iter], "r"))==NULL) {
fprintf(stderr, "sc: unable to open %s\n", argv[iter]);
continue;
}
switch (ccase) {
case 'l':
while ((character = fgetc(filep))!=EOF) {
if (character >= 'A' && character <= 'A')
character += 32;
putchar(character);
}
break;
case 'u':
while ((character = fgetc(filep))!=EOF) {
if (character >= 'a' && character <= 'z')
character -= 32;
putchar(character);
}
break;
case 's':
while ((character = fgetc(filep))!=EOF) {
if (character >= 'a' && character <= 'z') {
character -= 32;
putchar(character);
continue;
}
else if (character >= 'A' && character <= 'Z') {
character += 32;
putchar(character);
continue;
}
putchar(character);
}
break;
}
} while (++iter<argc);
return 0;
}
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
35149 |
f288702d2fa16d3cdf0035b15a9fcbc552cd88e7 |
COPYING |
100755 |
blob |
645 |
b9f5cace83fbbf9f9fc4be6ed424ebfe48db5502 |
INSTALL |
100644 |
blob |
2429 |
d98741b40437761e17e1fa301e70952d8ff98387 |
README |
100755 |
blob |
2455 |
d027162577972ab786457bf7f29d99ae2bb3e074 |
c |
100644 |
blob |
4206 |
e26e8eeff1fc3865d6948622517caffc32b7923c |
clp.c |
100644 |
blob |
807 |
59c452396f94f50dbe567bc19530fd386a52b652 |
echo.c |
100644 |
blob |
807 |
35eac8cabc2dacefe6167f615177cc86c0ea0399 |
exho.c |
100755 |
blob |
105 |
81a9e921c58a4a0deb918f66fa236a710bf884ae |
ins |
100644 |
blob |
979 |
89b230aabe515c66e967be21a4d9dff3ac5248da |
nl.l |
100644 |
blob |
1932 |
d59401d46002608d4563dd4afdac5ff394ed8df4 |
sc.c |
100644 |
blob |
1004 |
b55bcc811cf0abac0308318c6c086ef94eed9c39 |
spng.c |
100644 |
blob |
1178 |
1433a0105fd7a07e7ede04214e26552241f36b64 |
tee.c |
100644 |
blob |
2099 |
f3b9072d9d355ecd3400a039b870593cc771a084 |
wc.c |
100644 |
blob |
807 |
962e0d90c8db83301b1e9d2ca50f9e09f27c752d |
yes.c |
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