Unix Technical Forum

[patch] KNF in touch

This is a discussion on [patch] KNF in touch within the mailing.openbsd.tech forums, part of the OpenBSD category; --> hello, I know that it's not very important but I made some fixes to touch so it's more KNF ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 08:22 AM
Przemyslaw Nowaczyk
 
Posts: n/a
Default [patch] KNF in touch

hello,
I know that it's not very important but I made some fixes to touch so it's
more KNF compliant.. especially usage() and some declarations lineup..

if somebody thinks it's silly - sorry for the noise..

Index: touch.c
================================================== =================
RCS file: /cvs/src/usr.bin/touch/touch.c,v
retrieving revision 1.12
diff -u -r1.12 touch.c
--- touch.c 2005/04/20 19:16:34 1.12
+++ touch.c 2006/03/07 08:45:16
@@ -58,18 +58,18 @@
#include <tzfile.h>
#include <unistd.h>

-void stime_arg1(char *, struct timeval *);
-void stime_arg2(char *, int, struct timeval *);
-void stime_file(char *, struct timeval *);
-void usage(void);
+void stime_arg1(char *, struct timeval *);
+void stime_arg2(char *, int, struct timeval *);
+void stime_file(char *, struct timeval *);
+__dead void usage(void);

int
main(int argc, char *argv[])
{
- struct stat sb;
- struct timeval tv[2];
- int aflag, cflag, mflag, ch, fd, len, rval, timeset;
- char *p;
+ struct stat sb;
+ struct timeval tv[2];
+ int aflag, cflag, mflag, ch, fd, len, rval, timeset;
+ char *p;

setlocale(LC_ALL, "");

@@ -183,10 +183,10 @@
void
stime_arg1(char *arg, struct timeval *tvp)
{
- struct tm *t;
- time_t tmptime;
- int yearset;
- char *p;
+ struct tm *t;
+ time_t tmptime;
+ int yearset;
+ char *p;
/* Start with the current time. */
tmptime = tvp[0].tv_sec;
if ((t = localtime(&tmptime)) == NULL)
@@ -242,8 +242,8 @@
void
stime_arg2(char *arg, int year, struct timeval *tvp)
{
- struct tm *t;
- time_t tmptime;
+ struct tm *t;
+ time_t tmptime;
/* Start with the current time. */
tmptime = tvp[0].tv_sec;
if ((t = localtime(&tmptime)) == NULL)
@@ -275,7 +275,7 @@
void
stime_file(char *fname, struct timeval *tvp)
{
- struct stat sb;
+ struct stat sb;

if (stat(fname, &sb))
err(1, "%s", fname);
@@ -286,7 +286,9 @@
__dead void
usage(void)
{
+ extern char *__progname;
+
(void)fprintf(stderr,
- "usage: touch [-acm] [-r file] [-t time] file ...\n");
+ "usage: %s [-acm] [-r file] [-t time] file ...\n", __progname);
exit(1);
}

--
Przemyslaw Nowaczyk <p_nowaczyk@o2.pl>
CS student @ Poznan University of Technology

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com