samir82show

word process for rpm

Aug 9th, 2014
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <fcntl.h>
  5. int main()
  6. {
  7. int i, count = 0, isset = 0, fd;
  8. char arr[1000];
  9. while ((i = getchar()) != EOF)
  10. {
  11. if (i == '\"')
  12. {
  13. if (isset == 0) {
  14. isset = 1;
  15. arr[0] = '\0';
  16. count = 0;
  17. } else {
  18. arr[count++] = '\0';
  19. if (strlen(arr) > 3 && strcmp(arr+strlen(arr)-3,"rpm") == 0) {
  20. printf("%s\n",arr);
  21. }
  22. isset = 0;
  23. }
  24. }
  25. else
  26. {
  27. if (isset == 1)
  28. arr[count++] = i;
  29. }
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment