|
@@ -45,12 +45,47 @@ void EShShowHelpAndExit() {
|
|
|
exit(0);
|
|
|
}
|
|
|
|
|
|
-int EShIsShellLetter(char c) {
|
|
|
+int EShIsShellLetter(char c) { // TODO: Russian symbols
|
|
|
return (c >= 'a' && c <= 'z') ||
|
|
|
(c >= 'A' && c <= 'Z') ||
|
|
|
- (c >= 'а' && c <= 'я') ||
|
|
|
- (c >= 'А' && c <= 'Я') ||
|
|
|
(c >= '0' && c <= '9') ||
|
|
|
(c >= ' ' && c <= '/') ||
|
|
|
(c >= ':' && c <= '?');
|
|
|
}
|
|
|
+
|
|
|
+ESH_JOB_DELIMITER EshIsJobDelimiter(char* c) {
|
|
|
+ if (strstr(c, "&&") == c) {
|
|
|
+ return LOGIC_AND;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strstr(c, "||") == c) {
|
|
|
+ return LOGIC_OR;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strstr(c, "&") == c) {
|
|
|
+ return LOGIC_AND;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strstr(c, "|") == c) {
|
|
|
+ return BIT_OR;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strstr(c, ";") == c) {
|
|
|
+ return SEMICOLON;
|
|
|
+ }
|
|
|
+
|
|
|
+ return NOT_A_DELIMITER;
|
|
|
+}
|
|
|
+
|
|
|
+int EShGetJobDelimiterSize(ESH_JOB_DELIMITER delim) {
|
|
|
+ if (delim == LOGIC_AND || delim == LOGIC_OR) {
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (delim == BIT_OR || delim == LOGIC_AND || delim == SEMICOLON) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|