mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-07 03:45:23 +01:00
Add mes and mescc-tools-extra
mescc-tools-extra contains two important tools: - cp - chmod mes first builds itself from a mes 0.21 seed as used by guix, and then builds a mes 0.22 and then mes 0.22 using that created mes 0.22. It does /not/ use bootstrap.sh as we don't have a proper shell at this point, it has been manually adapted for kaem.
This commit is contained in:
parent
2706e07556
commit
649d7b68dc
1029 changed files with 120985 additions and 18 deletions
70
sysa/mescc-tools-extra/functions/string.c
Normal file
70
sysa/mescc-tools-extra/functions/string.c
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/* Copyright (C) 2016 Jeremiah Orians
|
||||
* This file is part of mescc-tools.
|
||||
*
|
||||
* mescc-tools 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.
|
||||
*
|
||||
* mescc-tools 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 mescc-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
#define MAX_STRING 4096
|
||||
//CONSTANT MAX_STRING 4096
|
||||
// void* calloc(int count, int size);
|
||||
void file_print(char* s, FILE* f);
|
||||
|
||||
char* copy_string(char* target, char* source)
|
||||
{
|
||||
while(0 != source[0])
|
||||
{
|
||||
target[0] = source[0];
|
||||
target = target + 1;
|
||||
source = source + 1;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
char* postpend_char(char* s, char a)
|
||||
{
|
||||
char* ret = calloc(MAX_STRING, sizeof(char));
|
||||
if(NULL == ret) return NULL;
|
||||
|
||||
char* hold = copy_string(ret, s);
|
||||
hold[0] = a;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* prepend_char(char a, char* s)
|
||||
{
|
||||
char* ret = calloc(MAX_STRING, sizeof(char));
|
||||
if(NULL == ret) return NULL;
|
||||
|
||||
ret[0] = a;
|
||||
copy_string((ret+1), s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* prepend_string(char* add, char* base)
|
||||
{
|
||||
char* ret = calloc(MAX_STRING, sizeof(char));
|
||||
if(NULL == ret) return NULL;
|
||||
|
||||
copy_string(copy_string(ret, add), base);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int string_length(char* a)
|
||||
{
|
||||
int i = 0;
|
||||
while(0 != a[i]) i = i + 1;
|
||||
return i;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue