home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 9 Archive
/
09-Archive.zip
/
testzp13.zip
/
queue.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-25
|
3KB
|
97 lines
/*****************************************************************
* Testzip version 1.13 *
* Test zip file integrity, Nuke Bad Zips *
* Also prints a list of what it deleted in optional logfile. *
* *
* Programmer: Madman, with suggestions from Pantera *
* Date: 12/6/96 Version 1.0 *
* *
* Modified by: Jeff Hamilton, hjeffrey@wam.umd.edu *
* Date: 12/8/96 Version 1.01 *
* Date: 12/12/96 Version 1.02 *
* Date: 12/13/96 Version 1.03 *
* Date: 12/15/96 Version 1.04 *
* Date: 1/5/97 Version 1.1 *
* *
* Queue functions by John Dowdal (queue.c and queue.h) *
* *
* See the readme.txt included with this source code for more *
* information, and instructions for compiling and using this *
* program. *
* *
* Disclaimer: DISCLAIM THIS!!!! *
* This program and source code are distributed as is. There is *
* NO guarantee that it will work on all systems. Please test *
* it out before using. The programmers take no responsibilty *
* for lost or damaged files, or any other problems that use of *
* this software might cause. *
* *
* Bug Reports: *
* If you find a bug, please e-mail a description of your *
* operating system, what the bug does, and how to reproduce it *
* to hjeffrey@wam.umd.edu I will make every effort to find and *
* correct the bug. *
*****************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include "queue.h"
void initq(queue *q) {
assert(q!=NULL);
if(q) {
q->first=q->last=NULL;
}
}
qeltt *newqelt() {
qeltt *ret;
if ( ( ret=malloc(sizeof (qeltt)))==NULL ) {
fprintf(stderr," Out of memory.\n");
exit(1);
}
return ret;
}
void addq(queue *q,char *data) {
qeltt *newelt = newqelt();
assert(q!=NULL);
assert(data!=NULL);
newelt->data=strdup(data);
newelt->next=NULL;
if(q->first==NULL) {
q->last=q->first=newelt;
} else {
q->last->next=newelt;
q->last=newelt;
}
}
qeltt *delq(queue *q) {
qeltt *ret;
assert(q!=NULL);
assert(q->first!=NULL);
ret=q->first;
q->first=q->first->next;
if(q->first==NULL)
q->last=NULL;
return ret;
}
int emptyq(queue *q) {
assert (q!=NULL);
return q->first==NULL;
}