#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define QUE_LENGTH 100
struct queue{
int head;
int tail;
char *array[QUE_LENGTH];
};
struct queue *create_queue(){
struct queue
* q
= malloc(sizeof(struct queue
)); q->head = 0;
q->tail = 0;
return q;
}
void enqueue(struct queue *q, char *s){
q->array[q->tail] = t;
if(q->tail == QUE_LENGTH)
q->tail = 0;
else
q->tail++;
}
char *dequeue(struct queue *q){
char* s = q->array[q->head];
if(q->head == QUE_LENGTH)
q->head = 0;
else
q->head++;
return s;
}
int main(int argc, char *argv[]){
int n = 10;
char buffer[100];
struct queue *q = create_queue();
if(argc > 1){
++argv;
if(**argv == '-')
}
while(fgets(buffer
, 100, stdin
)){ enqueue(q, buffer);
}
while(n--){
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKI2RlZmluZSBRVUVfTEVOR1RIIDEwMAoKc3RydWN0IHF1ZXVlewoJaW50IGhlYWQ7CglpbnQgdGFpbDsKCWNoYXIgKmFycmF5W1FVRV9MRU5HVEhdOwp9OwoKc3RydWN0IHF1ZXVlICpjcmVhdGVfcXVldWUoKXsKCXN0cnVjdCBxdWV1ZSogcSA9IG1hbGxvYyhzaXplb2Yoc3RydWN0IHF1ZXVlKSk7CglxLT5oZWFkID0gMDsKCXEtPnRhaWwgPSAwOwoJcmV0dXJuIHE7Cn0KCnZvaWQgZW5xdWV1ZShzdHJ1Y3QgcXVldWUgKnEsIGNoYXIgKnMpewoJY2hhciAqdCA9IG1hbGxvYygxMDApOwoJc3RyY3B5KHQsIHMpOwoJcS0+YXJyYXlbcS0+dGFpbF0gPSB0OwoJaWYocS0+dGFpbCA9PSBRVUVfTEVOR1RIKQoJCXEtPnRhaWwgPSAwOwoJZWxzZQoJCXEtPnRhaWwrKzsKfQoKY2hhciAqZGVxdWV1ZShzdHJ1Y3QgcXVldWUgKnEpewoJY2hhciogcyA9IHEtPmFyc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