afify / azan (public) (License: MIT) (since 2020-03-08) (hash sha1)
azan is a simple muslim prayers notifier for unix-like systems.
List of commits:
Subject Hash Author Date (UTC)
[fix] read cache file function 93c03a6cd5d7e8b0f83057ea707544727aa3ed49 Hassan Afify 2019-09-28 07:46:50
[fix] print next fajr bug 9c2a2bf932fb536c93a78eaaefa0fb8605f57d3e Hassan Afify 2019-09-27 04:55:14
[fix] check failed stat, clean code, Makefile 111e4834d9311854fa0af5b075c8534eba646487 Hassan Afify 2019-09-26 18:29:57
[doc] update README f5ff97da3e92639d79e1c9cff46ac0995139a3b6 Hassan Afify 2019-09-25 18:10:18
[release] v0.1 a1a2a57e74f8af49595253c067ff79de52b533e7 Hassan Afify 2019-09-25 06:01:46
[fix] [Valgrind] Memory leaks, stack errors. f06c1192c98f0405b727b9ca4346ed7262476c33 Hassan Afify 2019-09-24 16:02:56
[fix] create_cache bug, clean Makefile *.log 7d998c3f864fe07102b3fa07f83ea754159a9927 Hassan Afify 2019-09-24 05:38:39
[feat] argument options, next_fajr 4cd6ef1633f3e5cd3afe36be70e9c718911e701d Hassan Afify 2019-09-23 09:38:57
[doc] Update CONTRIBUTING, README & man page a16565d0b498313a8df232d3e2f5e7c1367dc191 Hassan Afify 2019-09-22 10:23:25
[doc] Update CONTRIBUTING, README & man page 0b978479fbe5d6e626a55a5ac78231393a267025 Hassan Afify 2019-09-22 10:23:25
[feat] Edit Makefile, Add config.def.h, config.mk c9e13a7b6dcc00894620f5788c04f4afba0f59d4 Hassan Afify 2019-09-21 17:11:34
[fix] Replace CODE_STYLE with CONTRIBUTING.md be2b91ef8d73aea536bc45446808633561d8afd9 Hassan Afify 2019-09-21 11:14:30
[feat] Edit Makefile, azan.c 538877a4311572caa1ddb88ffd0bac5e0b4379bc Hassan Afify 2019-09-20 12:59:05
[feat] Edit Makefile f41f74a524feb96228eb35a77a336862d5ca958c Hassan Afify 2019-09-19 05:04:00
[feat] Self Calcutation 1be712f454adda33c8a182a4478a3abf5dba6745 Hassan Afify 2019-09-17 08:11:15
[init] Initial Commit 2654768d0412e07cf7aa4b78a41b125aeceab82e Hassan Afify 2019-09-04 01:44:23
Commit 93c03a6cd5d7e8b0f83057ea707544727aa3ed49 - [fix] read cache file function
- problem: using strtok, last value is missed.
- solution: use fgets:
- why fgets:
> Reading continues until the number of characters read is equal to n-1,
> or until a newline character (\n), or until the end of the stream,
> whichever comes first.
- stored cache values are seperated by \n

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.bpxbd00/fgets.htm
Author: Hassan Afify
Author date (UTC): 2019-09-28 07:46
Committer name: Hassan Afify
Committer date (UTC): 2019-09-28 07:46
Parent(s): 9c2a2bf932fb536c93a78eaaefa0fb8605f57d3e
Signing key: 0F6CD1196B2A5658
Tree: fc538b6378cfb65952bad994d2919923b5a02149
File Lines added Lines deleted
azan.c 9 27
File azan.c changed (mode: 100644) (index c836a8e..d6c93fb)
... ... static time_t*
345 345 read_azan_cache_file(char* azan_cache_file) read_azan_cache_file(char* azan_cache_file)
346 346 { {
347 347 FILE* fp; FILE* fp;
348 char buffer[2048];
349
350 /* Read the cache file */
351 fp = fopen(azan_cache_file,"r");
352 FAIL_IF(fp == NULL, "[Error] opening azan cache file.");
353 (void)fread(buffer, 2048, 1, fp);
354 (void)fclose(fp);
348 char buffer[128];
355 349
356 350 time_t* pray_times_array; /* the returned array */ time_t* pray_times_array; /* the returned array */
357 351 pray_times_array = calloc(6, sizeof(time_t)); pray_times_array = calloc(6, sizeof(time_t));
358 352 FAIL_IF(pray_times_array == NULL, "[Error] allocating memory."); FAIL_IF(pray_times_array == NULL, "[Error] allocating memory.");
359 353 char* tmp_pray[6]; /* string array hold temp values for checking */ char* tmp_pray[6]; /* string array hold temp values for checking */
360 354
361 /*
362 * split each key value sepeated by <\n>
363 * the first strtok take the string
364 * if the value is not NULL:
365 * 1-convert to time_t 2-assign to returned array
366 */
367 char delim[] = "\n";
368
369 tmp_pray[0] = strtok(buffer, delim);
370 FAIL_IF(tmp_pray[0] == NULL, "[Error] reading cache file");
371 pray_times_array[0] = (time_t)atol(tmp_pray[0]);
355 /* Read the cache file */
356 fp = fopen(azan_cache_file,"r");
357 FAIL_IF(fp == NULL, "[Error] opening azan cache file.");
372 358
373 for(int i=1; i<5; i++){
374 tmp_pray[i] = strtok(NULL, delim);
359 int i = 0;
360 while(fgets(buffer, (int)sizeof(buffer), fp) != NULL) {
361 tmp_pray[i] = buffer;
375 362 if (tmp_pray[i] != NULL) { if (tmp_pray[i] != NULL) {
376 363 pray_times_array[i] = (time_t)atol(tmp_pray[i]); pray_times_array[i] = (time_t)atol(tmp_pray[i]);
377 364 } }
365 i++;
378 366 } }
379 367
380 tmp_pray[5] = buffer;
381 if (tmp_pray[5] != NULL) {
382 puts(tmp_pray[5]);
383 pray_times_array[5] = (time_t)atol(tmp_pray[5]);
384 }
385
386
368 FAIL_IF(fclose(fp) != 0, "[Error] can't close cache file'");
387 369 FAIL_IF(pray_times_array == NULL, "[Error] pray_times_array is NULL."); FAIL_IF(pray_times_array == NULL, "[Error] pray_times_array is NULL.");
388 370 return pray_times_array; return pray_times_array;
389 371 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/afify/azan

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/afify/azan

Clone this repository using git:
git clone git://git.rocketgit.com/user/afify/azan

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main