Script started on Wed Oct 22 17:27:22 2025 macbook:logs> echo code for attendance is 8527 code for attendance is 8527 macbook:logs> ssh snowball.cs.gsu.edu mweeks@snowball.cs.gsu.edu's password: Last login: Wed Oct 15 18:06:52 2025 from 131.96.222.117 + | GSU Computer Science | Instructional Server | SNOWBALL.cs.gsu.edu + [mweeks@gsuad.gsu.edu@snowball ~]$ du 12 ./examples 8 ./.cache/abrt 12 ./.cache 4 ./.config/abrt 8 ./.config 8 ./.ssh 1972 . [mweeks@gsuad.gsu.edu@snowball ~]$ df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 3992464 0 3992464 0% /dev tmpfs 4004384 4 4004380 1% /dev/shm tmpfs 4004384 410760 3593624 11% /run tmpfs 4004384 0 4004384 0% /sys/fs/cgroup /dev/mapper/centos-root 36678148 4891104 31787044 14% / /dev/sda1 1038336 330016 708320 32% /boot /dev/sdb1 257897924 127899860 116874540 53% /home tmpfs 800880 0 800880 0% /run/user/1331126452 tmpfs 800880 0 800880 0% /run/user/1331133048 tmpfs 800880 0 800880 0% /run/user/1597880738 tmpfs 800880 0 800880 0% /run/user/1400425432 tmpfs 800880 0 800880 0% /run/user/332723654 [mweeks@gsuad.gsu.edu@snowball ~]$ df -g df: invalid option -- 'g' Try 'df --help' for more information. [mweeks@gsuad.gsu.edu@snowball ~]$ df -m Filesystem 1M-blocks Used Available Use% Mounted on devtmpfs 3899 0 3899 0% /dev tmpfs 3911 1 3911 1% /dev/shm tmpfs 3911 402 3510 11% /run tmpfs 3911 0 3911 0% /sys/fs/cgroup /dev/mapper/centos-root 35819 4777 31043 14% / /dev/sda1 1014 323 692 32% /boot /dev/sdb1 251854 124903 114136 53% /home tmpfs 783 0 783 0% /run/user/1331126452 tmpfs 783 0 783 0% /run/user/1331133048 tmpfs 783 0 783 0% /run/user/1597880738 tmpfs 783 0 783 0% /run/user/1400425432 [mweeks@gsuad.gsu.edu@snowball ~]$ man du [mweeks@gsuad.gsu.edu@snowball ~]$ du -BM 1M ./examples 1M ./.cache/abrt 1M ./.cache 1M ./.config/abrt 1M ./.config 1M ./.ssh 2M . [mweeks@gsuad.gsu.edu@snowball ~]$ du -BK 12K ./examples 8K ./.cache/abrt 12K ./.cache 4K ./.config/abrt 8K ./.config 8K ./.ssh 1972K . [mweeks@gsuad.gsu.edu@snowball ~]$ date Wed Oct 22 17:51:41 EDT 2025 [mweeks@gsuad.gsu.edu@snowball ~]$ cat sort_strings.c #include #include #define STR_LEN 3 #define NUM_STRINGS 4 void swap_if_greater(char *str1, char *str2) { char temp[STR_LEN + 1]; if (strncmp(str1, str2, STR_LEN) > 0) { // out of order, so swap them strncpy(temp, str1, STR_LEN); strncpy(str1, str2, STR_LEN); strncpy(str2, temp, STR_LEN); } } int main(){ char my_strings[NUM_STRINGS][STR_LEN + 1] = {"def", "abc", "ghi", "ab"}; // What is the sorted order? // Do this in a terrible and simple way for (int i=0; i #include #define STR_LEN 3 #define NUM_STRINGS 4 void swap_if_greater(char *str1, char *str2) { char temp[STR_LEN + 1]; if (strncmp(str1, str2, STR_LEN) > 0) { // out of order, so swap them strncpy(temp, str1, STR_LEN); strncpy(str1, str2, STR_LEN); strncpy(str2, temp, STR_LEN); } } int main(){ char my_strings[NUM_STRINGS][STR_LEN + 1] = {"def", "abc", "ghi", "ab"}; // What is the sorted order? // Do this in a terrible and simple way int i; for (i=0; i #include int main(int argc, char *argv[]) { int i; for (i=0; i< argc; i++) printf("arg %d is %s \n", i, argv[i]); return 0; } [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out arg 0 is ./a.out [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one two three arg 0 is ./a.out arg 1 is one arg 2 is two arg 3 is three [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out -l arg 0 is ./a.out arg 1 is -l [mweeks@gsuad.gsu.edu@snowball ~]$ cp args.c args_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ vi args_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ gcc args_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ cat args_v2.c /********************************************************* * From C PROGRAMMING: A MODERN APPROACH, Second Edition * * By K. N. King * * Copyright (c) 2008, 1996 W. W. Norton & Company, Inc. * * All rights reserved. * * This program may be freely distributed for class use, * * provided that this copyright notice is retained. * *********************************************************/ // This is based on code from the above book #include #include #include int main(int argc, char *argv[]) { int i; for (i=0; i< argc; i++) printf("arg %d is %s \n", i, argv[i]); bool help = false; for (i=0; i< argc; i++) { if (strncmp(argv[i], "-h", 2) ) help = true; } if (help) { printf("args_v2.c \n"); printf(" This is a demo program to process the arguments.\n"); printf("Hope that helps!\n"); } return 0; } [mweeks@gsuad.gsu.edu@snowball ~]$ echo "where is the problem?" where is the problem? [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out arg 0 is ./a.out args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one two three arg 0 is ./a.out arg 1 is one arg 2 is two arg 3 is three args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one two three -h arg 0 is ./a.out arg 1 is one arg 2 is two arg 3 is three arg 4 is -h args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ vi args_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ gcc args_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ echo "added == 0 after strncmp" added == 0 after strncmp [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out arg 0 is ./a.out [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one arg 0 is ./a.out arg 1 is one [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one -h arg 0 is ./a.out arg 1 is one arg 2 is -h args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out -h one arg 0 is ./a.out arg 1 is -h arg 2 is one args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out -h one two three arg 0 is ./a.out arg 1 is -h arg 2 is one arg 3 is two arg 4 is three args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one two three -h four arg 0 is ./a.out arg 1 is one arg 2 is two arg 3 is three arg 4 is -h arg 5 is four args_v2.c This is a demo program to process the arguments. Hope that helps! [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out one two three four arg 0 is ./a.out arg 1 is one arg 2 is two arg 3 is three arg 4 is four [mweeks@gsuad.gsu.edu@snowball ~]$ vi C_ch16_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ gcc C_ch16_v2.c [mweeks@gsuad.gsu.edu@snowball ~]$ cat C cat: C: No such file or directory [mweeks@gsuad.gsu.edu@snowball ~]$ cat C_ch16_v2.c #include int main() { union { int i; float f; } u; struct { int i; float f; } s; s.i = 3; s.f = 5.6; printf("s.i is %d \n", s.i); printf("s.f is %f \n", s.f); u.i = 3; u.f = 5.6; printf("u.i is %d \n", u.i); printf("u.i is %x in hex\n", u.i); printf("u.f is %f \n", u.f); return 0; } [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out s.i is 3 s.f is 5.600000 u.i is 1085485875 u.i is 40b33333 in hex u.f is 5.600000 [mweeks@gsuad.gsu.edu@snowball ~]$ vi C_ch16_v3.c [mweeks@gsuad.gsu.edu@snowball ~]$ gcc C_ch16_v3.c [mweeks@gsuad.gsu.edu@snowball ~]$ cat C_ch16_v3.c #include int main() { union { int i; float f; } u; struct { int i; float f; } s; s.i = 23; printf("s.i is %d \n", s.i); s.f = 4.756; printf("s.f is %f \n^[[2;2R", s.f); u.i = 23; printf("u.i is %d \n", u.i); printf("u.i is %x in hex\n", u.i); u.f = 4.756; printf("u.f is %f \n", u.f); printf("Final values:\n"); printf("s.i is %d \n", s.i); printf("s.f is %f \n", s.f); printf("u.i is %d \n", u.i); printf("u.i is %x in hex\n", u.i); printf("u.f is %f \n", u.f); return 0; } [mweeks@gsuad.gsu.edu@snowball ~]$ ./a.out s.i is 23 s.f is 4.756000 u.i is 23 u.i is 17 in hex u.f is 4.756000 Final values: s.i is 23 s.f is 4.756000 u.i is 1083715879 u.i is 40983127 in hex u.f is 4.756000 [mweeks@gsuad.gsu.edu@snowball ~]$ exit logout Connection to snowball.cs.gsu.edu closed. macbook:logs> exit Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. Script done on Wed Oct 22 18:46:04 2025