2 * src/main.c - this file contains the main function of tesh.
4 * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package.
14 #include <directory.h>
15 #include <directories.h>
23 * entry used to define the parameter of a tesh option.
25 typedef struct s_optentry
27 int c; /* the character of the option */
30 * the type of the argument of the option
34 flag, /* it's a flag option, by default the flag is set to zero */
35 string, /* the option has strings as argument */
36 number /* the option has an integral positive number as argument */
39 byte* value; /* the value of the option */
40 byte* optional_value; /* the optional value of the option if not specified */
41 const char * long_name; /* the long name of the command */
42 }s_optentry_t,* optentry_t;
46 XBT_LOG_NEW_DEFAULT_CATEGORY(tesh,"TEst SHell utility");
49 /* Windows specific : the previous process error mode */
54 /* this object represents the root directory */
56 root_directory = NULL;
58 /* the current version of tesh */
62 /* ------------------------------------------------------------ */
64 /* ------------------------------------------------------------ */
66 /* ------------------------------------------------------------ */
68 /* ------------------------------------------------------------ */
71 /* --jobs is specified with arg */
75 /* --jobs option is not specified (use the default job count) */
79 /* --jobs is specified but has no arg (one job per unit) */
81 optional_jobs_nb = -1;
83 /* the global timeout */
87 /* ------------------------------------------------------------ */
89 /* ------------------------------------------------------------ */
91 /* --C change the directory before running the units */
95 /* the include directories : see the !i metacommand */
97 include_dirs = NULL;*/
101 /* the list of tesh files to run */
109 /* the list of tesh file suffixes */
118 /* ------------------------------------------------------------ */
120 /* ------------------------------------------------------------ */
122 /* if 1, keep going when some commands can't be found
123 * default value 0 : not keep going
128 /* if 1, ignore failures from commands
129 * default value : do not ignore failures
132 keep_going_unit_flag = 0;
134 /* if 1, display tesh usage */
136 print_usage_flag = 0;
138 /* if 1, display the tesh version */
140 print_version_flag = 0;
142 /* if 1, the syntax of all tesh files is checked
143 * before running them
146 check_syntax_flag = 0;
148 /* if 1, the status of all the units is display at
154 /* if 1 and the flag want_summay is set to 1 tesh display the detailed summary of the run */
156 detail_summary_flag = 0;
158 /* if 1, the directories are displayed */
160 print_directory_flag = 0;
162 /* if 1, just check the syntax of all the tesh files
168 /* if 1, display the tesh files syntax and exit */
170 print_readme_flag = 0;
179 env_overrides_flag = 0;
182 print_database_flag = 0;
187 /* the semaphore used to synchronize the jobs */
191 /* the semaphore used by the runner to wait the end of all the units */
216 /* the table of the entries of the options */
217 static const struct s_optentry opt_entries[] =
219 { 'C', string, (byte*)NULL, 0, "directory" },
220 { 'x', string, (byte*)&suffixes, 0, "suffix" },
221 { 'e', flag, (byte*)&env_overrides_flag, 0, "environment-overrides", },
222 { 'f', string, (byte*)&fstreams, 0, "file" },
223 { 'h', flag, (byte*)&print_usage_flag, 0, "help" },
224 { 'a', flag, (byte*)&print_readme_flag, 0, "semantic" },
225 { 'i', flag, (byte*)&keep_going_unit_flag, 0, "keep-going-unit" },
226 { 'I', string, (byte*)&include_dirs, 0, "include-dir" },
227 { 'j', number, (byte*)&jobs_nb, (byte*) &optional_jobs_nb, "jobs" },
228 { 'k', flag, (byte*)&keep_going_flag, 0, "keep-going" },
229 { 'm', flag, (byte*)&detail_summary_flag, 0, "detail-summary" },
230 { 'c', flag, (byte*)&just_print_flag, 0, "just-print" },
231 { 'd', flag, (byte*)&print_database_flag, 0,"display-data-base" },
232 { 'q', flag, (byte*)&question_flag, 0, "question_flag" },
233 { 's', flag, (byte*)&silent_flag, 0, "silent" },
234 { 'V', flag, (byte*)&print_version_flag, 0, "version" },
235 { 'w', flag, (byte*)&print_directory_flag, 0,"dont-display-directory" },
236 { 'n', flag, (byte*)&dry_run_flag, 0, "dry-run"},
237 { 't', number, (byte*)&timeout, 0, "timeout" },
238 { 'S', flag, (byte*)&check_syntax_flag, 0, "check-syntax"},
239 { 'r', string, (byte*)&directories, 0, "load-directory"},
240 { 'v', flag, (byte*)&summary_flag, 0, "summary"},
241 { 'F', string,(byte*)&excludes, 0, "exclude"},
242 { 'l', string,(byte*)&logs,0,"log"},
247 static const char* usage[] =
250 " -C DIRECTORY, --directory=DIRECTORY Change to DIRECTORY before running any commands.\n",
251 " -e, --environment-overrides Environment variables override files.\n",
252 " -f FILE, --file=FILE Read FILE as a teshfile.\n",
254 " all argument of the command line without\n",
255 " option is dealed as a tesh file.\n",
256 " -h, --help Print this message and exit.\n",
257 " -i, --keep-going-unit Ignore failures from commands.\n",
258 " The possible failures are :\n",
259 " - the exit code differ from the expected\n",
260 " - the signal throw differ from the expected\n",
261 " - the output differ from the expected\n",
262 " - the read pipe is broken\n",
263 " - the write pipe is broken\n",
264 " - the command assigned delay is outdated\n",
265 " -I DIRECTORY, --include-dir=DIRECTORY Search DIRECTORY for included files.\n",
266 " -j [N], --jobs[=N] Allow N commands at once; infinite commands with\n"
268 " -k, --keep-going Keep going when some commands can't be made or\n",
270 " -c, --just-print Don't actually run any commands; just print them.\n",
271 " -p, --print-data-base Display tesh's internal database.\n",
272 " -q, --question Run no commands; exit status says if up to date.\n",
273 " -s, --silent, Don't echo commands.\n",
274 " -V, --version Print the version number of tesh and exit.\n",
275 " -d, --dont-print-directory Don't display the current directory.\n",
276 " -n, --dry-run Check the syntax of the specified tesh files, display the result and exit.\n",
277 " -t, --timeout Wait the end of the commands at most timeout seconds.\n",
278 " -S, --check-syntax Check the syntax of the tesh files before run them. \n",
279 " -x, --suffix Consider the new suffix for the tesh files.\n"
281 " the default suffix for the tesh files is \".tesh\".\n",
282 " -a, --read-me Print the read me file and exit.\n",
283 " -b, --build-file Build a tesh file.\n",
284 " -r, --load-directory Run all the tesh files located in the directories specified by the option --directory.\n",
285 " -v, --summary Display the status of the commands.\n",
286 " -m, --detail-summary Detail the summary of the run.\n",
287 " -F file , --exclude=FILE Ignore the tesh file FILE.\n",
288 " -l format, --log Format of the xbt logs.\n",
292 /* the string of options of tesh */
294 optstring[1 + sizeof (opt_entries) / sizeof (opt_entries[0]) * 3];
296 /* the option table of tesh */
298 option longopts[(sizeof (opt_entries) / sizeof (s_optentry_t))];
304 process_command_line(int argc, char** argv);
326 sig_abort_handler(int signum)
328 /* TODO : implement this function */
329 INFO0("sig_abort_handler() called");
333 sig_int_handler(int signum)
335 /* TODO : implement this function */
336 INFO0("sig_int_handler() called");
340 free_string(void* str)
352 main(int argc, char* argv[])
356 /* set the locale to the default*/
357 setlocale(LC_ALL,"");
359 /* initialize tesh */
363 /* process the command line */
364 if(process_command_line(argc, argv) < 0)
367 /* move to the root directory (the directory may change during the command line processing) */
368 chdir(root_directory->name);
370 /* initialize the xbt library
371 * for thread portability layer
374 /* xbt initialization */
376 if((_argc = xbt_dynar_length(logs)))
380 char** _argv = (char**)calloc(_argc, sizeof(char*));
382 for(i = 0; i < _argc; i++)
383 xbt_dynar_pop(logs, &(_argv[i]));
385 xbt_init(&_argc, _argv);
393 xbt_init(&argc, argv);
395 /* the user wants to display the usage of tesh */
396 if(print_version_flag)
400 if(!print_usage_flag)
404 /* the user wants to display the usage of tesh */
411 /* the user wants to display the semantic of the tesh file metacommands */
412 if(print_readme_flag)
418 /* load tesh files */
422 /* use by the finalize function to known if it must display the tesh usage */
426 {/* --jobs is not specified (use the default value) */
427 jobs_nb = default_jobs_nb;
429 else if(optional_jobs_nb == jobs_nb)
430 {/* --jobs option is specified with no args (use one job per unit) */
431 jobs_nb = fstreams_get_size(fstreams);
434 if(jobs_nb > fstreams_get_size(fstreams))
435 {/* --jobs = N is specified and N is more than the number of tesh files */
437 WARN0("Number of requested jobs exceed the number of files to run");
439 /* assume one job per file */
440 jobs_nb = fstreams_get_size(fstreams);
443 /* initialize the semaphore used to synchronize all the units */
444 jobs_sem = xbt_os_sem_init(jobs_nb);
446 /* initialize the semaphore used by the runner to wait for the end of all units */
447 units_sem = xbt_os_sem_init(0);
449 /* initialize the runner */
450 if(runner_init(check_syntax_flag, timeout, fstreams) < 0)
453 if(just_print_flag && silent_flag)
456 if(just_print_flag && dry_run_flag)
457 WARN0("mismatch in the syntax : --just-check-syntax and --just-display options at same time");
459 /* run all the units */
463 /* show the result of the units */
464 if(summary_flag || dry_run_flag)
467 /* all the test are runned, destroy the runner */
470 /* then, finalize tesh (release all the allocated memory and exits) */
479 /* init -- initialize tesh : allocated all the objects needed by tesh to run
480 * the tesh files specified in the command line.
482 * return If successful the function returns zero. Otherwise the function returns
483 * -1 and sets the global variable errno to the appropriate error code.
492 char* suffix = strdup(".tesh");
495 /* Windows specific : don't display the general-protection-fault message box and
496 * the the critical-error-handler message box (instead the system send the error
497 * to the calling process : tesh)
499 prev_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
501 struct sigaction act;
502 /* Ignore pipe issues.
503 * They will show up when we try to send data to dead buddies,
504 * but we will stop doing so when we're done with provided input
506 memset(&act,0, sizeof(struct sigaction));
507 act.sa_handler = SIG_IGN;
508 sigaction(SIGPIPE, &act, NULL);
511 memset(&act,0, sizeof(struct sigaction));
512 act.sa_handler = sig_abort_handler;
513 sigaction(SIGABRT, &act, NULL);
515 memset(&act,0, sizeof(struct sigaction));
516 act.sa_handler = sig_int_handler;
517 sigaction(SIGINT, &act, NULL);
521 err_mutex = xbt_os_mutex_init();
523 /* handle the abort signal */
524 /*signal(SIGABRT, sig_abort_handler);*/
526 /* handle the interrupt signal */
527 /*signal(SIGINT, sig_int_handler);*/
529 /* used to store the files to run */
530 if(!(fstreams = fstreams_new(DEFAULT_FSTREAMS_CAPACITY, (void_f_pvoid_t)fstream_free)))
532 ERROR1("(system error) %s", strerror(errno));
536 /* register the current directory */
537 if(!(buffer = getcwd(NULL, 0)))
539 ERROR1("(system error) %s", strerror(errno));
543 /* save the root directory */
544 if(!(root_directory = directory_new(buffer)))
546 ERROR1("(system error) %s", strerror(errno));
552 /* this vector contains all the errors of the run */
553 errors = xbt_dynar_new(sizeof(xerror_t), free_error);
555 /* the directories to loads */
556 if(!(directories = directories_new()))
558 ERROR1("(system error) %s", strerror(errno));
562 /* the include directories */
563 include_dirs = xbt_dynar_new(sizeof(directory_t), (void_f_pvoid_t)directory_free);
565 /* xbt logs option */
566 if(!(logs = xbt_dynar_new(sizeof(char*), free_string)))
568 ERROR1("(system error) %s", strerror(errno));
572 /* the excluded files */
573 if(!(excludes = excludes_new()))
575 ERROR1("(system error) %s", strerror(errno));
580 suffixes = xbt_dynar_new(sizeof(char*),free_string);
582 /* register the default suffix ".tesh" */
583 xbt_dynar_push(suffixes, &suffix);
588 /* load -- load the tesh files to run */
593 /* if the directories object is not empty load all the tesh files contained in
594 * the directories specified in the command line (this tesh files must have the
595 * a suffix specified in the suffixes object.
597 if(!directories_is_empty(directories))
598 directories_load(directories, fstreams, suffixes);
600 /* if no tesh file has been specified in the command line try to load the default tesh file
601 * teshfile from the current directory
603 if(fstreams_is_empty(fstreams))
605 struct stat buffer = {0};
607 /* add the default tesh file if it exists in the current directory */
608 if(!stat("teshfile", &buffer) && S_ISREG(buffer.st_mode))
609 fstreams_add(fstreams, fstream_new(getcwd(NULL, 0), "teshfile"));
612 /* excludes the files specified in the command line and stored in the excludes object */
613 if(!excludes_is_empty(excludes) && !fstreams_is_empty(fstreams))
615 /* check the files to excludes before */
616 excludes_check(excludes, fstreams);
618 /* exclude the specified tesh files */
619 fstreams_exclude(fstreams, excludes);
622 /* if the fstreams object is empty use the stdin */
623 if(fstreams_is_empty(fstreams))
624 fstreams_add(fstreams, fstream_new(NULL, "stdin"));
626 /* load the tesh files (open them) */
627 fstreams_load(fstreams);
631 /* finalize -- cleanup all the allocated objects and display the tesh usage if needed */
636 if(is_tesh_root && !summary_flag)
641 xbt_dynar_foreach(errors, i, error)
644 fprintf(stderr, "[tesh/ERROR] %s : <Command `%s'> <Unit `%s'> <C%d (%s)>\n", error->reason, error->command, error->unit, error->errcode, error_to_string(error->errcode));
645 else if(!error->command && error->unit)
646 fprintf(stderr, "[tesh/ERROR] %s : Unit `%s' - C%d (%s)\n", error->reason, error->unit, error->errcode, error_to_string(error->errcode));
647 else if(!error->command && !error->unit && error->reason)
648 fprintf(stderr, "[tesh/ERROR] %s : C%d (%s)\n", error->reason, error->errcode, error_to_string(error->errcode));
649 else if(!error->command && !error->unit && !error->reason)
650 fprintf(stderr, "[tesh/ERROR] C%d (%s)\n", error->errcode, error_to_string(error->errcode));
656 /* delete vector of errors */
658 xbt_dynar_free(&errors);
660 xbt_os_mutex_destroy(err_mutex);
662 /* delete the fstreams object */
664 fstreams_free((void**)&fstreams);
666 /* delete the excludes object */
668 excludes_free((void**)&excludes);
670 /* delete the directories object */
672 directories_free((void**)&directories);
674 /* delete the root directory object */
676 directory_free((void**)&root_directory);
678 /* delete the include directories object */
680 xbt_dynar_free(&include_dirs);
682 /* delete the list of tesh files suffixes */
684 xbt_dynar_free(&suffixes);
686 /* delete the xbt log options list */
688 xbt_dynar_free(&logs);
691 /* destroy the semaphore used to synchronize the units */
693 xbt_os_sem_destroy(jobs_sem);
695 /* destroy the semaphore used by the runner used to wait for the end of the units */
697 xbt_os_sem_destroy(units_sem);
699 /* exit from the xbt framework */
702 /* Windows specific (restore the previouse error mode */
704 SetErrorMode(prev_error_mode);
707 if(!summary_flag && !dry_run_flag && !silent_flag && !just_print_flag && !print_version_flag && !print_usage_flag && is_tesh_root)
710 INFO2("tesh terminated with exit code %d : %s",exit_code, "success");
712 ERROR2("tesh terminated with exit code %d : %s",exit_code, error_to_string(exit_code));
716 /* exit with the last error code */
720 /* init_options -- initialize the options string */
727 /* the function has been already called */
728 if(optstring[0] != '\0')
735 for (i = 0; opt_entries[i].c != '\0'; ++i)
737 /* initialize the long name of the option*/
738 longopts[i].name = (opt_entries[i].long_name == 0 ? "" : opt_entries[i].long_name);
740 /* getopt_long returns the value of val */
741 longopts[i].flag = 0;
743 /* the short option */
744 longopts[i].val = opt_entries[i].c;
746 /* add the short option in the options string */
747 *p++ = opt_entries[i].c;
749 switch (opt_entries[i].type)
751 /* if this option is used to set a flag or if the argument must be ignored
752 * the option has no argument
755 longopts[i].has_arg = no_argument;
758 /* the option has an argument */
764 if(opt_entries[i].optional_value != 0)
768 longopts[i].has_arg = optional_argument;
771 longopts[i].has_arg = required_argument;
778 longopts[i].name = 0;
781 /* process_command_line -- process the command line
783 * param argc the number of the arguments contained by the command line.
784 * param The array of C strings containing all the arguments of the command
787 * return If successful, the function returns 0. Otherwise -1 is returned
788 * and sets the global variable errno to indicate the error.
790 * errors [ENOENT] A file name specified in the command line does not exist
794 process_command_line(int argc, char** argv)
796 register const struct s_optentry* entry;
798 directory_t directory;
801 /* initialize the options string of tesh */
804 /* let the function getopt_long display the errors if any */
807 /* set option index to zero */
810 while (optind < argc)
812 c = getopt_long(argc, argv, optstring, longopts, (int *) 0);
816 /* end of the command line or "--". */
821 /* no option specified, assume it's a tesh file to run */
825 /* getpath returns -1 when the file to get the path doesn't exist */
826 if(getpath(optarg, &path) < 0)
831 ERROR1("File %s does not exist", optarg);
833 ERROR0("Insufficient memory is available to parse the command line : system error");
838 /* get to the last / (if any) to get the short name of the file */
839 delimiter = strrchr(optarg,'/');
841 /* create a new file stream which represents the tesh file to run */
842 fstream = fstream_new(path, delimiter ? delimiter + 1 : optarg);
846 /* if the list of all tesh files to run already contains this file
847 * destroy it and display a warning, otherwise add it in the list.
849 if(fstreams_contains(fstreams, fstream))
851 fstream_free(&fstream);
852 WARN1("File %s already specified to be run", optarg);
855 fstreams_add(fstreams, fstream);
863 /* unknown option, let getopt_long() displays the error */
864 ERROR0("Command line processing failed : invalid command line");
865 exit_code = EINVCMDLINE;
870 for(entry = opt_entries; entry->c != '\0'; ++entry)
879 ERROR0("Command line processing failed : internal error");
880 exit_code = EPROCCMDLINE;
886 /* set the flag to one */
887 *(int*) entry->value = 1;
896 /* an option with a optional arg is specified use the entry->optional_value */
897 optarg = (char*)entry->optional_value;
899 else if (*optarg == '\0')
901 /* a non optional argument is not specified */
902 ERROR2("Option %c \"%s\"requires an argument",entry->c,entry->long_name);
907 /* --load-directory option */
908 if(!strcmp(entry->long_name,"load-directory"))
911 struct stat info = {0};
912 if(stat(optarg, &info) || !S_ISDIR(info.st_mode))
914 ERROR1("%s is not a directory",optarg);
922 if(translatepath(optarg, &path) < 0)
927 ERROR1("%s is not a directory",optarg);
929 ERROR0("Insufficient memory is available to process the command line - system error");
938 directory = directory_new(optarg);
940 directory = directory_new(path);
944 if(directories_contains(directories, directory))
946 directory_free((void**)&directory);
947 WARN1("Directory %s already specified to be load",optarg);
950 directories_add(directories, directory);
955 else if(!strcmp(entry->long_name,"directory"))
958 struct stat info = {0};
959 if(stat(optarg, &info) || !S_ISDIR(info.st_mode))
961 ERROR1("%s is not a directory",optarg);
969 if(translatepath(optarg, &path) < 0)
974 ERROR1("%s is not a directory",optarg);
976 ERROR0("Insufficient memory is available to process the command line - system error");
983 char* buffer = getcwd(NULL, 0);
987 if(!strcmp(buffer, optarg))
988 WARN1("Already in the directory %s", optarg);
989 else if(!print_directory_flag)
990 INFO1("Entering directory \"%s\"",optarg);
995 if(!strcmp(buffer, path))
996 WARN1("Already in the directory %s", optarg);
997 else if(!print_directory_flag)
998 INFO1("Entering directory \"%s\"",path);
1010 /* --suffix option */
1011 else if(!strcmp(entry->long_name,"suffix"))
1013 if(strlen(optarg) > MAX_SUFFIX)
1015 ERROR1("Suffix %s too long",optarg);
1016 exit_code = ESUFFIXTOOLONG;
1020 if(optarg[0] == '.')
1026 char suffix[MAX_SUFFIX + 2] = {0};
1027 sprintf(suffix,".%s",optarg);
1029 xbt_dynar_foreach(suffixes, i, cur)
1031 if(!strcmp(suffix, cur))
1039 WARN1("Suffix %s already specified to be used", optarg);
1041 xbt_dynar_push(suffixes, &suffix);
1049 xbt_dynar_foreach(suffixes, i, cur)
1051 if(!strcmp(optarg, cur))
1059 WARN1("Suffix %s already specified to be used", optarg);
1061 xbt_dynar_push(suffixes, &optarg);
1065 else if(!strcmp(entry->long_name,"file"))
1070 if(getpath(optarg, &path) < 0)
1075 ERROR1("File %s does not exist", optarg);
1077 ERROR0("Insufficient memory is available to process the command line - system error");
1082 delimiter = strrchr(optarg,'/');
1084 fstream = fstream_new(path, delimiter ? delimiter + 1 : optarg);
1088 if(fstreams_contains(fstreams, fstream))
1090 fstream_free(&fstream);
1091 WARN1("File %s already specified to run", optarg);
1094 fstreams_add(fstreams, fstream);
1096 /* --include-dir option */
1097 else if(!strcmp(entry->long_name,"include-dir"))
1100 struct stat info = {0};
1101 if(stat(optarg, &info) || !S_ISDIR(info.st_mode))
1103 ERROR1("%s is not a directory",optarg);
1104 exit_code = ENOTDIR;
1111 if(translatepath(optarg, &path) < 0)
1115 if(ENOTDIR == errno)
1116 ERROR1("%s is not a directory",optarg);
1118 ERROR0("Insufficient memory is available to process the command line - system error");
1129 directory = directory_new(optarg);
1131 directory = directory_new(path);
1135 xbt_dynar_foreach(include_dirs, i , cur)
1137 if(!strcmp(cur->name, optarg))
1146 directory_free((void**)&directory);
1147 WARN1("Include directory %s already specified to be used",optarg);
1151 xbt_dynar_push(include_dirs, &directory);
1155 /* --exclude option */
1156 else if(!strcmp(entry->long_name,"exclude"))
1161 if(getpath(optarg, &path) < 0)
1166 ERROR1("file %s does not exist", optarg);
1168 ERROR0("Insufficient memory is available to process the command line - system error");
1173 delimiter = strrchr(optarg,'/');
1175 fstream = fstream_new(path, delimiter ? delimiter + 1 : optarg);
1178 if(excludes_contains(excludes, fstream))
1180 fstream_free(&fstream);
1181 WARN1("File %s already specified to be exclude", optarg);
1184 excludes_add(excludes, fstream);
1188 else if(!strcmp(entry->long_name,"log"))
1190 xbt_dynar_push(logs, &optarg);
1194 INFO1("Unexpected option %s", optarg);
1201 /* strictly positve number options */
1204 if ((NULL == optarg) && (argc > optind))
1208 for (cp = argv[optind]; isdigit(cp[0]); ++cp)
1210 optarg = argv[optind++];
1213 /* the number option is specified */
1216 int i = atoi(optarg);
1219 for (cp = optarg; isdigit(cp[0]); ++cp);
1221 if (i < 1 || cp[0] != '\0')
1223 ERROR2("Option %c \"%s\" requires an strictly positive integer as argument",entry->c, entry->long_name);
1224 exit_code = ENOTPOSITIVENUM;
1228 *(int*)entry->value = i;
1230 /* the number option is specified but has no arg, use the optional value*/
1232 *(int*)entry->value = *(int*) entry->optional_value;
1251 stream = exit_code ? stderr : stdout;
1253 fprintf (stream, "Usage: tesh [options] [file] ...\n");
1255 for (cpp = usage; *cpp; ++cpp)
1256 fputs (*cpp, stream);
1258 fprintf(stream, "\nReport bugs to <martin.quinson@loria.fr | malek.cherier@loria.fr>\n");
1264 /* TODO : display the version of tesh */
1265 printf("Version :\n");
1266 printf(" tesh version %s : Mini shell specialized in running test units by Martin Quinson \n", version);
1267 printf(" and Malek Cherier\n");
1268 printf(" Copyright (c) 2007, 2008 Martin Quinson, Malek Cherier\n");
1269 printf(" All rights reserved\n");
1270 printf(" This program is free software; you can redistribute it and/or modify it\n");
1271 printf(" under the terms of the license (GNU LGPL) which comes with this package.\n\n");
1273 if(!print_usage_flag)
1274 printf("Report bugs to <martin.quinson@loria.fr | malek.cherier@loria.fr>");
1283 FILE* stream = fopen("README.txt", "r");
1287 ERROR0("Unable to locate the README.txt file");
1288 exit_code = EREADMENOTFOUND;
1292 while(getline(&line, &len, stream) != -1)