-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
682 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: trigger-gitlab-ci | ||
run-name: ${{ github.event_name }} triggered by ${{ github.actor }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
trigger-gitlab-ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger CI | ||
run: curl -X POST --fail -F token=${{ secrets.trigger_gitlab_ci }} -F ref=main https://gitlab.com/api/v4/projects/54782732/trigger/pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
|
||
#include "iniparser.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "iniparser.h" | ||
|
||
void create_empty_ini_file(void) | ||
{ | ||
FILE *ini; | ||
|
||
if ((ini = fopen("example.ini", "w")) == NULL) { | ||
fprintf(stderr, "iniparser: cannot create example.ini\n"); | ||
return; | ||
} | ||
|
||
fclose(ini); | ||
} | ||
|
||
int write_to_ini(const char *ini_name) | ||
{ | ||
void *dictionary; | ||
FILE *ini_file; | ||
int ret = 0; | ||
|
||
if (!ini_name) { | ||
fprintf(stderr, "Invalid argurment\n"); | ||
return -1; | ||
} | ||
|
||
dictionary = iniparser_load(ini_name); | ||
|
||
if (!dictionary) { | ||
fprintf(stderr, "cannot parse file: %s\n", ini_name); | ||
return -1; | ||
} | ||
|
||
/* set section */ | ||
ret = iniparser_set(dictionary, "Pizza", NULL); | ||
|
||
if (ret < 0) { | ||
fprintf(stderr, "cannot set section in: %s\n", ini_name); | ||
ret = -1; | ||
goto free_dict; | ||
} | ||
|
||
/* set key/value pair */ | ||
ret = iniparser_set(dictionary, "Pizza:Cheese", "TRUE"); | ||
|
||
if (ret < 0) { | ||
fprintf(stderr, "cannot set key/value in: %s\n", ini_name); | ||
ret = -1; | ||
goto free_dict; | ||
} | ||
|
||
ini_file = fopen(ini_name, "w+"); | ||
|
||
if (!ini_file) { | ||
fprintf(stderr, "iniparser: cannot create example.ini\n"); | ||
ret = -1; | ||
goto free_dict; | ||
} | ||
|
||
iniparser_dump_ini(dictionary, ini_file); | ||
fclose(ini_file); | ||
free_dict: | ||
iniparser_freedict(dictionary); | ||
return ret; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int ret; | ||
|
||
if (argc < 2) { | ||
create_empty_ini_file(); | ||
ret = write_to_ini("example.ini"); | ||
} else | ||
ret = write_to_ini(argv[1]); | ||
|
||
return ret ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
|
||
#include "iniparser.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.