Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hand in Code plus use document Demo Working code 1 Overview C has so few built-in capabilities that the first job is to build some
Hand in Code plus use document Demo Working code 1 Overview C has so few built-in capabilities that the first job is to build some basic libraries that your OS (nanoOS) will use. Components of these libraries include memory/string manipulation, printing, basic data structures, and storage allocation. These libraries are to be integrated into your nanoOS. This assignment requires that you integrate and test these libraries. You will create five source files, memstrprint.h, mem.c, str.c and printf.c and test. c as well as a Makefile and documentation. The code is to be built and tested in VirtualBox using the Linux tools. 2 Details In this assignment you'll build these routines: void *memcpy (void *dest, const void *sre, size_t n); void memset (void s, int c, size.t n ); int memcmp(const void s1, const void s2, size_t n ); char *strcat (char *dest, const char *src); char *strncat (char *dest, const char *sre, size _t n); int stremp(const char s1, const char s2 ); int strnemp(const char s1, const char *s2, size.t n ); char *strepy (char *dest, const char *sre); char *strnepy (char *dest, const char *sre, size _t n); int printf(const char * format, ...); The headers declaring the functions will all be in the single header file. Three separate .c files contain mem, str, and printf procedures. The meaning of the above APls are the same as the user space routines, and are described in various man pages. You are expected to adhere to those mannal pages for all routines estcept printf. Printf is more complicated, and so we'll simplify it bere. Printf should accept an arbitrary number of parameters in a single call. (You'll need to include stdarg.h.) After the format string, each argument is either an int, loang, or a string. Your printf should support formats '\%s', '\%d', \%x', \%u', '\%kd', \%lx', '\%lu'. The result of printf is seat to stdout. The code should work on both 32-bit and 64-bit architectures. 3 Other issues There is code for these routines on the Internet. If you look at any code, you must reference it in your code, describe how you have used it, and point to its source (URL). You are not to show anyone else your code or to look at anyone else's code (we will be examining the code for similarity). Otherwise, you are free and encouraged to discuss the assignments You are expected to completely understand any code you hand in. Hints 1. Build and test the code in user space, 2. Start immediately 3. You shoald look at as many issues in parallel (coding, testing, linking, etc.) 4. You may put a limit on printf output size or you may write it so there is no limit. You must state which is the case. 5. You must test all pointers to determine if they have a NULL value, and if so to end your program, after printing out an appropriate error message. You should use _FlLE.. and _L.INE.. to print an appropriate message. 4 What you should do - Test the different cases for your code - Test for illegal issuss such as more parameters than format specifiers, more format specifiers than parameters, parameter type mismatch, and interpoet the results. - In abdition, I'd liks to see the output of the following tests char *cat =" cat"; char *dogGoesWoof ="dog\0 goes \0 woot char str (100); (Note that these tests may do strange things, like crash your program. Thus, you may not be able to execute them all in a single run.) 5 What to hand in A tar file with the name lastName firstName assignl.tar the tar file should unpack into directory lastname-firstname/assign1. Please replace lastName with your last name and firstName with your first name
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started