From 713fe618deb4f196b07952858dbaed41378bcc36 Mon Sep 17 00:00:00 2001 From: tTh Date: Mon, 22 Jul 2024 23:56:06 +0200 Subject: [PATCH] add a test proggy --- files/t.c | 73 +++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/files/t.c b/files/t.c index 7e1cccf..6ea8b76 100644 --- a/files/t.c +++ b/files/t.c @@ -1,54 +1,47 @@ /* - * NcLooper test des fonctions fichier (???) + * small proggy for testing some functions */ - -#include -#include -#include -#include -#include -#include "../nclooper.h" -#include "smpllist.h" + +#include +#include + #include "ffuncs.h" -/* --------------------------------------------------------------------- */ +int verbosity = 1; -int verbosity; - -SampleRef the_samples[26]; - -/* --------------------------------------------------------------------- */ -void help(int k) +int test_of_the_trim_funcs(int foo) { -puts("Test des fonctions de gestion des fichiers"); -exit(0); -} -/* --------------------------------------------------------------------- */ +char buffer[200]; -int main(int argc, char *argv[]) -{ -int foo; -int opt; -char *listname = "samples.list"; +printf(" --- %s ---\n\n", __func__); + +strcpy(buffer, "nothing to trim"); +dump(buffer, NULL); +puts(""); + +strcpy(buffer, "trailing spaces "); +dump(buffer, NULL); +rtrim(buffer); +dump(buffer, NULL); +puts(""); + +strcpy(buffer, " leading spaces"); +dump(buffer, NULL); +ltrim(buffer); +dump(buffer, NULL); +puts(""); + +return 0; +} + +int main(int argc, char *argv[]) +{ + +(void)test_of_the_trim_funcs(0); -while ((opt = getopt(argc, argv, "hl:v")) != -1) { - switch(opt) { - case 'h': help(0); break; - case 'v': verbosity++; break; - case 'l': listname = optarg; break; - } - } -#if DEBUG_LEVEL -fprintf(stderr, "argc = %d, optind = %d\n", argc, optind); -#endif -foo = lecture_liste_des_samples(listname, the_samples); -fprintf(stderr,"retour lecture liste '%s' -> %d\n", listname, foo); - -affiche_liste_des_samples(the_samples); return 0; } -/* --------------------------------------------------------------------- */