Revision: 910 Author: teawater Date: Mon Feb 6 01:24:56 2012 Log: Add gdbrsp sum output code http://code.google.com/p/kgtp/source/detail?r=910 Added: /bak/rspsum.c ======================================= --- /dev/null +++ /bak/rspsum.c Mon Feb 6 01:24:56 2012 @@ -0,0 +1,26 @@ +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdint.h> + +int +main(int argc,char *argv[],char *envp[]) +{ + unsigned char csum = 0; + int i; + + if (argc != 2) + return -1; + + for (i = 0; argv[1][i]; i++) + csum += argv[1][i]; + + printf("%x\n", csum); + + return 0; +}