@@ -274,7 +274,10 @@ bool is_period(char *period, int period_type) // 주기 인자 검사
274
274
operator = 0 ;
275
275
memset (target , 0 , BUFFER_SIZE );
276
276
memset (unit , 0 , BUFFER_SIZE );
277
- sscanf (period_token [i ], "%[^/(-)]%c%s" , target , & operator , unit ); // 슬래시 우선 토큰 분리
277
+ if (strchr (period_token [i ], '-' ) && strchr (period_token [i ], '/' )) // 슬래시와 범위가 둘다 포함되는 경우
278
+ sscanf (period_token [i ], "%[^/]%c%s" , target , & operator , unit );
279
+ else // 둘중 하나만 포함되는 경우
280
+ sscanf (period_token [i ], "%[^-/]%c%s" , target , & operator , unit );
278
281
#ifdef DEBUG
279
282
printf ("is_period(): target = %s, operator = %c, unit = %s\n" , target , operator , unit );
280
283
#endif
@@ -291,8 +294,8 @@ bool is_period(char *period, int period_type) // 주기 인자 검사
291
294
if (strchr (target , '*' ) != NULL || strchr (unit , '*' ) != NULL )
292
295
return false;
293
296
294
- // 3-3. 뒤의 수가 앞의 수보다 클 경우
295
- if (atoi (target ) < atoi (unit ))
297
+ // 3-3. 앞의 수가 뒤의 수보다 클 경우
298
+ if (atoi (target ) > atoi (unit ))
296
299
return false;
297
300
298
301
// 3-4 허용 범위를 초과했을 경우
@@ -344,8 +347,8 @@ bool is_period(char *period, int period_type) // 주기 인자 검사
344
347
if (strchr (unit , '/' ) != NULL || strchr (unit , '-' ) != NULL )
345
348
return false;
346
349
347
- // 4-2. 시작, 끝의 범위가 전체(*)로 끝날 경우
348
- if (( strchr ( target , '*' ) != NULL && strlen ( unit ) != 1 ) || strchr (unit , '*' ) != NULL )
350
+ // 4-2. 끝의 범위가 전체(*)로 끝날 경우
351
+ if (strchr (unit , '*' ) != NULL )
349
352
return false;
350
353
351
354
// 4-3. 앞 토큰이 범위일 경우
0 commit comments