FreeCalypso > hg > freecalypso-sw
view rvinterf/etmsync/dispatch.c @ 884:353daaa6014d
gsm-fw/gpf/conf/gsmcomp.c: increased max partition in the voice-only config
The code we got from TCS211 had the maximum prim pool partition size set to
900 bytes in the voice-only config (no FAX_AND_DATA, no GPRS) and to 1600 bytes
in every other config. As it turns out, this "minimized" config breaks when
the AT command interface is used with %CPI enabled, as the responsible code in
ATI does an ACI_MALLOC of 1012 bytes. TI may have considered this case to be
unsupported usage (perhaps they didn't care about the combination of a
voice-only PS with AT command control), but we do want this use case to work
without crashing. Solution: I made the largest prim pool the same as it is
with FAX_AND_DATA: 3 partitions of 1600 bytes.
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 27 Jun 2015 07:31:30 +0000 |
parents | 69e8ae2b5ba2 |
children |
line wrap: on
line source
/* * This module implements the command dispatch for fc-fsio * and possibly other similar utilities in the future. */ #include <ctype.h> #include <stdio.h> #include <string.h> #include <strings.h> #include <stdlib.h> #include "cmdtab.h" #include "exitcodes.h" extern struct cmdtab cmdtab[]; parse_and_dispatch_cmd(cmd, is_script) char *cmd; { char *argv[MAX_CMD_ARGS+2]; char *cp, **ap; struct cmdtab *tp; for (cp = cmd; isspace(*cp); cp++) ; if (!*cp || *cp == '#') return(0); if (is_script) printf("Script command: %s\n", cp); argv[0] = cp; while (*cp && !isspace(*cp)) cp++; if (*cp) *cp++ = '\0'; for (tp = cmdtab; tp->cmd; tp++) if (!strcmp(tp->cmd, argv[0])) break; if (!tp->func) { fprintf(stderr, "error: no such command\n"); return(ERROR_USAGE); } for (ap = argv + 1; ; ) { while (isspace(*cp)) cp++; if (!*cp || *cp == '#') break; if (ap - argv - 1 >= tp->maxargs) { fprintf(stderr, "error: too many arguments\n"); return(ERROR_USAGE); } if (*cp == '"') { *ap++ = ++cp; while (*cp && *cp != '"') cp++; if (*cp != '"') { fprintf(stderr, "error: unterminated quoted string\n"); return(ERROR_USAGE); } *cp++ = '\0'; } else { *ap++ = cp; while (*cp && !isspace(*cp)) cp++; if (*cp) *cp++ = '\0'; } } if (ap - argv - 1 < tp->minargs) { fprintf(stderr, "error: too few arguments\n"); return(ERROR_USAGE); } *ap = 0; return tp->func(ap - argv, argv); } dispatch_ready_argv(argc, argv) char **argv; { struct cmdtab *tp; for (tp = cmdtab; tp->cmd; tp++) if (!strcmp(tp->cmd, argv[0])) break; if (!tp->func) { fprintf(stderr, "error: no such command\n"); return(ERROR_USAGE); } if (argc - 1 > tp->maxargs) { fprintf(stderr, "error: too many arguments\n"); return(ERROR_USAGE); } if (argc - 1 < tp->minargs) { fprintf(stderr, "error: too few arguments\n"); return(ERROR_USAGE); } return tp->func(argc, argv); } cmd_exec(argc, argv) char **argv; { FILE *f; char linebuf[512], *cp; int lineno, retval = 0; f = fopen(argv[1], "r"); if (!f) { perror(argv[1]); return(ERROR_USAGE); } for (lineno = 1; fgets(linebuf, sizeof linebuf, f); lineno++) { cp = index(linebuf, '\n'); if (!cp) { fprintf(stderr, "%s line %d: missing newline\n", argv[1], lineno); fclose(f); return(ERROR_USAGE); } *cp = '\0'; retval = parse_and_dispatch_cmd(linebuf, 1); if (retval) break; } fclose(f); return(retval); } cmd_exit() { exit(0); }