-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremindme.c
More file actions
45 lines (43 loc) · 946 Bytes
/
remindme.c
File metadata and controls
45 lines (43 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "headers.h"
void remindme(char *token)
{
char st[100][100];
int k = 0;
while (token != NULL)
{
strcpy(st[k++], token);
token = strtok(NULL, " \n\t\r");
}
int i = 0;
int rem = atoi(st[1]);
int pid = fork();
if (pid < 0)
printf("Sorry reminder could not be added\n");
else if (pid == 0)
{
sleep(rem);
printf("\nREMINDER: ");
for (i = 2; i < k; i++)
{
int l = strlen(st[i]);
if (st[i][0] == '\"')
{
int j;
for (j = 1; j < l; j++)
st[i][j - 1] = st[i][j];
st[i][l - 1] = '\0';
}
l = strlen(st[i]);
if (st[i][l - 1] == '\"')
{
st[i][l - 1] = '\0';
}
printf("%s ", st[i]);
}
printf("\n");
}
else
{
return;
}
}