CS 3733 Operating Systems, Spring 1999 Assignment 1 Comments


Warning: This is not for the current semester.


Assignment 1 notes: Spring 1999


1.  Do not read in the entire file.  Process one line at a time.
2.  You do not need to free before an exit.
3.  Invalid to free if not allocated.
4.  NULL is not the string terminator.
5.  str1 = malloc(strlen(str);
    strcpy(str1,str)
    is not correct as it does not allocate space for the string terminator.
6.  You were not told to have the parent wait for the children.
7.  One-line functions should not be used unless there is a strong reason to.
8.  Use symbolic values for constants
9.  Did anyone ever test their code in the case of an input line too long?
10. if you have
       char **arvlist
    you should do:
       argvlsit = (char **)malloc(num*sizeof(char *));
11. Using fscanf to read in a string: no way to limit how much is read in.
12. No source lines should be longer than 80.
13. Handle error if exec fails.
14. Should close open files before execing.
15. Allocate for a string only the number of bytes needed.
    Read the string into a buffer first.
16. When you exec, the name of the program should be the first string in argv.
17. Do not:
      read in the options,
      put them in a string,
      then parse the string into tokens.
18. fgets(buf,BUFSZ,fp)
    if (strlen(buf) >= BUFSZ) ...
    This is never true.
19. my_argv[c] = (char *)malloc(xxx);
    my_atgv[c] = NULL;
    What does this do?
20. Submit only one solution.
21. All functions you write should be documented.
22. Poor documentation:
       n = 1;
       while (n >= 0) && !done) {
          if (i==0)
          ...
23. Mixing data types: 
        char buf[BUFSIZE];
        if (bif[j] == NULL)
24. lint message: strlen type used inconsistently (include string.h)