duff.c
changeset 63 5a82f89d607e
parent 57 7739518acafb
equal deleted inserted replaced
62:b7061c0e239f 63:5a82f89d607e
     6 
     6 
     7 #include <stdio.h>
     7 #include <stdio.h>
     8 #include <stdlib.h>
     8 #include <stdlib.h>
     9 #include <string.h>
     9 #include <string.h>
    10 
    10 
    11 char *duffcopy (char *to, char *from, int len)
    11 char *duffcopy (char *to, char *from, size_t len)
    12 {
    12 {
    13     int n, pos = 0;
    13     size_t n, pos = 0;
    14 
    14 
    15     n = (len + 7) / 8;
    15     n = (len + 7) / 8;
    16 
    16 
    17     switch (len % 8) {
    17     switch (len % 8) {
    18     case 0:
    18     case 0:
    47 }
    47 }
    48 
    48 
    49 int main (int argc, char **argv)
    49 int main (int argc, char **argv)
    50 {
    50 {
    51     char *to, *from;
    51     char *to, *from;
    52     int len;
    52     size_t len;
    53 
    53 
    54     if (argc != 2) {
    54     if (argc != 2) {
    55         printf ("Usage: %s <string>\n", argv[0]);
    55         printf ("Usage: %s <string>\n", argv[0]);
    56         return EXIT_FAILURE;
    56         return EXIT_FAILURE;
    57     }
    57     }