#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
= (struct queue
*)malloc(sizeof(struct queue
)); q->head = 0;
q->tail = 0;
return q;
}
void enqueue(struct queue *q, char *s){
q->array[q->tail] = s;
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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKI2RlZmluZSBRVUVfTEVOR1RIIDEwMAoKc3RydWN0IHF1ZXVlewoJaW50IGhlYWQ7CglpbnQgdGFpbDsKCWNoYXIgKmFycmF5W1FVRV9MRU5HVEhdOwp9OwoKc3RydWN0IHF1ZXVlICpjcmVhdGVfcXVldWUoKXsKCXN0cnVjdCBxdWV1ZSogcSA9IChzdHJ1Y3QgcXVldWUgKiltYWxsb2Moc2l6ZW9mKHN0cnVjdCBxdWV1ZSkpOwoJcS0+aGVhZCA9IDA7CglxLT50YWlsID0gMDsKCXJldHVybiBxOwp9Cgp2b2lkIGVucXVldWUoc3RydWN0IHF1ZXVlICpxLCBjaGFyICpzKXsKCXEtPmFycmF5W3EtPnRhaWxdID0gczsKCWlmKHEtPnRhaWwgPT0gUVVFX0xFTkdUSCkKCQlxLT50YWlsID0gMDsKCWVsc2UKCQlxLT50YWlsKys7Cn0KCmNoYXIgKmRlcXVldWUoc3RydWN0IHF1ZXVlICpxKXsKCWNoYXIqIHMgPSBxLT5hcnJheVtxLT5oZWFkXTsKCWlmKHEtPmhl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