O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advanced Exercises

10.Assume that your buffer contains the C code shown here, with the Major mode set for C and the cursor positioned at the end of the while line as shown by the black square:
/* 
* Copy string s2 to s1.  s1 must be large enough
* return s1
*/
char *
strcpy(s1, s2)
register char *s1, *s2;
{
     register char *os1;

     os1 = s1;
     while (*s1++ = *s2++)
     ;
return(os1);
}

/* Copy source into dest, stopping after '\0' is copied, and
   return a pointer to the '\0' at the end of dest.  Then our caller
   can concatenate to the dest string without another strlen call. */
char *
stpcpy (dest, source)
     char *dest;
     char *source;
{
  while ((*dest++ = *source++) != '\0') ▀
     ; /* void loop body */
  return (dest - 1);
}
  1. What command moves the cursor to the opening ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required