save
This commit is contained in:
BIN
c-out/bin/yait
BIN
c-out/bin/yait
Binary file not shown.
BIN
c-out/obj/main.o
BIN
c-out/obj/main.o
Binary file not shown.
@@ -1,4 +0,0 @@
|
|||||||
PREFIX=/usr/bin/
|
|
||||||
CFLAGS=-Wall -Wextra -ggdb
|
|
||||||
LDFLAGS=
|
|
||||||
CC=clang
|
|
||||||
18
core/file.h
18
core/file.h
@@ -15,28 +15,10 @@
|
|||||||
#define DEFAULT_DIR_PERMISSIONS 0755
|
#define DEFAULT_DIR_PERMISSIONS 0755
|
||||||
#define MAX_PATH_LENGTH 1024
|
#define MAX_PATH_LENGTH 1024
|
||||||
|
|
||||||
/**
|
|
||||||
* Create directory and change into it
|
|
||||||
* @param dirname Directory name to create and enter
|
|
||||||
* @return 0 on success, errno on failure
|
|
||||||
*/
|
|
||||||
int create_and_enter_directory (const char *dirname);
|
int create_and_enter_directory (const char *dirname);
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a file with formatted content
|
|
||||||
* @param path File path to create
|
|
||||||
* @param format Format string for file content
|
|
||||||
* @param ... Variable arguments for formatting
|
|
||||||
* @return 0 on success, -1 on failure
|
|
||||||
*/
|
|
||||||
int create_file_with_content (char *path, char *format, ...);
|
int create_file_with_content (char *path, char *format, ...);
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a directory with formatted path
|
|
||||||
* @param format Format string for directory path
|
|
||||||
* @param ... Variable arguments for formatting
|
|
||||||
* @return 0 on success, errno on failure
|
|
||||||
*/
|
|
||||||
int create_directory (char *format, ...);
|
int create_directory (char *format, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
print_error_with_prefix (char *format, ...)
|
printfn (char *format, ...)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|||||||
11
core/print.h
11
core/print.h
@@ -12,15 +12,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/**
|
int printfn (char *format, ...);
|
||||||
* Print a formatted message to stderr with program prefix and newline
|
|
||||||
* @param format Format string (printf-style)
|
|
||||||
* @param ... Variable arguments for formatting
|
|
||||||
* @return Number of characters printed
|
|
||||||
*/
|
|
||||||
int print_error_with_prefix (char *format, ...);
|
|
||||||
|
|
||||||
/* Legacy function name for backward compatibility */
|
|
||||||
#define printfn print_error_with_prefix
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,11 +38,3 @@ parse_standard_options (void (*usage) (int), int argc, char **argv)
|
|||||||
}
|
}
|
||||||
return HELP_REQUESTED;
|
return HELP_REQUESTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
initialize_main (int *argc, char ***argv)
|
|
||||||
{
|
|
||||||
(*argc)--;
|
|
||||||
(*argv)++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,21 +9,6 @@
|
|||||||
#ifndef STANDARD_H
|
#ifndef STANDARD_H
|
||||||
#define STANDARD_H
|
#define STANDARD_H
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse standard command line options (--help, --version)
|
|
||||||
* @param usage_func Function pointer to usage display function
|
|
||||||
* @param argc Argument count
|
|
||||||
* @param argv Argument vector
|
|
||||||
* @return 0 on success, 1 if help/version requested, errno on error
|
|
||||||
*/
|
|
||||||
int parse_standard_options (void (*usage_func) (), int argc, char **argv);
|
int parse_standard_options (void (*usage_func) (), int argc, char **argv);
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup the program
|
|
||||||
* @param argc Argument count
|
|
||||||
* @param argv Argument vector
|
|
||||||
* @return 0 on success, 1 if something fails
|
|
||||||
*/
|
|
||||||
int initialize_main (int *, char ***);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -385,7 +385,6 @@ main (int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = initialize_main (&argc, &argv);
|
|
||||||
status = parse_standard_options (usage, argc, argv);
|
status = parse_standard_options (usage, argc, argv);
|
||||||
|
|
||||||
if (status && status != HELP_REQUESTED)
|
if (status && status != HELP_REQUESTED)
|
||||||
|
|||||||
Reference in New Issue
Block a user