From 625972ce92aa74c14a99dcbdbe9b2b39c796b16c Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 5 Jul 2022 13:55:29 +0000 Subject: [PATCH] Convert strings to longs Co-authored-by: sigonasr2 --- C/scripts/build.sh | 2 +- C/scripts/md5 | 2 +- main.c | 24 +++++++++++++++++++++++- memovr | Bin 0 -> 16776 bytes sig | 4 ++-- utils/main.sh | 2 +- utils/md5 | 2 +- 7 files changed, 29 insertions(+), 7 deletions(-) create mode 100755 memovr diff --git a/C/scripts/build.sh b/C/scripts/build.sh index 654271e..3cbcb64 100755 --- a/C/scripts/build.sh +++ b/C/scripts/build.sh @@ -2,6 +2,6 @@ #C printf "Running program...\n\n\n" if gcc $(find . -type f -name "*.c") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then - ./${PROJECT_NAME} + ./${PROJECT_NAME} "$@" fi printf "\n\n" diff --git a/C/scripts/md5 b/C/scripts/md5 index 203bf2d..2749234 100644 --- a/C/scripts/md5 +++ b/C/scripts/md5 @@ -1,2 +1,2 @@ -build.sh:dbb1880f6b747ec208d6f277c0be61c2 - +build.sh:fcbd8c14fe2a608d11166cf5aa7dba02 - commit.sh:89783d2e6a165aa9612c79cfbd804a35 - diff --git a/main.c b/main.c index e4b3f6b..25847a6 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,27 @@ #include +#include + +unsigned long strToLong(char*str) { + int counter=0; + char c; + unsigned long val=0; + while ((c=str[counter++])!='\0') { + val*=10; + val+=c-'0'; + } + return val; +} int main(int argc,char**argv) { - printf("Hello World!"); + unsigned int pid; + unsigned long addr; + unsigned long val; + if (argc<3) { + printf("3 arguments required! Only %d specified.",argc); + } else { + for (int i=1;iJCl5WnvwSD4z z=kD!MyJ}h^mnv7+A>wZs)9XPuRuUfqM7ui7l)(?%v|!{GBBI?~sTmstiBV8L(5?an zRQ6(=+QG>3Qhf>iOm!A~>w!;1>YFe&m|2(R6pWaq^;(r3gvFx_$5O#LhMb&}m~M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`wn>zq+G*+60ZY!@8UINSV@~4 znOCV{-0n%zgH4+lK+j$+z)d9 z9|PV8?seEm;~jM_V!cXNC|5>p;npo%HYuySdkR^zplpn+k2E$k6=bRDfpv|M#`Te= zH8y_*XCw;2j@i00fe68W4!l3z=_LfapLzeeo1Z7{FYBkGG!NbS^Goy3%`Xr6Nl&-Y#1ix3}&Ou*3|zAv;( zes&xN$q(Ph+0Tg7pB>M~fG^knx%%}@>8Dn_f(`bha(=!qb(YNmc~u4c(%|gts2ll`*O^Ru4t_uR_s-|90I$rLmvT=4za)6A z;QKNQeuzBQOh)vxD<*-*xJ^={bTW7ruma*r=_};_ zangSicx%2X0!`Ai_MNe9aV@^RO@pH&ZoQPy+V0vO+t#tgEs>C@X(Eyz88nkUfTm&N0O#POkZuf#NH%Bck^XEUGGye2bi*8R zP(6h-9Op`>h>Ep#G?>YLA=L+x`2i70jbxz;8%@KOd{#H|>0H)T&_HJBnIsxeZYX1l zi0pX;vXTBA6fu+6dqu?5hoOkm5VUi0Xd?OmO}v2=c;k}o!=8b*1?Qov{P>~6JIMY2)z_kh6^YbhtKhALbSnu*bCy zm-)GuQK8Db?I&7HKn7#V_WXRzI7y0JzqkKiBl}j;?Ln)$3k7>9ObMcSdf`T=s`N_It^IQDH+u_Q#07^UnT{l7R6? zJTM-6cKf`?p4SbGRjf$pjo*u8U#dnSMZ(=wWZ?1R^3NfI?PvSB&IPl+xBfRg_PkzU z#OFk3^45PEg!t^w%S?X0<#WSceJ(S;2e#D?d;b6Aa08H#SkEral$pN-0-U>CKd+Pc z95|o%#_JCg+wu561sryf?Rh!T_@D#;A0lUcrF#rGn literal 0 HcmV?d00001 diff --git a/sig b/sig index 4284122..06a67d8 100755 --- a/sig +++ b/sig @@ -2,8 +2,8 @@ export AUTO_UPDATE=true source utils/define.sh -define PROJECT_NAME "CProjectTemplate" -define CUSTOM_PARAMS "-lncurses" +define PROJECT_NAME "memovr" +define CUSTOM_PARAMS "" define LANGUAGE "C" source utils/main.sh \ No newline at end of file diff --git a/utils/main.sh b/utils/main.sh index d299d6b..0a4c92a 100644 --- a/utils/main.sh +++ b/utils/main.sh @@ -25,4 +25,4 @@ if [ -z "$1" ] exit fi -./$LANGUAGE/scripts/$1.sh "${*:2}" \ No newline at end of file +./$LANGUAGE/scripts/$1.sh "${@:2}" \ No newline at end of file diff --git a/utils/md5 b/utils/md5 index f7c5ca7..b8c2ada 100644 --- a/utils/md5 +++ b/utils/md5 @@ -1,4 +1,4 @@ define.sh:3ecab0dffe2adfb950f3eb7c7061b750 - -main.sh:d3d1bd0b56d8114eb7479964227f8576 - +main.sh:4e6e9f0650ec790ce2c4364db94f0caa - search.sh:81d08f5ff48e8a44b5f68387d426da05 - .updateDirectories:fa5e95db12be22ae8aed7ecbc560e38c -