Nife version Beta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

86 lines
2.1 KiB

  1. /* Copyright (C) 2011-2022 Patrick H. E. Foubet - S.E.R.I.A.N.E.
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or any
  5. later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>
  12. *******************************************************************/
  13. /* help.c */
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include "help.h"
  17. #include "nife.h"
  18. #include "lib.h"
  19. #include "mth.h"
  20. #define LHLP 200 /* longueur MAX des lignes du fichier hlp */
  21. static char buf[LHLP];
  22. static void helpShow(char * L)
  23. {
  24. FILE * fd;
  25. int debut=0,l;
  26. if ((fd = fopen("nife.hlp","r")) == NULL) {
  27. perror("help file");
  28. return;
  29. } else {
  30. if (L == NULL) {
  31. debut=1;
  32. while (fgets(buf,LHLP,fd) != NULL) {
  33. if (buf[0] != ' ') break;
  34. printf("%s",buf);
  35. }
  36. } else {
  37. while (fgets(buf,LHLP,fd) != NULL) {
  38. if (debut) {
  39. if (buf[0] != ' ') break;
  40. } else {
  41. if (buf[0] == ' ') continue;
  42. l=strlen(L);
  43. if (strncmp(L,buf,l)!=0) continue;
  44. if (buf[l]!=' ') continue;
  45. debut=1;
  46. }
  47. printf("%s",buf);
  48. }
  49. }
  50. }
  51. if (debut==0) printf("No help find !\n");
  52. fclose(fd);
  53. }
  54. void helpStd(char * L)
  55. {
  56. dropTrSuite();
  57. if (fctExists(L)==0) {
  58. printf("%s is not a User System function !\n",L);
  59. return;
  60. }
  61. if (*L == '_') {
  62. printf("%s :\n",L);
  63. printf("The same as '%s', but with all displays in the log file.\n", L+1);
  64. L++;
  65. }
  66. helpShow(L);
  67. }
  68. void IF_help(void)
  69. {
  70. putTrSuite(helpStd);
  71. }
  72. void IF_helpS(void)
  73. {
  74. helpShow(NULL);
  75. }