initial commit

This commit is contained in:
hollorol
2024-07-31 23:12:49 +02:00
commit f56ffe480d
17 changed files with 279 additions and 0 deletions
@@ -0,0 +1,8 @@
DEST=$(HOME)/.local/bin
SRC=snake-to-cammel.c
OUT=../snake_to_cammel
$(OUT): $(SRC)
gcc -pedantic -Wall -Wextra $(SRC) -o $(OUT)
install:
cp $(OUT) $(DEST)
@@ -0,0 +1,43 @@
/*
* This simple program is created by Roland Hollós (hollorol@rolandhollos.net)
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_LINE_LEN 10000
int
main()
{
char s[MAX_LINE_LEN];
char out[MAX_LINE_LEN];
while(fgets(s, MAX_LINE_LEN, stdin) != NULL){
int string_length = strlen(s);
int k = 0;
int under = 0;
for(int i = 0; i < string_length; ++i)
{
/* if((s[i] >= 65) && (s[i] <= 90)) */
if((s[i] == '_') && !under){
under = 1;
continue;
}
if((s[i] <= 122) && (s[i] >= 90) && under)
{
out[k] = s[i] - 32;
k++;
under = 0;
continue;
}
out[k] = s[i];
k++;
under = 0;
}
out[k] = '\0';
printf("%s", out);
}
return 0;
}