home *** CD-ROM | disk | FTP | other *** search
/ CICA 1992 November / CICA_MS_Windows_CD-ROM_Walnut_Creek_November_1992.iso / bbs / get_area.c < prev    next >
C/C++ Source or Header  |  1992-11-12  |  636b  |  36 lines

  1. /*
  2.  * get_area.c
  3.  * get area description as line after path for pdsl disc
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9.  
  10. void _Cdecl
  11. main(int argc, char *argv[]) {
  12.     char buf[200];
  13.     int i;
  14.     
  15.     if (argc != 3) {
  16.         fprintf(stderr, "usage: get_area [# spaces] [path] < input_file > output_file\n");
  17.         exit(1);
  18.     }
  19.     
  20.     i = atoi(argv[1]);
  21.     
  22.     while (NULL != gets(buf)) {
  23.         if (0 == stricmp(argv[2], buf)) {
  24.             if (NULL != gets(buf)) {
  25.                 if (i)
  26.                     printf("%*s%s\n", i, " ", buf);
  27.                 else
  28.                     printf("%s\n", buf);
  29.             }
  30.             exit(0);
  31.         }
  32.     }
  33.     fprintf(stderr, "no area found\n");
  34.     exit(1);
  35. }
  36.