projmr/project_files/project_lib.txt
2026-01-04 14:56:02 +04:00

58 lines
1.6 KiB
Plaintext

*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
#if (!defined(__LIB_%_H_))
#define __LIB_%_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void %_error(char* _err) {
printf("\033[1mprojmr: \033[91m%s\033[0m\n", _err);
}
char* __YDSJS_user_home = NULL;
char* __YDSJS_files_dir = "/.projmr/project_files/";
void __attach_project_mode(void) {
__YDSJS_user_home = getenv("HOME");
}
FILE* __open_project_file(char* name, char* mode) {
if (strlen(name) >= 32) return NULL;
char* file_text_name = malloc(strlen(__YDSJS_user_home) + strlen(__YDSJS_files_dir) + 34);
strcpy(file_text_name, __YDSJS_user_home);
strcat(file_text_name, __YDSJS_files_dir);
strcat(file_text_name, name);
FILE* fp = fopen(file_text_name, mode);
free(file_text_name);
return fp;
}
int _lib_%_main(int argc, char** argv) {
/* Your code */
return EXIT_SUCCESS;
}
#endif /* __LIB_%_H_ */