at_utils.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2019-2021 Tencent Group. All rights reserved.
  3. * License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef _AT_UTILS_H_
  19. #define _AT_UTILS_H_
  20. #include <stdarg.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #define WIDTH_SIZE 32
  24. #ifndef __INT_MAX__
  25. #define __INT_MAX__ 2147483647
  26. #endif
  27. #ifndef INT_MAX
  28. #define INT_MAX (__INT_MAX__)
  29. #endif
  30. #define AT_CMD_COMMA_MARK ','
  31. #define AT_CMD_DQUOTES_MARK '"'
  32. #define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
  33. int at_vprintfln(const char *format, va_list args);
  34. void at_print_raw_cmd(const char *name, const char *cmd, int size);
  35. const char *at_get_last_cmd(int *cmd_size);
  36. int at_req_parse_args(const char *req_args, const char *req_expr, ...);
  37. int at_sscanf(const char *buf, const char *fmt, va_list args);
  38. void at_strip(char *str, const char patten);
  39. void chr_strip(char *str, const char patten);
  40. #endif