MCPcopy Create free account
hub / github.com/Singular/Singular / heGenInit

Function heGenInit

Singular/fehelp.cc:812–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810
811#define MAX_SYSCMD_LEN MAXPATHLEN*2
812static BOOLEAN heGenInit(int warn, int br)
813{
814 if (heHelpBrowsers[br].required==NULL) return TRUE;
815 const char *p=heHelpBrowsers[br].required;
816 while (*p>'\0')
817 {
818 switch (*p)
819 {
820 case '#': break;
821 case ' ': break;
822 case 'i': /* singular.info */
823 case 'x': /* singular.idx */
824 case 'h': /* html dir */
825 if (feResource(*p, warn) == NULL)
826 {
827 if (warn) Warn("resource `%c` not found",*p);
828 return FALSE;
829 }
830 break;
831 case 'D': /* DISPLAY */
832 if (getenv("DISPLAY") == NULL)
833 {
834 if (warn) WarnS("resource `D` not found");
835 return FALSE;
836 }
837 break;
838 case 'E': /* executable: E:xterm: */
839 case 'O': /* OS: O:ix86Mac-darwin/ppcMac-darwin: */
840 {
841 char name[128];
842 char exec[128];
843 char op=*p;
844 memset(name,0,128);
845 int i=0;
846 p++;
847 while (((*p==':')||(*p<=' ')) && (*p!='\0')) p++;
848 while((i<127) && (*p>' ') && (*p!=':'))
849 {
850 name[i]=*p; p++; i++;
851 }
852 if (i==0) return FALSE;
853
854 if ((op=='O') && (strcmp(name,S_UNAME)!=0))
855 return FALSE;
856 if ((op=='E') && ((omFindExec(name,exec)==NULL) || FE_OPT_NO_SHELL_FLAG))
857 {
858 if (warn) Warn("executable `%s` not found",name);
859 return FALSE;
860 }
861 }
862 break;
863 default: Warn("unknown char %c",*p);
864 break;
865 }
866 p++;
867 }
868 return TRUE;
869}

Callers

nothing calls this directly

Calls 4

feResourceFunction · 0.85
WarnFunction · 0.85
WarnSFunction · 0.85
omFindExecFunction · 0.85

Tested by

no test coverage detected