#include #include "tool.h" #if defined(UNIX_SUNOS) || defined(UNIX_LINUX) #define ABS_MAXSIZNAME 255 #else #define ABS_MAXSIZNAME 14 #endif /* Retourne != 0 si un path est lexicalement valide */ export int path_isvalid (const char *path) { int ret = 1; char locpath[MAXSIZ_PATH]; strcpy (locpath,path); while (strcmp(locpath,"/") != 0 && strchr(locpath,'/')!=NULL){ char file[MAXSIZ_PATH]; path_splitlex (locpath,locpath,file); if (file[0] == '\0') break; if (strlen(file) > ABS_MAXSIZNAME){ ret = 0; break; } } if (strlen(locpath) > ABS_MAXSIZNAME) ret = 0; return ret; }