Skip to content

Commit fe46a5c

Browse files
committed
specify the char as argument
1 parent 0b702c5 commit fe46a5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shm/shm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
int
1414
main(int argc, char *argv[])
1515
{
16-
if (argc != 2)
17-
errx(1, "usage: shm <shm_name>");
16+
if (argc != 3)
17+
errx(1, "usage: shm <shm_name> <char>");
1818

1919
const char *shm_name = argv[1];
2020
if (shm_name[0] != '/')
@@ -36,7 +36,7 @@ main(int argc, char *argv[])
3636
close(fd);
3737

3838
for (char *q = p; q < p + size; q++)
39-
*q = 'D';
39+
*q = argv[2][0];
4040

4141
// Uncomment to destroy the shared memory segment:
4242
// shm_unlink(shm_name);

0 commit comments

Comments
 (0)